Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 13ac063

Browse files
committed
Fix comments. Underscores in hex. Added binary.
1 parent 5124241 commit 13ac063

File tree

1 file changed

+7
-4
lines changed
  • lib/coderay/scanners

1 file changed

+7
-4
lines changed

lib/coderay/scanners/e.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ class E < Scanner
1313
file_extension 'e'
1414
title 'e'
1515

16-
# TODO: 0b0101
17-
# TODO: -- I am a comment
18-
# TODO: 0x0000_0FFF
1916
# TODO: DUT'unique_name
2017

2118
KEYWORDS = [
@@ -68,6 +65,8 @@ def scan_tokens encoder, options
6865

6966
elsif match = scan(%r! // [^\n\\]* (?: \\. [^\n\\]* )* | /\* (?: .*? \*/ | .* ) !mx)
7067
encoder.text_token match, :comment
68+
elsif match = scan(%r! -- [^\n\\]* (?: \\. [^\n\\]* )* !mx)
69+
encoder.text_token match, :comment
7170

7271
elsif match = scan(/ \# \s* if \s* 0 /x)
7372
match << scan_until(/ ^\# (?:elif|else|endif) .*? $ | \z /xm) unless eos?
@@ -121,14 +120,18 @@ def scan_tokens encoder, options
121120
label_expected = false
122121
encoder.text_token match, :char
123122

124-
elsif match = scan(/0[xX][0-9A-Fa-f]+/)
123+
elsif match = scan(/0[xX][0-9_A-Fa-f]+/)
125124
label_expected = false
126125
encoder.text_token match, :hex
127126

128127
elsif match = scan(/(?:0[0-7]+)(?![89.eEfF])/)
129128
label_expected = false
130129
encoder.text_token match, :octal
131130

131+
elsif match = scan(/0[b][0-9_]+/)
132+
label_expected = false
133+
encoder.text_token match, :binary
134+
132135
elsif match = scan(/(?:\d+)(?![.eEfF])L?L?/)
133136
label_expected = false
134137
encoder.text_token match, :integer

0 commit comments

Comments
 (0)