不支持的操作:无法解析引用
Unsupported operation: References cannot be parsed
static const String tabChar = '\u0009';
Parser tab() => ref(token, tabChar);
expect(tab().accept(tabChar), isTrue);
使用 https://github.com/petitparser/dart-petitparser/blob/ddd9921d702dd18cda4e2f84190777b7dc20b3e2/example/dart/src/grammar.dart 中的 token
方法(使用默认的 trim
解析器)
需要更改什么才能消除错误?
Unsupported operation: References cannot be parsed
您的解析器图中存在未解析的引用,您需要先解析它们,然后才能解析输入。
您的示例代码缺乏上下文来准确说明问题所在。如果您继承 GrammarDefinition
并在定义上调用 build()
,则生成的解析器会解析所有引用。查看 GrammarDefinition and check out how the DartGrammarDefinition
is used from its tests.
中的文档
static const String tabChar = '\u0009';
Parser tab() => ref(token, tabChar);
expect(tab().accept(tabChar), isTrue);
使用 https://github.com/petitparser/dart-petitparser/blob/ddd9921d702dd18cda4e2f84190777b7dc20b3e2/example/dart/src/grammar.dart 中的 token
方法(使用默认的 trim
解析器)
需要更改什么才能消除错误?
Unsupported operation: References cannot be parsed
您的解析器图中存在未解析的引用,您需要先解析它们,然后才能解析输入。
您的示例代码缺乏上下文来准确说明问题所在。如果您继承 GrammarDefinition
并在定义上调用 build()
,则生成的解析器会解析所有引用。查看 GrammarDefinition and check out how the DartGrammarDefinition
is used from its tests.