Hello all,
 
Writing a parser for some ugly grammar I came across a problem I do not know 
how to approach. Here is a sample grammar illustrating the problem: 
  
grammar test; 

program : (statement)*; 

statement 
   : RawData 
   | Identifier ';' 
   ; 

RawData: 'data;' ((options {greedy=false;} : .)* ';;')? ; 

Identifier : ('a'..'z')+; 

WhiteSpace : (' ' | '\t' | '\r\n' | '\r')+ { $channel=HIDDEN; }; 
 
The RawData can contain data ended with ‘;;’ or can be empty. Two sample valid 
inputs: 
data; some raw data here;; identifier; 
data; identifier; 
 
The parser does not correctly recognize the second input (mismatched character 
'<EOF>' expecting ';') .
Parser does not realize that what follows ‘data’ keyword is not followed by 
‘;;’ so it is not "raw data" and should be interpreted as Identifier. 

I am clueless. Could anyone help? 
 
Thomas


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