summaryrefslogtreecommitdiff
path: root/examples/antlr_grammar_tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/antlr_grammar_tests.py')
-rw-r--r--examples/antlr_grammar_tests.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/examples/antlr_grammar_tests.py b/examples/antlr_grammar_tests.py
index 1df28f9..57d6cb6 100644
--- a/examples/antlr_grammar_tests.py
+++ b/examples/antlr_grammar_tests.py
@@ -80,7 +80,11 @@ fragment DIGIT : '0'..'9' ;"""
pyparsingRules = antlr_grammar.antlrConverter(antlrGrammarTree)
pyparsingRule = pyparsingRules["expr"]
pyparsingTree = pyparsingRule.parseString("2 - 5 * 42 + 7 / 25")
- self.assertNotEqual(None, pyparsingTree)
+ pyparsingTreeList = pyparsingTree.asList()
+ print(pyparsingTreeList)
+ self.assertEqual(pyparsingTreeList,
+ [[[['2'], []], [['-', [['5'], [['*', ['4', '2']]]]], ['+', [['7'], [['/', ['2', '5']]]]]]]]
+ )
if __name__ == "__main__":
#import sys;sys.argv = ['', 'Test.testOptionsSpec']