Home | History | Annotate | Download | only in tests
      1 grammar t013parser;
      2 options {
      3   language = Python;
      4 }
      5 
      6 @parser::init {
      7 self.identifiers = []
      8 self.reportedErrors = []
      9 }
     10 
     11 @parser::members {
     12 def foundIdentifier(self, name):
     13     self.identifiers.append(name)
     14 
     15 def emitErrorMessage(self, msg):
     16     self.reportedErrors.append(msg)
     17 }
     18 
     19 document:
     20         t=IDENTIFIER {self.foundIdentifier($t.text)}
     21         ;
     22 
     23 IDENTIFIER: ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*;
     24