summaryrefslogtreecommitdiff
path: root/lib/coderay/scanners/c.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/coderay/scanners/c.rb')
-rw-r--r--lib/coderay/scanners/c.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/coderay/scanners/c.rb b/lib/coderay/scanners/c.rb
index 5764254..ae7ef83 100644
--- a/lib/coderay/scanners/c.rb
+++ b/lib/coderay/scanners/c.rb
@@ -42,7 +42,9 @@ module CodeRay module Scanners
kind = :error
match = nil
- if state == :initial
+ case state
+
+ when :initial
if scan(/ \s+ | \\\n /x)
kind = :space
@@ -96,7 +98,7 @@ module CodeRay module Scanners
getch
end
- elsif state == :string
+ when :string
if scan(/[^\\"]+/)
kind = :content
elsif scan(/"/)
@@ -113,7 +115,7 @@ module CodeRay module Scanners
raise_inspect "else case \" reached; %p not handled." % peek(1), tokens
end
- elsif state == :include_expected
+ when :include_expected
if scan(/<[^>\n]+>?|"[^"\n\\]*(?:\\.[^"\n\\]*)*"?/)
kind = :include
state = :initial
@@ -128,7 +130,7 @@ module CodeRay module Scanners
end
else
- raise_inspect 'else-case reached', tokens
+ raise_inspect 'Unknown state', tokens
end