chain one wrote:
Thanks Gavin.
Really appreciate your help.
The method you provided works!
However the size of the generated .C file could reach to 14M. If I change the language option to Java, the size of generated .Java file is only 123K.

On Wed, Jan 14, 2009 at 5:50 PM, Gavin Lambert <[email protected]> wrote:
At 20:58 14/01/2009, chain one wrote:
I am still working on this. Searching for solutions that could make the IDENT rule and FUNCTION_DECL work together.

Well, one thing you could try would be:

IDENT
 : ('FUNCTION') => FUNCTION_DECL { $type = FUNCTION_DECL; $channel = HIDDEN; }

 | ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*
 ;
This tends to suggest that the rest of your lexer is where the problems lie and it is taking considerable effort on behalf of the lexer/analysis to work out your rules. However, without seeing the rest of your lexer, I would suggest that this is better, as it avoids any predicates.

IDENT
  : ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*
    {
       if ($text.equals("FUNCTION") { $type = FUNCTION_DECL; }
    }
  ;

JIm

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

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