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 backtracking issues, add string interpolation in Perl lexer #1161

Merged
merged 2 commits into from
Jun 9, 2019

Conversation

pyrmont
Copy link
Contributor

@pyrmont pyrmont commented Jun 9, 2019

The previous rules for strings used a regular expression that combined different elements of the string. This could, in a pathological case, cause Rouge to get stuck trying to lex the code. This problem can be fixed by lexing a quoted string in a separate state to :root.

In addition to adding states for quoted string, this commit also adds support for basic string interpolation. The basic logic is lifted from the Ruby lexer. This fixes #974.

The previous rules for strings used a regular expression that combined
different elements of the string. This could, in a pathological case,
cause Rouge to get stuck trying to lex the code. This problem can be
fixed by lexing a quoted string in a separate state to `:root`.

In addition to adding states for quoted string, this commit also adds
support for basic string interpolation. The basic code is lifted from
the Ruby lexer. This fixes rouge-ruby#974.
@pyrmont pyrmont added the needs-review The PR needs to be reviewed label Jun 9, 2019
@pyrmont
Copy link
Contributor Author

pyrmont commented Jun 9, 2019

As discussed in #981, this PR is intended to be accepted together with #1160.

@pyrmont pyrmont changed the title Fix backtracking issues, add string interpolation Fix backtracking issues, add string interpolation in Perl lexer Jun 9, 2019
lib/rouge/lexers/perl.rb Outdated Show resolved Hide resolved
@pyrmont pyrmont merged commit 6cad1b9 into rouge-ruby:master Jun 9, 2019
@pyrmont pyrmont removed the needs-review The PR needs to be reviewed label Jun 9, 2019
@pyrmont pyrmont deleted the bugfix.perl-quoted-strings 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.

None yet

3 participants