Tracker: Bugs

5 Legitimate ]] causes error, and other parser confusion - ID: 1566576
Last Update: Comment added ( ellisj )

rkopelman@mainframe.ca

The following lines cannot run in a .spy file; they
result in "Spyce syntax error at test.spy:2-5 - EOF in
multi-line statement".

===================
[[\
array1 = [0, 1, 2, 3, 4]
array2 = [0, 10, 20, 30, 40]

print array2[array1[2]]
]]
===================

I believe that there are other variants of this that
give more obscure errors, but I can't recall for sure.

It seems like doing some bracket matching before
deciding to terminate the Python block would be called for.

This can be worked around by putting a space between
the two bracket characters or by breaking the statement
into multiple lines (using the "<%" "%>" block marking
syntax strangely doesn't help although you get
different errors depending on whether you you use the
"\" to indicate Python indentation - why are the "%>"
and "]]" tokens interchangable?).

Even worse, commenting out the offending "]]" line
(using "#") doesn't change the failure! Very
unintuitive, although I understand that there are
certain limitations given the choice of block markers.

And furthermore, "]]" or "%>" in pure HTML will cause
an error as well - this can't be right, can it? PHP
certainly doesn't mind unmatched "?>" tokens.

Sorry to cover so many issues at once - this seemed
like a pretty narrow problem when I started the report.


Nobody/Anonymous ( nobody ) - 2006-09-27 12:11:16 PDT

5

Open

None

Nobody/Anonymous

None

None

Public


Comment ( 1 )

Date: 2007-02-01 21:05:34 PST
Sender: ellisjProject Admin


You're right, the Spyce parser is pretty stupid sometimes. Some of the
problems you mention are covered here:
http://spyce.sourceforge.net/docs/doc-lang.html

Actually fixing this would require a rewrite of the parser. The good news
is this would be pretty straightforward; the bad news is it's a lot of work
with only the payoff of fixing some corner cases. I don't plan to attempt
this myself in the forseeable future, but I'd be glad to answer questions
if you'd like to work on a patch.


Attached File

No Files Currently Attached

Change ( 1 )

Field Old Value Date By
summary Legitimate ]] causes error in .spy files 2007-02-01 21:05:34 PST ellisj