Skip to content

Commit

Permalink
fix(syntax): add missing keywords, change the order, update names, fi…
Browse files Browse the repository at this point in the history
…x comments & operators
  • Loading branch information
adamperkowski committed Dec 22, 2024
1 parent c9ebaf7 commit 4f4daa1
Showing 1 changed file with 20 additions and 22 deletions.
42 changes: 20 additions & 22 deletions syntax/jule.vim
Original file line number Diff line number Diff line change
Expand Up @@ -8,59 +8,57 @@ if exists("b:current_syntax")
finish
endif

syntax keyword juleKeyword map error use fn pub struct byte rune enum unsafe
syntax keyword juleKeyword const let static mut self match defer if else for in
syntax keyword juleKeyword impl trait break continue goto cpp
syntax keyword juleKeyword i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 str
syntax match juleDirective "#\p\+\>"

syntax keyword juleStorage let static const mut pub self
syntax keyword juleKeyword chan map error use fn pub struct byte rune enum unsafe
syntax keyword juleKeyword const let static match defer if else for in impl trait
syntax keyword juleKeyword break continue goto cpp i8 i16 i32 i64 u8 u16 u32 u64
syntax keyword juleKeyword f32 f64 str int uint type any bool ret fall unitptr co
syntax keyword juleKeyword let

syntax keyword juleStorage static const mut pub self
syntax keyword juleConstant true false nil

syntax match juleFunction "\<\k\+\ze("

syntax match juleNumber "\<\d\+\(_\?\d\+\)*\>"
syntax match juleFloat "\<\d\+\(_\?\d\+\)*\.\d\+\([eE][-+]\?\d\+\)\?"
syntax match juleBinary "\<0b[01]\+\(_\?[01]\+\)*\>"
syntax match juleOctal "\<0o[0-7]\+\(_\?[0-7]\+\)*\>"
syntax match juleHex "\<0x[0-9a-fA-F]\+\(_\?[0-9a-fA-F]\+\)*\>"

syntax region juleString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=juleEscape
syntax region juleRawString start=+`+ end=+`+
syntax region juleChar start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=juleEscape
syntax region juleStringS start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=juleEscape
syntax region juleStringD start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=juleEscape
syntax region juleStringRaw start=+`+ end=+`+
syntax match juleEscape display contained "\\[abfnrtv'\"\\]"

syntax region juleLineComment start="//" end="$" contains=@Spell
syntax region juleComment start="/\*" end="\*/" contains=@Spell
syntax region juleDocComment start="/\*" end="\*/" contains=@Spell
syntax match juleLineComment "//.*$" contains=@Spell

syntax match juleDirective "#\p\+\>"

syntax match juleFunction "\<\k\+\ze("

syntax match juleOperator "\(+\|-\|*\|/\|%\|++\|--\|>>\|<<\)"
syntax match juleOperator "\(+\|-\|*\|/\|%\|++\|--\|>>\|<<\)" contains=juleLineComment,juleComment
syntax match juleOperator "\(==\|!=\|>\|<\|>=\|<=\)"
syntax match juleOperator "\(=\|+=\|-=\|*=\|/=\|%=\|&=\||=\|\^=\|>>=\|<<=\)"
syntax match juleOperator "\(&\||\|\^\)"
syntax match juleOperator "\(&&\|||\|!\)"

syntax match juleDelimiter "[.,;:]"

highlight default link juleDirective PreProc
highlight default link juleKeyword Keyword
highlight default link juleStorage StorageClass
highlight default link juleConstant Constant
highlight default link juleFunction Function
highlight default link juleNumber Number
highlight default link juleFloat Float
highlight default link juleBinary Number
highlight default link juleOctal Number
highlight default link juleHex Number
highlight default link juleString String
highlight default link juleRawString String
highlight default link juleChar Character
highlight default link juleStringS String
highlight default link juleStringD String
highlight default link juleStringRaw String
highlight default link juleEscape SpecialChar
highlight default link juleComment Comment
highlight default link juleDocComment Comment
highlight default link juleLineComment Comment
highlight default link juleDirective PreProc
highlight default link juleFunction Function
highlight default link juleComment Comment
highlight default link juleOperator Operator
highlight default link juleDelimiter Delimiter

Expand Down

0 comments on commit 4f4daa1

Please sign in to comment.