Skip to content

Commit 2b16d11

Browse files
committed
fix for Ruby 1.8, escape { and } in regexps
1 parent 3dd6140 commit 2b16d11

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/coderay/scanners/lua.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ class CodeRay::Scanners::Lua < CodeRay::Scanners::Scanner
4040
]
4141

4242
# Automatic token kind selection for normal words.
43-
IDENT_KIND = CodeRay::WordList.new(:ident)
44-
.add(KEYWORDS, :keyword)
45-
.add(PREDEFINED_CONSTANTS, :predefined_constant)
46-
.add(PREDEFINED_EXPRESSIONS, :predefined)
43+
IDENT_KIND = CodeRay::WordList.new(:ident).
44+
add(KEYWORDS, :keyword).
45+
add(PREDEFINED_CONSTANTS, :predefined_constant).
46+
add(PREDEFINED_EXPRESSIONS, :predefined)
4747

4848
protected
4949

@@ -99,13 +99,13 @@ def handle_state_initial
9999

100100
@encoder.text_token(match, kind)
101101

102-
elsif match = scan(/{/) # Opening table brace {
102+
elsif match = scan(/\{/) # Opening table brace {
103103
@encoder.begin_group(:table)
104104
@encoder.text_token(match, @brace_depth >= 1 ? :inline_delimiter : :delimiter)
105105
@brace_depth += 1
106106
@state = :table
107107

108-
elsif match = scan(/}/) # Closing table brace }
108+
elsif match = scan(/\}/) # Closing table brace }
109109
if @brace_depth == 1
110110
@brace_depth = 0
111111
@encoder.text_token(match, :delimiter)

0 commit comments

Comments
 (0)