Ask Your Question
0

Why is "start syntax" not allowing comments at end of file?

asked Jan 22

JasperT gravatar image JasperT
33 1 5 11

updated Jan 22

I have

lexical Comment = [#] ![\n]* [\n];

lexical Layout 
    = [\ \t\n\r] 
    | @category="Comment" Comment;

layout LAYOUTLIST = Layout* !>> [\ \t\n\r#];

And when i use the start[Foo] in my parse function (assuming I have start syntax Foo = ..), I can write whitespace and comments at the beginning of the file, and whitespace at the end of the file, but I cannot write comments at the end of the file. Is this a bug?

delete close flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
1

answered Jan 22

MarkHills gravatar image MarkHills
351 6 10

I'm assuming this is happening because your definition of comment requires that it contains a newline at the end. If you change the final [\n] to $ it should work, since that will match either the end of the line or the end of the file.

link delete flag offensive edit

Comments

That was it, thanks!

JasperT (Jan 22)edit

Your answer

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
[hide preview]
Also see the Rascal Tutor.

Question tools

Follow

subscribe to rss feed

Stats

Asked: Jan 22

Seen: 11 times

Last updated: Jan 22

Related questions