Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Lexer has a readonly state #125

Merged
merged 1 commit into from
Apr 19, 2022
Merged

feat: Lexer has a readonly state #125

merged 1 commit into from
Apr 19, 2022

Conversation

simonseyock
Copy link
Member

This change was done to be able to introduce some backtracking features, which will be needed for more complicated key parsing of object types.

BREAKING CHANGE: the advance function of the lexer does not change the internal state of the object, but does instead return a new Lexer object. The getters token(), peek() and previous() have been replaced with readonly properties current, next, previous.

BREAKING CHANGE: the API of the Parser class has changed. It can't parse multiple expressions anymore, but needs to be instantiated for each expression. The expression is passed to the constructor. The current lexer can be accessed via the property lexer.

BREAKING CHANGE: the advance function of the lexer does not change the internal state of the object, but does instead return a new Lexer object. The getters `token()`, `peek()` and `previous()` have been replaced with readonly properties `current`, `next`, `previous`.

BREAKING CHANGE: the API of the Parser class has changed. It can't parse multiple expressions anymore, but needs to be instantiated for each expression. The expression is passed to the constructor. The current lexer can be accessed via the property `lexer`.
@simonseyock simonseyock merged commit 047b903 into main Apr 19, 2022
@simonseyock simonseyock deleted the lexer-readonly-state branch April 19, 2022 08:02
@jsdoc-type-pratt-parser-chores
Copy link
Contributor

🎉 This PR is included in version 3.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

None yet

2 participants