Skip to content

Commit

Permalink
Improve highlighting of numbers
Browse files Browse the repository at this point in the history
It was erroneously highlighting "10." in "10..1" as a number.

It was also not highlighting numbers with multiple underscores in them,
like "1_000_000".
  • Loading branch information
hinrik committed Oct 7, 2015
1 parent c91c403 commit 155abad
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions perl6-font-lock.el
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,16 @@
(number
. ,(rx
(group-n 1
(opt (1+ digit) (opt "_" (1+ digit)))
(opt ".")
(1+ digit))
(or (and (1+ digit)
(0+ (and "_" (1+ digit)))
(opt "."
(1+ digit)
(0+ (and "_" (1+ digit)))))
(and "."
(1+ digit)
(0+ (and "_" (1+ digit))))))
(opt (group-n 2 (any "Ee"))
(group-n 3 (opt "-") (1+ digit) (opt "_" (1+ digit))))
(group-n 3 (opt "-") (1+ digit) (0+ "_" (1+ digit))))
(opt (group-n 4 "i"))))
(base-number
. ,(rx symbol-start
Expand Down Expand Up @@ -626,7 +631,7 @@ LIMIT can be used to bound the search."
(opt "::"))
0 'perl6-identifier)
;; numbers
(,(perl6-rx number)
(,(perl6-rx (or bol (regex "[^[:digit:]]")) number)
(1 'perl6-number)
(2 'perl6-number-addition nil t)
(3 'perl6-number nil t)
Expand Down

0 comments on commit 155abad

Please sign in to comment.