7
|
1 " Vim syntax file
|
|
2 " Language: JavaCC, a Java Compiler Compiler written by JavaSoft
|
|
3 " Maintainer: Claudio Fleiner <claudio@fleiner.com>
|
|
4 " URL: http://www.fleiner.com/vim/syntax/javacc.vim
|
|
5 " Last Change: 2001 Jun 20
|
|
6
|
|
7 " Uses java.vim, and adds a few special things for JavaCC Parser files.
|
|
8 " Those files usually have the extension *.jj
|
|
9
|
|
10 " For version 5.x: Clear all syntax items
|
|
11 " For version 6.x: Quit when a syntax file was already loaded
|
|
12 if version < 600
|
|
13 syntax clear
|
|
14 elseif exists("b:current_syntax")
|
|
15 finish
|
|
16 endif
|
|
17
|
|
18 " source the java.vim file
|
|
19 if version < 600
|
|
20 source <sfile>:p:h/java.vim
|
|
21 else
|
|
22 runtime! syntax/java.vim
|
|
23 endif
|
|
24 unlet b:current_syntax
|
|
25
|
|
26 "remove catching errors caused by wrong parenthesis (does not work in javacc
|
|
27 "files) (first define them in case they have not been defined in java)
|
|
28 syn match javaParen "--"
|
|
29 syn match javaParenError "--"
|
|
30 syn match javaInParen "--"
|
|
31 syn match javaError2 "--"
|
|
32 syn clear javaParen
|
|
33 syn clear javaParenError
|
|
34 syn clear javaInParen
|
|
35 syn clear javaError2
|
|
36
|
|
37 " remove function definitions (they look different) (first define in
|
|
38 " in case it was not defined in java.vim)
|
|
39 "syn match javaFuncDef "--"
|
|
40 syn clear javaFuncDef
|
|
41 syn match javaFuncDef "[$_a-zA-Z][$_a-zA-Z0-9_. \[\]]*([^-+*/()]*)[ \t]*:" contains=javaType
|
|
42
|
|
43 syn keyword javaccPackages options DEBUG_PARSER DEBUG_LOOKAHEAD DEBUG_TOKEN_MANAGER
|
|
44 syn keyword javaccPackages COMMON_TOKEN_ACTION IGNORE_CASE CHOICE_AMBIGUITY_CHECK
|
|
45 syn keyword javaccPackages OTHER_AMBIGUITY_CHECK STATIC LOOKAHEAD ERROR_REPORTING
|
|
46 syn keyword javaccPackages USER_TOKEN_MANAGER USER_CHAR_STREAM JAVA_UNICODE_ESCAPE
|
|
47 syn keyword javaccPackages UNICODE_INPUT
|
|
48 syn match javaccPackages "PARSER_END([^)]*)"
|
|
49 syn match javaccPackages "PARSER_BEGIN([^)]*)"
|
|
50 syn match javaccSpecToken "<EOF>"
|
|
51 " the dot is necessary as otherwise it will be matched as a keyword.
|
|
52 syn match javaccSpecToken ".LOOKAHEAD("ms=s+1,me=e-1
|
|
53 syn match javaccToken "<[^> \t]*>"
|
|
54 syn keyword javaccActionToken TOKEN SKIP MORE SPECIAL_TOKEN
|
|
55 syn keyword javaccError DEBUG IGNORE_IN_BNF
|
|
56
|
|
57 " Define the default highlighting.
|
|
58 " For version 5.7 and earlier: only when not done already
|
|
59 " For version 5.8 and later: only when an item doesn't have highlighting yet
|
|
60 if version >= 508 || !exists("did_css_syn_inits")
|
|
61 if version < 508
|
|
62 let did_css_syn_inits = 1
|
|
63 command -nargs=+ HiLink hi link <args>
|
|
64 else
|
|
65 command -nargs=+ HiLink hi def link <args>
|
|
66 endif
|
|
67 HiLink javaccSpecToken Statement
|
|
68 HiLink javaccActionToken Type
|
|
69 HiLink javaccPackages javaScopeDecl
|
|
70 HiLink javaccToken String
|
|
71 HiLink javaccError Error
|
|
72 delcommand HiLink
|
|
73 endif
|
|
74
|
|
75 let b:current_syntax = "javacc"
|
|
76
|
|
77 " vim: ts=8
|