Claude Moulin wrote:
> Hello Jim,
> 
> The bug is very strange and I made many tests in order to identify the
> problem.
> 
> It is due to comments inserted in scope declarations. Sometimes they are
> accepted; in other cases no. It is impossible for me to know why.
> 
> When there is a problem, lines like: // $myscope::varname = 0; also give
> an error even if they are comments.

The $ should be escaped if it is in a comment (or other non-expression
content such as within a string or character literal), i.e.

// \$myscope::varname = 0;

Yes, it's annoying. The reason is that since ANTLR doesn't parse the
target language, it can't tell which parts are comments or literals,
and so it will still report errors if the $-reference is not valid.

(If it is valid to refer to $myscope::varname in that context, then
it should be harmless for it be expanded within a comment, except that
looking at the generated code may be confusing.)

-- 
David-Sarah Hopwood  ⚥  http://davidsarah.livejournal.com

Attachment: signature.asc
Description: OpenPGP digital signature

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

Reply via email to