继续这个 GitHub 问题:
我需要匹配 indent 或 dedent,我正在使用Earley。Earley 没有对缩进的内置支持,但我希望能够在我的语言中使用缩进而不是大括号。
示例输入:
func foo(a: A, b: B): C =
theresSomeIndentRequiredHere(a, b)
func noMoreIndentMeansNoMoreFoo: D = ???
这将被解析theresSomeIndentRequiredHere
为 的一部分foo
,但noMoreindentMeansNoMoreFoo
不会被解析为foo
.
我怎样才能在不损失大量速度的情况下做到这一点?