新行的grako ebnf标记;输入空格

2024-04-30 05:36:20 发布

您现在位置:Python中文网/ 问答频道 /正文

试图用grako来解析一个解析器 有点像

tag1: line1
line 2 ... 
tag2: line1 
line2
... 

这样就可以忽略tag1之前的空白;但标记应该从新行开始。在

小ebnf(x.ebnf)

^{pr2}$

输入(测试):

  x: First
y: liney
liney2 x: is not x

开始:

python3 xparser.py -t test START

错误:

grako.exceptions.FailedParse: test.event(1:1) no available options :
  x: First

^
PIECE
DATA
START

问题: 为什么? 我放^\s*x,为什么不匹配?在

谢谢你的任何提示!在


Tags: 标记test解析器linegrakostart空白first