diff options
| author | Paul Iannetta <paul.iannetta@ens-lyon.fr> | 2022-04-13 19:04:32 +0200 |
|---|---|---|
| committer | Paul Iannetta <paul.iannetta@ens-lyon.fr> | 2022-04-13 19:05:40 +0200 |
| commit | 4794538a95f4af84b812e69d3061a8988b402d6f (patch) | |
| tree | eaaf3fc99ce72b868ef50882deff095a6869f9f1 /.config/nvim/syntax/antlr4.vim | |
| parent | 686b029807fbe46a3f54e83472822ad96139ac02 (diff) | |
add some custom syntax files to nvim
Diffstat (limited to '.config/nvim/syntax/antlr4.vim')
| -rwxr-xr-x | .config/nvim/syntax/antlr4.vim | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/.config/nvim/syntax/antlr4.vim b/.config/nvim/syntax/antlr4.vim new file mode 100755 index 0000000..6f41e4a --- /dev/null +++ b/.config/nvim/syntax/antlr4.vim @@ -0,0 +1,76 @@ +" vim: ts=8 +" Vim syntax file +" Language: ANTLRv4 +" Maintainer: Jörn Horstmann (updated by Dylon Edwards) +" Last Change: 2015-12-15 + +" For version 5.x: Clear all syntax items +" For version 6.x: Quit when a syntax file was already loaded +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +syn keyword antlrKeyword import fragment lexer parser grammar returns locals throws catch finally mode options tokens header members init after channels mode protected public private + +syn keyword antlrReserved rule + +syn match antlrCharacter '\\\(r\|n\|t\|f\|b\|"\|\'\|\\\|u\x\{4}\)' contained display + +syn match antlrToken "\<[A-Z_][a-zA-Z_0-9]\+\>" +syn match antlrRule "[a-z][a-zA-Z_0-9]\+" +syn match antlrScopeVariable '$\k\+::\k\+' + +syn match antlrOperator "[:;@.]" +syn match antlrOperator "[()]" +syn match antlrOperator "[?+*~|!]" +syn match antlrOperator "[->=^]" + +syn match antlrBlock "[{}]" +syn region antlrAction matchgroup=antlrBlock start="{" end="}" contains=antlrVariable,antlrAction +syn match antlrVariable contained "$[a-zA-Z][a-zA-Z_0-9]*" + +syn include @PYTHON syntax/python.vim +syn region ANTLR4EmbeddedPythonAction matchgroup=antlrBlock start="{" end="}" contains=@PYTHON,antlrVariable containedin=antlrAction + +syn keyword antlrOperations pushMode popMode skip channel + +syn match antlrBrace "[\[\]]" +syn region antlrCharClass matchgroup=antlrBrace start="\[" end="\]" contains=antlrCharacter + +syn region antlrLiteral start=+'+ end=+'+ contains=antlrCharacter +syn region antlrLiteral start=+"+ end=+"+ contains=antlrCharacter + +syn region antlrComment start="/\*" end="\*/" +syn match antlrComment "//.*$" + +" Define the default highlighting. +" For version 5.7 and earlier: only when not done already +" For version 5.8 and later: only when an item doesn't have highlighting yet +if version >= 508 + if version < 508 + let did_antlr_syntax_inits = 1 + command -nargs=+ HiLink hi link <args> + else + command -nargs=+ HiLink hi def link <args> + endif + + HiLink antlrReserved Error + HiLink antlrOperations Identifier + HiLink antlrLiteral String + hi def antlrVariable term=bold cterm=bold gui=bold + HiLink antlrBrace Operator + HiLink antlrBlock Operator + HiLink antlrCharacter Special + HiLink antlrComment Comment + HiLink antlrOperator Operator + HiLink antlrKeyword Keyword + HiLink antlrToken PreProc + HiLink antlrScopeVariable Identifier + HiLink antlrRule Type + + delcommand HiLink +endif + +let b:current_syntax = "antlr4" |
