summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNathan Youngman <git@nathany.com>2013-06-23 12:35:26 -0600
committerNathan Youngman <git@nathany.com>2013-06-23 12:35:26 -0600
commitcad9a00e28d61781d5a12a0556be7126eb790725 (patch)
tree33ae5517037c6095aade2cdd836333f1cbecb9cf /lib
parent85275cf21e7d15459abc11fd76606bd7d38fb8b5 (diff)
downloadcoderay-cad9a00e28d61781d5a12a0556be7126eb790725.tar.gz
add imaginary numbers to Go scanner
Diffstat (limited to 'lib')
-rw-r--r--lib/coderay/scanners/go.rb14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/coderay/scanners/go.rb b/lib/coderay/scanners/go.rb
index afcfca5..04504ab 100644
--- a/lib/coderay/scanners/go.rb
+++ b/lib/coderay/scanners/go.rb
@@ -128,7 +128,11 @@ module Scanners
elsif match = scan(/\$/)
encoder.text_token match, :ident
-
+
+ elsif match = scan(/\d*(\.\d*)?([eE][+-]?\d+)?i/)
+ label_expected = false
+ encoder.text_token match, :imaginary
+
elsif match = scan(/0[xX][0-9A-Fa-f]+/)
label_expected = false
encoder.text_token match, :hex
@@ -137,13 +141,13 @@ module Scanners
label_expected = false
encoder.text_token match, :octal
- elsif match = scan(/(?:\d+)(?![.eEfF])L?L?/)
- label_expected = false
- encoder.text_token match, :integer
-
elsif match = scan(/\d|\d*\.\d+(?:[eE][+-]?\d+)?|\d+[eE][+-]?\d+/)
label_expected = false
encoder.text_token match, :float
+
+ elsif match = scan(/(?:\d+)(?![.eEfF])L?L?/)
+ label_expected = false
+ encoder.text_token match, :integer
else
encoder.text_token getch, :error