diff options
author | Kornelius Kalnbach <murphy@rubychan.de> | 2016-02-13 13:17:23 +0100 |
---|---|---|
committer | Kornelius Kalnbach <murphy@rubychan.de> | 2016-02-13 13:17:23 +0100 |
commit | c33f3f5c43064f7b468a59e086dc4a9a4f949ff7 (patch) | |
tree | 60c9172e5cfaa20f4ea89145f0e8c3dfc6164eee /lib/coderay/scanners/ruby.rb | |
parent | 415498eaf9417cf30656c4a745eef0409b214afc (diff) | |
download | coderay-c33f3f5c43064f7b468a59e086dc4a9a4f949ff7.tar.gz |
check for keys with escape sequences, too
Diffstat (limited to 'lib/coderay/scanners/ruby.rb')
-rw-r--r-- | lib/coderay/scanners/ruby.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/coderay/scanners/ruby.rb b/lib/coderay/scanners/ruby.rb index f7feb46..5b8de42 100644 --- a/lib/coderay/scanners/ruby.rb +++ b/lib/coderay/scanners/ruby.rb @@ -165,9 +165,10 @@ module Scanners elsif match = scan(/ ' (?:(?>[^'\\]*) ')? | " (?:(?>[^"\\\#]*) ")? /mx) if match.size == 1 - encoder.begin_group :string + kind = check(self.class::StringState.simple_key_pattern(match)) ? :key : :string + encoder.begin_group kind encoder.text_token match, :delimiter - state = self.class::StringState.new :string, match == '"', match # important for streaming + state = self.class::StringState.new kind, match == '"', match # important for streaming else kind = value_expected == true && scan(/:/) ? :key : :string encoder.begin_group kind |