no-context / moo

Optimised tokenizer/lexer generator! 🐄 Uses /y for performance. Moo.
BSD 3-Clause "New" or "Revised" License
821 stars 65 forks source link

Json Lexer Benchmark upgrade. #39

Closed bd82 closed 7 years ago

bd82 commented 7 years ago
tjvr commented 7 years ago

I'm not keen on moving the JSON benchmark to a separate file.

bd82 commented 7 years ago

I will try keeping it in the same file. It is just a bit of a mess right now...

bd82 commented 7 years ago

Is Chevrotain tracking line numbers here?

Chevrotain always tracks line numbers, but in different ways. There are Three token types, some of which are class based and some are basic Object structures. The full position information (Line + column + offset -> start and end for all variants). Is either saved on the Token object, or computed on demand depending on the Token Type.

The computation is very efficient and actually saves previous computation results to avoid unneeded work on future position request (even on different tokens of the same input text!).