Multiple Lexers from the same factory can't be interleaved
See original GitHub issuee.g.:
const factory = moo([['a', 'a'], ['b', 'b']])
const l1 = factory('ab')
const l2 = factory('ab')
l1.lex() // a
l2.lex() // b, should be a
Issue Analytics
- State:
- Created 7 years ago
- Comments:7
Top Results From Across the Web
Dr. J's Compiler and Translator Design Lecture Notes
It must know whether every two adjacent characters in the file belong together in the same token, or whether the second character must...
Read more >flex / bison : how can I switch two lexers on same input file
Flex buffers cannot easily be transferred from one scanner to another. Many details are private to the scanner and would need to be ......
Read more >Write your own lexer - Pygments
Using multiple lexers for the same input can be tricky. One of the easiest combination techniques is shown here: You can replace the...
Read more >An efficient postprocessor architecture for channel mismatch ...
A pipelined post-processor architecture is proposed in this paper for digital background calibration of time interleaved ADCs.
Read more >Code Composer Studio Development Tools v3.3
7.1.2 Multiple Versions of Code Composer Studio. ... In the Available Factory Boards pane, select a target board or simulator that represents your...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
My thoughts exactly! 😃
I think I’m gonna rename it
moo.compile
, to make clear that building a lexer this way is expensive (I don’t want users to be calling moo() every time they want to parse something).I said “cheap”, not “free” 😃
Agreed. It seems like since the fastest thing to do is use a single Lexer and keep resetting it, the API should probably reflect that. Perhaps add
reset(input)
(orinit
, I’m not sure what to call it), which would do essentially the same thing asrewind(0); feed(input)
but without the slicing/concatenation.