commit 7917fde527c7b7cf0f11bc5576a9d9df10ad003d
parent ce32a0c6a622770bd1454069aef9abe95efcbd16
Author: Sebastian <sebastian@sebsite.pw>
Date: Fri, 8 Sep 2023 00:22:59 -0400
syntax: disallow leading 0 in number constants
Signed-off-by: Sebastian <sebastian@sebsite.pw>
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/syntax/hare.vim b/syntax/hare.vim
@@ -2,7 +2,7 @@
" Vim syntax file
" Language: Hare
" Maintainer: Amelia Clarke <me@rsaihe.dev>
-" Last Change: 2022-09-28
+" Last Change: 2023-09-07
if exists("b:current_syntax")
finish
@@ -55,14 +55,14 @@ syn keyword hareBoolean true false
syn keyword hareNull null
" Number literals.
-syn match hareNumber "\v(\.@1<!|\.\.)\zs<\d+([Ee][+-]?\d+)?(z|[iu](8|16|32|64)?)?>" display
+syn match hareNumber "\v(\.@1<!|\.\.)\zs<(0|[1-9]\d*)([Ee][+-]?\d+)?(z|[iu](8|16|32|64)?)?>" display
syn match hareNumber "\v(\.@1<!|\.\.)\zs<0b[01]+(z|[iu](8|16|32|64)?)?>" display
syn match hareNumber "\v(\.@1<!|\.\.)\zs<0o\o+(z|[iu](8|16|32|64)?)?>" display
syn match hareNumber "\v(\.@1<!|\.\.)\zs<0x\x+(z|[iu](8|16|32|64)?)?>" display
" Floating-point number literals.
-syn match hareFloat "\v<\d+\.\d+([Ee][+-]?\d+)?(f32|f64)?>" display
-syn match hareFloat "\v<\d+([Ee][+-]?\d+)?(f32|f64)>" display
+syn match hareFloat "\v<(0|[1-9]\d*)\.\d+([Ee][+-]?\d+)?(f32|f64)?>" display
+syn match hareFloat "\v<(0|[1-9]\d*)([Ee][+-]?\d+)?(f32|f64)>" display
" String and rune literals.
syn match hareEscape "\\[\\'"0abfnrtv]" contained display