summaryrefslogtreecommitdiff
path: root/examples/lua_parser.py
diff options
context:
space:
mode:
authorPaul McGuire <ptmcg@users.noreply.github.com>2020-05-31 11:51:17 -0500
committerPaul McGuire <ptmcg@users.noreply.github.com>2020-05-31 11:51:17 -0500
commit0561ff9599a3a0c2b8b00ca7be53b741bdabad6c (patch)
treec372e136d7261dd418b014b280d6112c8c0e9a60 /examples/lua_parser.py
parentbc08887e5473666f593318390ccd7d29027b1984 (diff)
downloadpyparsing-git-0561ff9599a3a0c2b8b00ca7be53b741bdabad6c.tar.gz
Fix up lua parser to parse scripts of zero-or-more statements
Diffstat (limited to 'examples/lua_parser.py')
-rw-r--r--examples/lua_parser.py7
1 files changed, 5 insertions, 2 deletions
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())