Context Free Art

Forums

Preprocessor bug filtering out comments

Moderators: chris, MtnViewMark, MtnViewJohn

<<

epmoyer

Posts: 1

Joined: Wed Dec 27, 2006 12:37 pm

Post Wed Dec 27, 2006 1:27 pm

Preprocessor bug filtering out comments

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.
<<

MtnViewJohn

User avatar

Site Admin

Posts: 743

Joined: Fri May 06, 2005 2:26 pm

Location: Mountain View, California

Post Wed Dec 27, 2006 7:38 pm

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.
<<

jeremydouglass

Posts: 17

Joined: Fri Mar 30, 2007 9:10 pm

Post Fri Mar 30, 2007 10:04 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?
<<

MtnViewJohn

User avatar

Site Admin

Posts: 743

Joined: Fri May 06, 2005 2:26 pm

Location: Mountain View, California

Post Sat Mar 31, 2007 8:48 am

The linefeed fix is in 2.1b only, not 2.0. The linefeed is added on at the render, so it is OK if Textmate doesn't add on a linefeed.

Return to Developers

Who is online

Users browsing this forum: No registered users and 0 guests

cron
Forum Tools
Search
User
  • Register
  • Username:
  • Password:
  • Remember login
book coverSee our book:
Community of Variation