From 47c071844188863dfa7d050958f4d406102c31f6 Mon Sep 17 00:00:00 2001 From: domRowan Date: Tue, 20 Oct 2020 12:46:32 +0100 Subject: [PATCH] Fix lexing of brackets in Velocity lexer (#1605) 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. --- lib/rouge/lexers/velocity.rb | 2 +- spec/visual/samples/velocity | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/rouge/lexers/velocity.rb b/lib/rouge/lexers/velocity.rb index 2ba0ee1a38..4aa23ad44c 100644 --- a/lib/rouge/lexers/velocity.rb +++ b/lib/rouge/lexers/velocity.rb @@ -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 diff --git a/spec/visual/samples/velocity b/spec/visual/samples/velocity index 644a677ddf..698dad3f53 100644 --- a/spec/visual/samples/velocity +++ b/spec/visual/samples/velocity @@ -20,6 +20,7 @@ #end #set( $monkey.Say = ["Not", $my, "fault", 10, false, null] ) ## ArrayList +#set( $result = $foo($bar[$baz]) ) ${mudSlinger} ${customer.Address} ${purchase.getTotal(true)}