update editor syntax definitions
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Sun, 20 Sep 2020 02:08:36 +0000 (21:08 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Sun, 20 Sep 2020 02:08:36 +0000 (21:08 -0500)
misc/onyx.sublime-syntax
misc/onyx.vim

index c9b92b1ba467458f04f51203dd117828f5cfc0d0..e399078c694bb1512091d44732d2ee91aa59ad91 100644 (file)
@@ -29,11 +29,11 @@ contexts:
     - match: '\b(package|struct|proc|use|global|enum|if|elseif|else|for|while|do|break|continue|fallthrough|return|as|cast|sizeof|alignof|defer|switch|case)\b'
       scope: keyword.control.onyx
 
-    - match: '\b(bool|void|i8|u8|i16|u16|i32|u32|i64|u64|f32|f64|rawptr)\b'
-      scope: keyword.control.onyx
+    - match: '\b(bool|void|i8|u8|i16|u16|i32|u32|i64|u64|f32|f64|rawptr|string|cstring|range)\b'
+      scope: storage.type
 
     - match: '\b(i8x16|i16x8|i32x4|i64x2|f32x4|f64x2|v128)\b'
-      scope: keyword.control.onyx
+      scope: storage.type
 
     - match: '\b(true|false|null|context)\b'
       scope: constant.numeric.onyx
index 1b707670e21d35d565aa256d3831adb2e7ad7b81..c0243d55f627d8f0323ec09c601a5412b1677259 100644 (file)
@@ -14,9 +14,7 @@ syn keyword onyxKeyword package struct enum proc use global
 syn keyword onyxKeyword if elseif else
 syn keyword onyxKeyword for while do
 syn keyword onyxKeyword switch case
-syn keyword onyxKeyword break continue return defer fallthrough
-syn keyword onyxKeyword as cast sizeof alignof
-
+syn keyword onyxKeyword break continue return defer fallthrough syn keyword onyxKeyword as cast sizeof alignof
 syn keyword onyxType bool void
 syn keyword onyxType i8 u8
 syn keyword onyxType i16 u16
@@ -29,6 +27,11 @@ syn keyword onyxType i8x16 i16x8 i32x4 i64x2 f32x4 f64x2 v128
 
 syn keyword onyxConstant        true false null
 
+syn match onyxNumber            "\<0x[a-fA-F0-9]\+\>"
+syn match onyxNumber            "\<\d\+[lf]\=\>"
+syn match onyxNumber            "\<\d\+\.\d*f\=\>"
+syn match onyxNumber            "\.\d\+f\=\>"
+
 syn keyword onyxCommentStart    contained TODO NOTE BUG HACK
 
 syn region onyxComment          start="//" end="$" keepend contains=onyxCommentStart
@@ -45,6 +48,7 @@ hi def link onyxCommentStart     Todo
 hi def link onyxConstant         Constant
 hi def link onyxDirective        Constant
 hi def link onyxString           String
+hi def link onyxNumber           Number
 
 let b:current_syntax = "onyx"
 let &cpo = s:cpo_save