Skip to content

Commit

Permalink
improve golang performance
Browse files Browse the repository at this point in the history
by using a negative char class to match string literals in one pass.
  • Loading branch information
jneen committed Aug 27, 2013
1 parent bad76a0 commit 45aa7db
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/rouge/lexers/go.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,12 @@ def self.analyze_text(text)
rule(ESCAPE_SEQUENCE, "Literal.String.Escape")
rule(/\\./, "Error")
rule(/"/, "Literal.String", :pop!)
rule(/./, "Literal.String")
rule(/[^"\\]+/m, "Literal.String")
end

state :raw_string do
rule(/`/, "Literal.String", :pop!)
rule(/./m, "Literal.String")
rule(/[^`]+/m, "Literal.String")
end
end
end
Expand Down

0 comments on commit 45aa7db

Please sign in to comment.