Closed Hywan closed 7 years ago
POC is working. Now I need to update all the parsers…
All parsers have been migrated, along with the 387 unit tests (calculating all span positions by hand was a very satisfying experience…)!
Next step: Update the documentation!
Work in Progress.
I would like to thank @fflorent for the original idea and code. The goal is to declare a
Span
structure that can be used as an input for nom parsers. EachSpan
collects the offset, line, and column numbers for each slices computed by parsers. Then, theToken
structure is used to attached a span to any “data”.It works. We are using
bytecount::count
to count the number of lines. And we are usingmemchr::memrchr
to count the number of columns. All counting are made relatively to the previous span, so we are not iterating over the whole input each time. The offset is computed based on thenom::Offset
features.We can compile tagua-parser as follows:
or:
to respectively enable SIMD or AVX optimisations.
bytecount
performance depends on these features.Next step: See how it feets with the AST.