Hyphen in node value causes exception
hawkrives opened this issue · comments
Python version: 3.6.13
kdl-py: 0.1.5
I had to apply the patch from #2, as well.
// data.kdl
kdl.parse('''
s3-upload {
bucket "data-output"
}
''')
$ python3 -c 'import kdl; data = open("./data.kdl", "r").read(); print(kdl.parse(data));'
Traceback (most recent call last):
File "/Users/rives/Git/python-dl/venv/lib/python3.6/site-packages/tatsu/contexts.py", line 218, in parse
result = rule()
File "/Users/rives/Git/python-dl/venv/lib/python3.6/site-packages/tatsu/contexts.py", line 56, in wrapper
return self._call(ruleinfo)
File "/Users/rives/Git/python-dl/venv/lib/python3.6/site-packages/tatsu/contexts.py", line 519, in _call
result = self._recursive_call(ruleinfo)
File "/Users/rives/Git/python-dl/venv/lib/python3.6/site-packages/tatsu/contexts.py", line 548, in _recursive_call
return self._invoke_rule(ruleinfo, self.memokey)
File "/Users/rives/Git/python-dl/venv/lib/python3.6/site-packages/tatsu/contexts.py", line 595, in _invoke_rule
ruleinfo.impl(self)
File "/Users/rives/Git/python-dl/venv/lib/python3.6/site-packages/kdl/grammar.py", line 95, in _start_
self._check_eof()
File "/Users/rives/Git/python-dl/venv/lib/python3.6/site-packages/tatsu/contexts.py", line 664, in _check_eof
self._error('Expecting end of text', exclass=FailedExpectingEndOfText)
File "/Users/rives/Git/python-dl/venv/lib/python3.6/site-packages/tatsu/contexts.py", line 453, in _error
raise self._make_exception(item, exclass=exclass)
tatsu.exceptions.FailedExpectingEndOfText: (1:1) Expecting end of text :
s3-upload {
^
start
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/rives/Git/python-dl/venv/lib/python3.6/site-packages/kdl/parser.py", line 225, in parse
parser = Parser(document, preserve_property_order, symbols_as_strings, dlist)
File "/Users/rives/Git/python-dl/venv/lib/python3.6/site-packages/kdl/parser.py", line 140, in __init__
ast = model.parse(document)
File "/Users/rives/Git/python-dl/venv/lib/python3.6/site-packages/tatsu/contexts.py", line 226, in parse
raise self._furthest_exception
File "/Users/rives/Git/python-dl/venv/lib/python3.6/site-packages/tatsu/contexts.py", line 694, in _option
yield
File "/Users/rives/Git/python-dl/venv/lib/python3.6/site-packages/kdl/grammar.py", line 197, in _node_space_
self._escline_()
File "/Users/rives/Git/python-dl/venv/lib/python3.6/site-packages/tatsu/contexts.py", line 56, in wrapper
return self._call(ruleinfo)
File "/Users/rives/Git/python-dl/venv/lib/python3.6/site-packages/tatsu/contexts.py", line 519, in _call
result = self._recursive_call(ruleinfo)
File "/Users/rives/Git/python-dl/venv/lib/python3.6/site-packages/tatsu/contexts.py", line 548, in _recursive_call
return self._invoke_rule(ruleinfo, self.memokey)
File "/Users/rives/Git/python-dl/venv/lib/python3.6/site-packages/tatsu/contexts.py", line 586, in _invoke_rule
raise memo
File "/Users/rives/Git/python-dl/venv/lib/python3.6/site-packages/tatsu/contexts.py", line 694, in _option
yield
File "/Users/rives/Git/python-dl/venv/lib/python3.6/site-packages/kdl/grammar.py", line 197, in _node_space_
self._escline_()
File "/Users/rives/Git/python-dl/venv/lib/python3.6/site-packages/tatsu/contexts.py", line 56, in wrapper
return self._call(ruleinfo)
File "/Users/rives/Git/python-dl/venv/lib/python3.6/site-packages/tatsu/contexts.py", line 519, in _call
result = self._recursive_call(ruleinfo)
File "/Users/rives/Git/python-dl/venv/lib/python3.6/site-packages/tatsu/contexts.py", line 548, in _recursive_call
return self._invoke_rule(ruleinfo, self.memokey)
File "/Users/rives/Git/python-dl/venv/lib/python3.6/site-packages/tatsu/contexts.py", line 595, in _invoke_rule
ruleinfo.impl(self)
File "/Users/rives/Git/python-dl/venv/lib/python3.6/site-packages/kdl/grammar.py", line 471, in _escline_
self._token('\\')
File "/Users/rives/Git/python-dl/venv/lib/python3.6/site-packages/tatsu/contexts.py", line 632, in _token
self._error(token, exclass=FailedToken)
File "/Users/rives/Git/python-dl/venv/lib/python3.6/site-packages/tatsu/contexts.py", line 453, in _error
raise self._make_exception(item, exclass=exclass)
tatsu.exceptions.FailedToken: (2:24) expecting '\\' :
bucket "data-output"
^
escline
node_space
node
nodes
node_children
node
nodes
start
Please let me know if you need anything else!