Permalink
Browse files

update test grammar. A bug in antlr3.0.1 python template was producin…

…g bad code.
  • Loading branch information...
1 parent 5c30317 commit 7996c83a5e3ba3a1748f469216f81a04c2680593 @dkm committed Apr 27, 2010
Showing with 15 additions and 15 deletions.
  1. +2 −0 build-parser.sh
  2. +11 −14 grammar/OpenAir.g
  3. +2 −1 test-parser.py
View
@@ -0,0 +1,2 @@
+mkdir -p python/generated
+cd grammar && antlr3 -o ../python/generated/ OpenAir.g && cd -
View
@@ -1,7 +1,7 @@
grammar OpenAir;
options {
- language=Python;
+ language=Python;
}
tokens {
@@ -34,22 +34,19 @@ tokens {
}
-file
- : zone NEWLINE EOF
- ;
zone
- : INCLUDE WS* EQ WS* (YES|NO) WS*
+ : include title EOF
;
-NEWLINE
- : '\r'? '\n'
- ;
+title : (TITLE EQ YES EOL)
+ ;
-WS
- : (' '|'\t'|'\n'|'\r')+ {skip();}
- ;
+include : (INCLUDE EQ YES EOL)
+ ;
+
+
+EOL : '\r'? '\n';
+
+WS : (' ' |'\t' )+ {$channel = HIDDEN;} ;
-ZONE_TITLE
- : ('a'..'z'|'A'..'Z'|'0'..'9'|'.'|' ')+'\r'? '\n'
- ;
View
@@ -20,4 +20,5 @@
lexer = OpenAirLexer(char_stream)
tokens = antlr3.CommonTokenStream(lexer)
parser = OpenAirParser(tokens)
-parser.file()
+parser.zone()
+##parser.file()

0 comments on commit 7996c83

Please sign in to comment.