2 " Antlr: ANTLR, Another Tool For Language Recognition <www.antlr.org>
3 " Maintainer: Mathieu Clabaut <mathieu.clabaut@free.fr>
4 " LastChange: 02 May 2001
5 " Original: Comes from JavaCC.vim
7 " For version 5.x: Clear all syntax items
8 " For version 6.x: Quit when a syntax file was already loaded
11 elseif exists("b:current_syntax")
15 " This syntac file is a first attempt. It is far from perfect...
17 " Uses java.vim, and adds a few special things for JavaCC Parser files.
18 " Those files usually have the extension *.jj
20 " source the java.vim file
22 so <sfile>:p:h/java.vim
24 runtime! syntax/java.vim
25 unlet b:current_syntax
28 "remove catching errors caused by wrong parenthesis (does not work in antlr
29 "files) (first define them in case they have not been defined in java)
30 syn match javaParen "--"
31 syn match javaParenError "--"
32 syn match javaInParen "--"
33 syn match javaError2 "--"
35 syn clear javaParenError
39 " remove function definitions (they look different) (first define in
40 " in case it was not defined in java.vim)
41 "syn match javaFuncDef "--"
42 "syn clear javaFuncDef
43 "syn match javaFuncDef "[a-zA-Z][a-zA-Z0-9_. \[\]]*([^-+*/()]*)[ \t]*:" contains=javaType
44 " syn region javaFuncDef start=+t[a-zA-Z][a-zA-Z0-9_. \[\]]*([^-+*/()]*,[ ]*+ end=+)[ \t]*:+
46 syn keyword antlrPackages options language buildAST
47 syn match antlrPackages "PARSER_END([^)]*)"
48 syn match antlrPackages "PARSER_BEGIN([^)]*)"
49 syn match antlrSpecToken "<EOF>"
50 " the dot is necessary as otherwise it will be matched as a keyword.
51 syn match antlrSpecToken ".LOOKAHEAD("ms=s+1,me=e-1
52 syn match antlrSep "[|:]\|\.\."
53 syn keyword antlrActionToken TOKEN SKIP MORE SPECIAL_TOKEN
54 syn keyword antlrError DEBUG IGNORE_IN_BNF
56 if version >= 508 || !exists("did_antlr_syntax_inits")
58 let did_antlr_syntax_inits = 1
59 command -nargs=+ HiLink hi link <args>
61 command -nargs=+ HiLink hi def link <args>
63 HiLink antlrSep Statement
64 HiLink antlrPackages Statement
68 let b:current_syntax = "antlr"