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
|
3854
|
5 " Last Change: 2012 Oct 05
|
7
|
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
|
3854
|
18 let s:cpo_save = &cpo
|
|
19 set cpo&vim
|
|
20
|
7
|
21 " source the java.vim file
|
|
22 if version < 600
|
|
23 source <sfile>:p:h/java.vim
|
|
24 else
|
|
25 runtime! syntax/java.vim
|
|
26 endif
|
|
27 unlet b:current_syntax
|
|
28
|
|
29 "remove catching errors caused by wrong parenthesis (does not work in javacc
|
|
30 "files) (first define them in case they have not been defined in java)
|
|
31 syn match javaParen "--"
|
|
32 syn match javaParenError "--"
|
|
33 syn match javaInParen "--"
|
|
34 syn match javaError2 "--"
|
|
35 syn clear javaParen
|
|
36 syn clear javaParenError
|
|
37 syn clear javaInParen
|
|
38 syn clear javaError2
|
|
39
|
|
40 " remove function definitions (they look different) (first define in
|
|
41 " in case it was not defined in java.vim)
|
|
42 "syn match javaFuncDef "--"
|
|
43 syn clear javaFuncDef
|
|
44 syn match javaFuncDef "[$_a-zA-Z][$_a-zA-Z0-9_. \[\]]*([^-+*/()]*)[ \t]*:" contains=javaType
|
|
45
|
|
46 syn keyword javaccPackages options DEBUG_PARSER DEBUG_LOOKAHEAD DEBUG_TOKEN_MANAGER
|
|
47 syn keyword javaccPackages COMMON_TOKEN_ACTION IGNORE_CASE CHOICE_AMBIGUITY_CHECK
|
|
48 syn keyword javaccPackages OTHER_AMBIGUITY_CHECK STATIC LOOKAHEAD ERROR_REPORTING
|
|
49 syn keyword javaccPackages USER_TOKEN_MANAGER USER_CHAR_STREAM JAVA_UNICODE_ESCAPE
|
3854
|
50 syn keyword javaccPackages UNICODE_INPUT JDK_VERSION
|
7
|
51 syn match javaccPackages "PARSER_END([^)]*)"
|
|
52 syn match javaccPackages "PARSER_BEGIN([^)]*)"
|
|
53 syn match javaccSpecToken "<EOF>"
|
|
54 " the dot is necessary as otherwise it will be matched as a keyword.
|
|
55 syn match javaccSpecToken ".LOOKAHEAD("ms=s+1,me=e-1
|
|
56 syn match javaccToken "<[^> \t]*>"
|
|
57 syn keyword javaccActionToken TOKEN SKIP MORE SPECIAL_TOKEN
|
|
58 syn keyword javaccError DEBUG IGNORE_IN_BNF
|
|
59
|
|
60 " Define the default highlighting.
|
|
61 " For version 5.7 and earlier: only when not done already
|
|
62 " For version 5.8 and later: only when an item doesn't have highlighting yet
|
|
63 if version >= 508 || !exists("did_css_syn_inits")
|
|
64 if version < 508
|
|
65 let did_css_syn_inits = 1
|
|
66 command -nargs=+ HiLink hi link <args>
|
|
67 else
|
|
68 command -nargs=+ HiLink hi def link <args>
|
|
69 endif
|
|
70 HiLink javaccSpecToken Statement
|
|
71 HiLink javaccActionToken Type
|
|
72 HiLink javaccPackages javaScopeDecl
|
|
73 HiLink javaccToken String
|
|
74 HiLink javaccError Error
|
|
75 delcommand HiLink
|
|
76 endif
|
|
77
|
|
78 let b:current_syntax = "javacc"
|
3854
|
79 let &cpo = s:cpo_save
|
|
80 unlet s:cpo_save
|
7
|
81
|
|
82 " vim: ts=8
|