[antlr-interest] error when using svn:keywords in comment

Ranco Marcus ranco.marcus at epirion.nl
Thu Jun 18 23:45:52 PDT 2009


Thanks Ter, however escaping does not work for @lexer::header (see
grammar below). 

An error message is shown (in ANTLRWorks 1.2.3), but the parser and
lexer are generated correctly.


[begin file]

// $Id$   escape not needed

grammar test;

@header
{
// \$Id\$   escape needed, and working
}

@lexer::header
{
// \$Id\$   escape needed, but not working (throws 'reference to
attribute outside of a rule: Id')
}

// some dummy rules (if no lexer rules are present, the error above is
not shown)

main
	:  EOF
	;
	
PLUS
	: '+'
	;

[end file]



-----Original Message-----
From: Terence Parr [mailto:parrt at cs.usfca.edu] 
Sent: Thursday, June 18, 2009 8:35 PM
To: Ranco Marcus
Cc: antlr-interest at antlr.org
Subject: Re: [antlr-interest] error when using svn:keywords in comment

Try \$
Ter
On Jun 18, 2009, at 5:49 AM, Ranco Marcus wrote:

> Hi guys,
>
> Specifying an svn:keyword like $Id$ in a comment line results in an  
> error message "reference to attribute outside of a rule: Id". It  
> seems as if ANTLR does not treat the comment as ordinary plain text.  
> Can anybody confirm that this is a bug? Is there a workaround for  
> this?
>
> @header
> {
> //  ... header info ...
> // $Id$
> //
> }
>
> Best regards,
>
> Ranco Marcus
> Epirion Knowledge Solutions B.V.
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address



More information about the antlr-interest mailing list