There is a bug in the preprocessor with repspect to filtering out comments.
The following:
startshape MAKER
blah blah blah
rule MAKER { TRIANGLE{} MAKER {s 0.9 y 1 r 4}}
rule MAKER { TRIANGLE{} MAKER {s 0.9 y 1 r -4}}
...generates an error, as expected, on line 2.
The following:
startshape MAKER
// blah blah blah
# blah blah blah
/* blah blah blah */
rule MAKER { TRIANGLE{} MAKER {s 0.9 y 1 r 4}}
rule MAKER { TRIANGLE{} MAKER {s 0.9 y 1 r -4}}
...works as expected (all 3 "blah" lines are ignored)./
BUT, the following errors exit
ERROR #1:
The follwing will generate a syntax error if there is no line feed on the end of the last line:
startshape MAKER
// blah blah blah
rule MAKER { TRIANGLE{} MAKER {s 0.9 y 1 r 4}}
// rule MAKER { TRIANGLE{} MAKER {s 0.9 y 1 r -4}}
ERROR #2:
The second rule will be active (i.e. not be ignored) if there is no line feed on the end of the last line:
startshape MAKER
// blah blah blah
rule MAKER { TRIANGLE{} MAKER {s 0.9 y 1 r 4}}
# rule MAKER { TRIANGLE{} MAKER {s 0.9 y 1 r -4}}
I imagine both errors are related.
Preprocessor bug filtering out comments
Moderators: MtnViewJohn, chris, mtnviewmark
- MtnViewJohn
- Site Admin
- Posts: 882
- Joined: Fri May 06, 2005 2:26 pm
- Location: Mountain View, California
- Contact:
They are both caused by lex/flex not being able to skip past a line comment that ends with an end-of-file instead of a line-feed. We have known about this limitation in the lex grammar for a while. Rather than try to fix the lex grammar I put in a fix to always tack a line-feed at the end of the cfdg file.
-
- Posts: 17
- Joined: Fri Mar 30, 2007 9:10 pm
Commented last line returns error - a-ha!
I've been editing CFDG files in Textmate for the syntax highlighting and rendering in Context Free for the iterative display, and this bug was killing me until I figured it out. I'm glad to see a post about it here.
In 2.0, it still dies with most unhelpful error messages - is the appended-line-feed fix in 2.1b? And when is the line added - on save, or on render?
In 2.0, it still dies with most unhelpful error messages - is the appended-line-feed fix in 2.1b? And when is the line added - on save, or on render?
- MtnViewJohn
- Site Admin
- Posts: 882
- Joined: Fri May 06, 2005 2:26 pm
- Location: Mountain View, California
- Contact: