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

Support quoting structs/tables in Janet lexer #1586

Merged
merged 3 commits into from
Oct 1, 2020

Conversation

pyrmont
Copy link
Contributor

@pyrmont pyrmont commented Sep 19, 2020

This fixes two errors in the Janet lexer:

  1. The rule in :root for closing parentheses, brackets and braces would cause an error if the symbol was unmatched as it would try to pop() from the bottom-most state. To fix this, the rule in :root should not pop() at all. Rather, there should be rules in the other states.

  2. Quoting and quasi-quoting works with structs (marked by {). This adds support for that.

@pyrmont pyrmont added the needs-review The PR needs to be reviewed label Sep 19, 2020
@pyrmont pyrmont self-assigned this Sep 19, 2020
Copy link
Member

@jneen jneen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much more robust code - rouge should definitely never crash even on "incorrect" input.

lib/rouge/lexers/janet.rb Outdated Show resolved Hide resolved
@pyrmont pyrmont merged commit ee713d3 into rouge-ruby:master Oct 1, 2020
@pyrmont pyrmont removed the needs-review The PR needs to be reviewed label Oct 1, 2020
@pyrmont pyrmont deleted the bugfix.janet-unmatched-parens branch October 1, 2020 04:13
mattt pushed a commit to NSHipster/rouge that referenced this pull request May 19, 2021
This commit makes a number of fixes to the Janet lexer. Specifically,
it:

- supports quoting structs/tables;
- fixes quoting of arrays and tables; and
- removes unnecessary backslashes in character classes.
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.

2 participants