Skip to content

Commit 82864ef

Browse files
committed
allow unicode characters in char literals
1 parent 6dd14ef commit 82864ef

File tree

1 file changed

+2
-2
lines changed
  • lib/coderay/scanners

1 file changed

+2
-2
lines changed

lib/coderay/scanners/go.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Go < Scanner
4444
add(PREDEFINED_FUNCTIONS, :predefined) # :nodoc:
4545

4646
ESCAPE = / [rbfntv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x # :nodoc:
47-
UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x # :nodoc:
47+
UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x # :nodoc:
4848

4949
protected
5050

@@ -123,7 +123,7 @@ def scan_tokens encoder, options
123123
label_expected_before_preproc_line = label_expected
124124
state = :include_expected if self[1] == 'include'
125125

126-
elsif match = scan(/ L?' (?: [^\'\n\\] | \\ #{ESCAPE} )? '? /ox)
126+
elsif match = scan(/ L?' (?: [^\'\n\\] | \\ (?: #{ESCAPE} | #{UNICODE_ESCAPE} ) )? '? /ox)
127127
label_expected = false
128128
encoder.text_token match, :char
129129

0 commit comments

Comments
 (0)