Skip to content

Commit 4d0d8af

Browse files
committed
Only allow leading 0 in numbers for octal literals
This is more restrictive than what the reader actually allows. The following are all legal, and are evaluated as base-10: 090M 09e9 09.9 09/08 Only 090 and 090N literals are errors. It's bad form to be writing literal numbers with leading zeroes unless you mean it to be octal, so we won't condone their use.
1 parent b3367cc commit 4d0d8af

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

syntax/clojure.vim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ unlet! s:radix_chars s:radix
5656

5757
syntax match clojureSymbol "\v%([a-zA-Z!$&*_+=|<.>?-]|[^\x00-\x7F])+%(:?%([a-zA-Z0-9!#$%&*_+=|'<.>/?-]|[^\x00-\x7F]))*[#:]@<!"
5858

59-
syntax match clojureNumber "\v<[-+]?\d+%(\.\d*)?%(M|[eE][-+]?\d+)?>"
60-
syntax match clojureNumber "\v<[-+]?\d+N?>"
59+
syntax match clojureNumber "\v<[-+]?%(0\o*|[1-9]\d*|%(0|[1-9]\d*)\.\d*)%(M|[eE][-+]?\d+)?>"
60+
syntax match clojureNumber "\v<[-+]?%(0\o*|[1-9]\d*)N>"
6161
syntax match clojureNumber "\v<[-+]?0x\x+>"
62-
syntax match clojureNumber "\v<[-+]?\d+/\d+>"
62+
syntax match clojureNumber "\v<[-+]?%(0|[1-9]\d*)/%(0|[1-9]\d*)>"
6363

6464
syntax match clojureVarArg "&"
6565

0 commit comments

Comments
 (0)