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

Fix unbalanced parenthesis crash in Common Lisp lexer #1129

Merged
merged 1 commit into from
May 27, 2019

Conversation

pyrmont
Copy link
Contributor

@pyrmont pyrmont commented May 27, 2019

The Common Lisp lexer attempted to guard against an unmatched closing parenthesis being used by checking whether the stack of states was empty.

This misunderstood the way the stack is used. The stack should always have at least one state (the bottom-most :root state). Popping this state will cause an empty stack error to be thrown (as noted in #1102).

The correct guard is to check whether the size of the stack is 1. If it is, then we have an unmatched closing parenthesis and should generate an error token. This fixes #1102.

The Common Lisp lexer attempted to guard against an unmatched closing
parenthesis being used by checking whether the stack of states was
empty.

This misunderstood the way the stack is used. The stack should always
have at least one state (the bottom-most :root state). Popping this
state will cause an empty stack error to be thrown (as noted in rouge-ruby#1102).

The correct guard is to check whether the size of the stack is 1. If it
is, then we have an unmatched closing parenthesis and should generate an
error token. This fixes rouge-ruby#1102.
@pyrmont pyrmont merged commit 641cd1d into rouge-ruby:master May 27, 2019
@pyrmont pyrmont deleted the bugfix.common-lisp-crash branch January 8, 2020 20:05
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