From 0561ff9599a3a0c2b8b00ca7be53b741bdabad6c Mon Sep 17 00:00:00 2001 From: Paul McGuire Date: Sun, 31 May 2020 11:51:17 -0500 Subject: Fix up lua parser to parse scripts of zero-or-more statements --- examples/lua_parser.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'examples/lua_parser.py') diff --git a/examples/lua_parser.py b/examples/lua_parser.py index 8348a22..880d163 100644 --- a/examples/lua_parser.py +++ b/examples/lua_parser.py @@ -232,10 +232,13 @@ stat <<= pp.Group( | for_seq_stat | func_call_stat | if_stat + | function_def ) +lua_script = stat[...] + # ignore comments -function_def.ignore(lua_comment) +lua_script.ignore(lua_comment) if __name__ == "__main__": @@ -250,7 +253,7 @@ if __name__ == "__main__": """ try: - result = function_def.parseString(sample) + result = lua_script.parseString(sample) result.pprint() except pp.ParseException as pe: print(pe.explain()) -- cgit v1.2.1