[antlr-interest] Do lexer rules have scopes?

Matt Benson gudnabrsam at yahoo.com
Mon Feb 11 10:55:44 PST 2008


--- Gavin Lambert <antlr at mirality.co.nz> wrote:

> At 07:36 12/02/2008, Matt Benson wrote:
>  >
>  >When attempting to generate:
> [...]
>  >fragment
>  >DollarBrace
>  >scope {
>  >	int depth;
>  >}
>  >	:	'${' {$DollarBrace::depth++;}
>  >		(DollarBrace|.)*
>  >		'}' {$DollarBrace::depth--;}
>  >	;
>  >
>  >
>  >I get:
>  >
>  >[12:33:17] error(10):  internal error: /tmp/wip.g3
> :
>  >java.lang.NullPointerException
> 
>
>org.antlr.tool.DefineGrammarItemsWalker.ruleScopeSpec(DefineGrammar
>  >ItemsWalker.java:964)
> 
> I don't believe lexer rules support scopes, no.  You
> can use 
> member variables, though, as long as you're careful.
> 

Thanks, Gavin.  I was able to get this working using
input parameters.  :)

-Matt

> 



      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping


More information about the antlr-interest mailing list