|
| 1 | +" Vim syntax file |
| 2 | +" Language: JSLT |
| 3 | +" Maintainer: João Abecasis <joao@abecasis.name> |
| 4 | +" URL: https://github.com/schibsted/jslt |
| 5 | +" Latest Revision: 12 October 2020 |
| 6 | + |
| 7 | +" quit when a syntax file was already loaded |
| 8 | +if exists("b:current_syntax") |
| 9 | + finish |
| 10 | +endif |
| 11 | + |
| 12 | +let s:cpo_save = &cpo |
| 13 | +set cpo&vim |
| 14 | + |
| 15 | +syn match jsltStringEscape +\\"\|\\\\+ contained |
| 16 | +syn region jsltString start=+"+ skip=+\\\"\|\\\\+ end=+"+ contains=jsltStringEscape |
| 17 | + |
| 18 | +syn match jsltNumber "\<-\?\%(0\|[1-9]\d*\)\%(\.\d\+\)\?\%([Ee][+-]\?\d\+\)\?\>" |
| 19 | + |
| 20 | +syn keyword jsltConditional if else |
| 21 | +syn keyword jsltBoolean true false |
| 22 | +syn keyword jsltNull null |
| 23 | +syn keyword jsltRepeat for |
| 24 | +syn keyword jsltOperator and or |
| 25 | +syn match jsltOperator "\%(=\|==\|!=\|>=\|>\|<\|<=\|+\|-\|*\|\/\||\)" |
| 26 | +syn match jsltIdentifier "\h\%(\w\|-\)*" display contained |
| 27 | +syn keyword jsltStatement let nextgroup=jsltIdentifier skipwhite |
| 28 | +syn keyword jsltStatement def nextgroup=jsltIdentifier skipwhite |
| 29 | + |
| 30 | +syn keyword jsltImport import nextgroup=jsltImportSource skipwhite |
| 31 | +syn region jsltImportSource start=+"+ skip=+\\\"\|\\\\+ end=+"+ contains=jsltStringEscape nextgroup=jsltImportName skipwhite |
| 32 | +syn keyword jsltImportName as contained nextgroup=jsltIdentifier skipwhite |
| 33 | + |
| 34 | +syn keyword jsltCommentTodo FIXME NOTE TBD TODO XXX contained |
| 35 | +syn match jsltLineComment "\/\/.*" contains=@Spell,jsltCommentTodo |
| 36 | + |
| 37 | +" The default highlight links. Can be overridden later. |
| 38 | +hi def link jsltStatement Statement |
| 39 | +hi def link jsltImportSource String |
| 40 | +hi def link jsltImportName Statement |
| 41 | +hi def link jsltConditional Conditional |
| 42 | +hi def link jsltRepeat Repeat |
| 43 | +hi def link jsltOperator Operator |
| 44 | +hi def link jsltImport Include |
| 45 | +hi def link jsltIdentifier Function |
| 46 | +hi def link jsltLineComment Comment |
| 47 | +hi def link jsltCommentTodo Todo |
| 48 | +hi def link jsltNull Constant |
| 49 | +hi def link jsltBoolean Boolean |
| 50 | +hi def link jsltString String |
| 51 | +hi def link jsltStringEscape Special |
| 52 | +hi def link jsltNumber Number |
| 53 | + |
| 54 | +let b:current_syntax = "jslt" |
| 55 | + |
| 56 | +let &cpo = s:cpo_save |
| 57 | +unlet s:cpo_save |
| 58 | + |
| 59 | +" vim:set shiftwidth=2 softtabstop=2 tabstop=2 expandtab: |
0 commit comments