8000 be a bit more graceful with buggy Go strings · tricknotes/coderay@6dd14ef · GitHub
[go: up one dir, main page]

Skip to content

Commit 6dd14ef

Browse files
committed
be a bit more graceful with buggy Go strings
1 parent bbe4d72 commit 6dd14ef

File tree

1 file changed

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

1 file changed

+3
-2
lines changed

lib/coderay/scanners/go.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,10 @@ def scan_tokens encoder, options
165165
label_expected = false
166166
elsif match = scan(/ \\ (?: #{ESCAPE} | #{UNICODE_ESCAPE} ) /mox)
167167
encoder.text_token match, :char
168-
elsif match = scan(/ \\ | $ /x)
168+
elsif match = scan(/ \\ /x)
169+
encoder.text_token match, :error
170+
elsif match = scan(/$/)
169171
encoder.end_group :string
170-
encoder.text_token match, :error unless match.empty?
171172
state = :initial
172173
label_expected = false
173174
else

0 commit comments

Comments
 (0)
0