Skip to content

Commit

Permalink
Fix lexing of brackets in Velocity lexer (#1605)
Browse files Browse the repository at this point in the history
The Velocity lexer includes a rule that incorrectly spells the `:push`
magic state as `:push!`. This causes an error when lexing brackets
(which match this rule). This commit fixes that mistake.
  • Loading branch information
domRowan authored Oct 20, 2020
1 parent d8ef971 commit 47c0718
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rouge/lexers/velocity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class Velocity < TemplateLexer
rule %r/0[xX][0-9a-fA-F]+[Ll]?/, Num::Hex
rule %r/\b[0-9]+\b/, Num::Integer
rule %r/(true|false|null)\b/, Keyword::Constant
rule %r/[(\[]/, Punctuation, :push!
rule %r/[(\[]/, Punctuation, :push
rule %r/[)\]}]/, Punctuation, :pop!
end
end
Expand Down
1 change: 1 addition & 0 deletions spec/visual/samples/velocity
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
</table>
#end
#set( $monkey.Say = ["Not", $my, "fault", 10, false, null] ) ## ArrayList
#set( $result = $foo($bar[$baz]) )
${mudSlinger}
${customer.Address}
${purchase.getTotal(true)}
Expand Down

0 comments on commit 47c0718

Please sign in to comment.