diff options
author | Kornelius Kalnbach <murphy@rubychan.de> | 2016-02-13 17:05:38 +0100 |
---|---|---|
committer | Kornelius Kalnbach <murphy@rubychan.de> | 2016-02-13 17:05:38 +0100 |
commit | 0b19ccfa96e1c7e4999e6e2619ae0b266b54402a (patch) | |
tree | 974590b0902ca01731a90d8c9dcc25c34e2b3ff8 /lib/coderay/scanners/ruby | |
parent | e93cdf6cc6b8fb9179fa82a1f9bad77eae1e9830 (diff) | |
parent | 0ad3ddc26da51b3bdd0454859f894761a0155c1b (diff) | |
download | coderay-0b19ccfa96e1c7e4999e6e2619ae0b266b54402a.tar.gz |
Merge branch 'master' into possible-speedups
Diffstat (limited to 'lib/coderay/scanners/ruby')
-rw-r--r-- | lib/coderay/scanners/ruby/patterns.rb | 2 | ||||
-rw-r--r-- | lib/coderay/scanners/ruby/string_state.rb | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/coderay/scanners/ruby/patterns.rb b/lib/coderay/scanners/ruby/patterns.rb index 0b36e13..e5a156d 100644 --- a/lib/coderay/scanners/ruby/patterns.rb +++ b/lib/coderay/scanners/ruby/patterns.rb @@ -114,7 +114,7 @@ module Scanners # NOTE: This is not completely correct, but # nobody needs heredoc delimiters ending with \n. HEREDOC_OPEN = / - << (-)? # $1 = float + << ([-~])? # $1 = float (?: ( [A-Za-z_0-9]+ ) # $2 = delim | diff --git a/lib/coderay/scanners/ruby/string_state.rb b/lib/coderay/scanners/ruby/string_state.rb index 28ddd6c..95f1e83 100644 --- a/lib/coderay/scanners/ruby/string_state.rb +++ b/lib/coderay/scanners/ruby/string_state.rb @@ -37,6 +37,14 @@ module Scanners end end + def self.simple_key_pattern delim + if delim == "'" + / (?> (?: [^\\']+ | \\. )* ) ' : /mx + else + / (?> (?: [^\\"\#]+ | \\. | \#\$[\\"] | \#\{[^\{\}]+\} | \#(?!\{) )* ) " : /mx + end + end + def initialize kind, interpreted, delim, heredoc = false if heredoc pattern = heredoc_pattern delim, interpreted, heredoc == :indented |