我的 EBNF 和 Tatsu 实现中存在问题,为 Tatsu 提取语法 EBNF:
define ='#define' constantename [constante] ;
constante = CONSTANTE ;
CONSTANTE = ( Any | ``true`` ) ;
Any = /.*/ ;
constantename = (/[A-Z0-9_()]*/) ;
当我测试时:
#define _TEST01_ "test01"
#define _TEST_
#define _TEST02_ "test02"
我得到:
[
"#define",
"_TEST01_",
"\"test01\""
],
[
"#define",
"_TEST_",
"#define _TEST02_ \"test02\""
]
但我想要这个:
[
"#define",
"_TEST01_",
"\"test01\""
],
[
"#define",
"_TEST_",
"true"
],
[
"#define",
"_TEST02_",
"\"test02\""
]
我的错误在哪里?
非常感谢...