(WIP) Initial work on nimble_parsec generated lexer
Initial work on a nimble parsec based lexer. Tried to design for nice errors and to avoid back tracking on happy path.
@jparise I'm curious why those reserved words are reserved. What was the idea behind them?
@jparise I'm curious why those reserved words are reserved. What was the idea behind them?
This is borrowed from Apache Thrift. The idea is that Thrift IDL shouldn't contain words that would clash with an output language's keywords when code generated. There are two possible approaches:
- Prevent the IDL from ever containing languages' keywords (across a large set of supported languages).
- Let the IDL contain close to anything, and deal with reserved words on a per-generator basis. The generator would have to recognize its own reserved words and renamed them accordingly.
Apache Thrift generally does (1) (at least for C++'s reserved words), so we copied that behavior in our lexer for compatibility. In practice, we should only be concerned with Elixir's reserved words (which aren't much of a problem) and could take approach (2).
In this project, reserved word rejection was added in #295 by @thecodeboss.
Makes sense, it was a bit perplexing to see keywords for other languages in here.