Skip to content

Commit 4669b70

Browse files
committed
fix label_expected (test case?)
1 parent a24c207 commit 4669b70

File tree

1 file changed

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

1 file changed

+2
-1
lines changed

lib/coderay/scanners/go.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def scan_tokens encoder, options
6464
if match = scan(/ \s+ | \\\n /x)
6565
if in_preproc_line && match != "\\\n" && match.index(?\n)
6666
in_preproc_line = false
67+
case_expected = false
6768
label_expected = label_expected_before_preproc_line
6869
end
6970
encoder.text_token match, :space
@@ -72,7 +73,6 @@ def scan_tokens encoder, options
7273
encoder.text_token match, :comment
7374

7475
elsif match = scan(/ [-+*=<>?:;,!&^|()\[\]{}~%]+ | \/=? | \.(?!\d) /x)
75-
label_expected = match =~ /[;\{\}]/
7676
if case_expected
7777
label_expected = true if match == ':'
7878
case_expected = false
@@ -83,6 +83,7 @@ def scan_tokens encoder, options
8383
kind = IDENT_KIND[match]
8484
if kind == :ident && label_expected && !in_preproc_line && scan(/:(?!:)/)
8585
kind = :label
86+
label_expected = false
8687
match << matched
8788
else
8889
label_expected = false

0 commit comments

Comments
 (0)