7
|
1 " Vim syntax file
|
|
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
|
|
6
|
|
7 " For version 5.x: Clear all syntax items
|
|
8 " For version 6.x: Quit when a syntax file was already loaded
|
|
9 if version < 600
|
|
10 syntax clear
|
|
11 elseif exists("b:current_syntax")
|
|
12 finish
|
|
13 endif
|
|
14
|
|
15 " This syntac file is a first attempt. It is far from perfect...
|
|
16
|
|
17 " Uses java.vim, and adds a few special things for JavaCC Parser files.
|
|
18 " Those files usually have the extension *.jj
|
|
19
|
|
20 " source the java.vim file
|
|
21 if version < 600
|
|
22 so <sfile>:p:h/java.vim
|
|
23 else
|
|
24 runtime! syntax/java.vim
|
|
25 unlet b:current_syntax
|
|
26 endif
|
|
27
|
|
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 "--"
|
|
34 syn clear javaParen
|
|
35 syn clear javaParenError
|
|
36 syn clear javaInParen
|
|
37 syn clear javaError2
|
|
38
|
|
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]*:+
|
|
45
|
|
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
|
|
55
|
|
56 if version >= 508 || !exists("did_antlr_syntax_inits")
|
|
57 if version < 508
|
|
58 let did_antlr_syntax_inits = 1
|
|
59 command -nargs=+ HiLink hi link <args>
|
|
60 else
|
|
61 command -nargs=+ HiLink hi def link <args>
|
|
62 endif
|
|
63 HiLink antlrSep Statement
|
|
64 HiLink antlrPackages Statement
|
|
65 delcommand HiLink
|
|
66 endif
|
|
67
|
|
68 let b:current_syntax = "antlr"
|
|
69
|
|
70 " vim: ts=8
|