Skip to content
52 changes: 48 additions & 4 deletions editor/glint/glint/syntax/glint.vim
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ syn region glintRawString start="'" end="'" display

syn match glintSpecial contained "\\[nr\\\"\'t]" display
syn region glintString start="\"" skip="\\\"" end="\"" contains=glintSpecial
syn region glintByte start="`" skip="\\`" end="`" contains=glintSpecial

syn keyword glintFFITypes
\ cshort
\ cushort
\ csize
\ cusize
\ cint
\ cuint
\ clong
Expand All @@ -23,15 +26,20 @@ syn keyword glintFFITypes
\ void

syn keyword glintPrimitiveTypes
\ Bool
\ Boolean
\ Byte
\ byte
\ bool
\ boolean
\ int
\ uint
\ void

if exists("glint_use_uppercase_primitives")
syn keyword glintPrimitiveTypes
\ Bool
\ Boolean
\ Byte
endif

syn keyword glintDataTypes
\ struct
\ enum
Expand All @@ -43,9 +51,18 @@ syn keyword glintKeywords
\ return
\ sizeof
\ match
\ print
\ in
\ mapf
\ lambda
\ has
\ apply
\ typeof
\ template

syn keyword glintRepeat
\ for
\ cfor
\ while

syn keyword glintConditional
Expand All @@ -69,7 +86,26 @@ syn keyword glintFunctionAttributes

syn keyword glintTypeAttributes alignas

syn match glintOperators "?\|+\|-\|\*\|:\|,\|<\|>\|&\||\|!\|\~\|%\|=\|\.\|/\(/\|*\)\@!"
" syn match glintOperators "?\|+\|-\|\*\|:\|,\|<\|>\|&\||\|!\|\~\|%\|=\|\.\|/\(/\|*\)\@!"
syn match glintOperators "[/*+-\%~&|^<>]="
syn match glintOperators ":"
syn keyword glintOperators
\ @
\ !
\ +
\ -
\ *
\ /
\ &
\ =
\ <
\ >
\ bitand
\ bitor
\ bitxor
\ bitnot
\ ++
\ --

syn match glintNumber "\v<\d+>"

Expand All @@ -83,6 +119,10 @@ syn keyword glintSupplant supplant
" NOTE: Include semicolon at the end of line?
syn match glintModuleName "\<[a-zA-Z0-9_]*" contained skipwhite

syn keyword glintBooleans
\ true
\ false

hi def link glintFFITypes Type
hi def link glintPrimitiveTypes Type
hi def link glintKeywords Keyword
Expand All @@ -105,5 +145,9 @@ hi def link glintModuleName Function
hi def link glintBuiltinFunc Identifier
hi def link glintDataTypes Structure
hi def link glintSupplant StorageClass
hi def link glintBooleans Boolean
hi def link glintByte Character

let b:current_syntax = 'glint'

" vim:sw=2 ts=2: