Hello all,

I'm having several some problems with import and I'm hoping y'all can help me 
understand the problems. I'll list them in separate e-mails as I fully qualify 
the problems.

Basically, I have 15 or so related files that I need to parse. They all should 
use the same lexer rules, so I started out trying to put all the lexer rules 
into a single file that all the root grammars would import.  But that didn't 
work. I'm using Antlr 3.1.1 (AntlrWorks 1.2) and when I compile, I'm using 
VC2008 (but my current problem happens even using the AntlrWorks interpreter).

Here is my first problem... I can't seem to put all my lexer rules in a 
separate file because when I put the WS definition in a separate file, I get 
errors.  Take these overly simple sample files that demonstrate one of my 
issues:

//// test.g Starts here
grammar test;
import testlexer;
version_info : VERSION VERSION_IDENTIFIER SEMICOLON ;
//// test.g Ends here

//// testlexer.g starts here
lexer grammar testlexer;
VERSION : 'Version';
VERSION_IDENTIFIER : ('0'..'9')+ '.' ('0'..'9')+ ;
SEMICOLON : ';';
WS  : (' '|'\t' | '\r' | '\n')+ {$channel=HIDDEN;};
//// testlexer.g ends here

//// input starts here
Version 1.0;
//// input ends here

When I run it on a simple file it blows up after the version keyword... it's 
like it doesn't send the WS to the hidden channel.

If I move the WS declaration into test.g, it works fine.

Am I missing something with how imports work? Shouldn't I be able to put the WS 
declaration in the common lexer file?

(I apologize if this goes through twice, I sent it yesterday and still haven't 
seen it come through...)

Thanks,
-JEEP
Joe Peterson




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


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to