Skip to content

Commit

Permalink
Increase consistency of number-related regexes
Browse files Browse the repository at this point in the history
  • Loading branch information
sogaiu committed Jul 3, 2020
1 parent 4d73355 commit 5b22a41
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions lib/rouge/lexers/janet.rb
Expand Up @@ -135,19 +135,24 @@ def name_token(name)
rule %r/
[+-]?
\d+
r[0-9a-zA-Z][0-9a-zA-Z_]*
(&[+-]?[0-9a-zA-Z]+)?
r[0-9a-zA-Z]
[0-9a-zA-Z_]*
(&[+-]?
[0-9a-zA-Z]+)?
/x, Num::Float
# numbers via hex
# split into 2 rules for ease of expression / understanding
rule %r/
[+-]?
0x[0-9a-fA-F][_0-9a-fA-F]*
(\.[0-9a-fA-F][0-9a-fA-F_]*)?
0x[0-9a-fA-F]
[0-9a-fA-F_]*
(\.[0-9a-fA-F]
[0-9a-fA-F_]*)?
/x, Num::Hex
rule %r/
[+-]?
0x\.[0-9a-fA-F][_0-9a-fA-F]*
0x\.[0-9a-fA-F]
[0-9a-fA-F_]*
/x, Num::Hex
# decimal floating point
# split into 2 rules for ease of expression / understanding
Expand Down

0 comments on commit 5b22a41

Please sign in to comment.