Skip to content

Conversation

ictrobot
Copy link

Currently Lexer.prototype.reset and Lexer.prototype.save reference three queued fields: queuedToken, queuedText (added in #169) and queuedThrow.

There only appear to be references to queuedText and queuedGroup elsewhere, so this MR removes queuedToken and
queuedThrow and adds queuedGroup to reset and save.

The below example shows how this could be problematic - on master it prints a token when it probably shouldn't:

const moo = require("./moo")

const lexer = moo.compile({
    number: {match: /\d+/},
    text: moo.fallback
})

lexer.reset('test123')
lexer.next()
lexer.reset()
console.log(lexer.next())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant