I am getting an exception attempting to parse the #
character using Tatsu:
import tatsu
grammar = r'''
@@comments :: //
@@eol_comments :: //
start = '#' ;
'''
print(tatsu.__version__)
parser = tatsu.compile(grammar)
ast = parser.parse('#', trace=True)
5.8.3
↙start ~1:1
#
≢'#'
≢start ~1:1
#
...
tatsu.exceptions.FailedToken: (1:1) expecting '#' :
#
^
start
If I change the #
to a
in both the grammar and the text then it is successful. I think the issue might be that #
indicates a grammar comment in Tatsu, but I'm not sure how to escape it.