Performant way to lex INDENT and DEDENT to pass to Earley?

193 views Asked by At

Continuing from this GitHub issue:

I need to match on indent or dedent, and I'm using Earley. Earley has no built-in support for indentation, but I'd like to be able to use indentation instead of braces in my language.

Example input:

func foo(a: A, b: B): C =
  theresSomeIndentRequiredHere(a, b)

func noMoreIndentMeansNoMoreFoo: D = ???

This would parse theresSomeIndentRequiredHere as part of foo, but noMoreindentMeansNoMoreFoo would not get parsed as part of foo.

How can I do this without losing a ton of speed?

0

There are 0 answers