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 May 10
7 " Uses java.vim, and adds a few special things for JavaCC Parser files.
8 " Those files usually have the extension *.jj
10 " For version 5.x: Clear all syntax items
11 " For version 6.x: Quit when a syntax file was already loaded
14 elseif exists("b:current_syntax")
18 " source the java.vim file
20 source <sfile>:p:h/java.vim
22 runtime! syntax/java.vim
25 "remove catching errors caused by wrong parenthesis (does not work in javacc
26 "files) (first define them in case they have not been defined in java)
27 syn match javaParen "--"
28 syn match javaParenError "--"
29 syn match javaInParen "--"
30 syn match javaError2 "--"
32 syn clear javaParenError
36 " remove function definitions (they look different) (first define in
37 " in case it was not defined in java.vim)
38 "syn match javaFuncDef "--"
40 syn match javaFuncDef "[$_a-zA-Z][$_a-zA-Z0-9_. \[\]]*([^-+*/()]*)[ \t]*:" contains=javaType
42 syn keyword javaccPackages options DEBUG_PARSER DEBUG_LOOKAHEAD DEBUG_TOKEN_MANAGER
43 syn keyword javaccPackages COMMON_TOKEN_ACTION IGNORE_CASE CHOICE_AMBIGUITY_CHECK
44 syn keyword javaccPackages OTHER_AMBIGUITY_CHECK STATIC LOOKAHEAD ERROR_REPORTING
45 syn keyword javaccPackages USER_TOKEN_MANAGER USER_CHAR_STREAM JAVA_UNICODE_ESCAPE
46 syn keyword javaccPackages UNICODE_INPUT
47 syn match javaccPackages "PARSER_END([^)]*)"
48 syn match javaccPackages "PARSER_BEGIN([^)]*)"
49 syn match javaccSpecToken "<EOF>"
50 " the dot is necessary as otherwise it will be matched as a keyword.
51 syn match javaccSpecToken ".LOOKAHEAD("ms=s+1,me=e-1
52 syn match javaccToken "<[^> \t]*>"
53 syn keyword javaccActionToken TOKEN SKIP MORE SPECIAL_TOKEN
54 syn keyword javaccError DEBUG IGNORE_IN_BNF
56 " Define the default highlighting.
57 " For version 5.7 and earlier: only when not done already
58 " For version 5.8 and later: only when an item doesn't have highlighting yet
59 if version >= 508 || !exists("did_css_syn_inits")
61 let did_css_syn_inits = 1
62 command -nargs=+ HiLink hi link <args>
64 command -nargs=+ HiLink hi def link <args>
66 HiLink javaccSpecToken Statement
67 HiLink javaccActionToken Type
68 HiLink javaccPackages javaScopeDecl
69 HiLink javaccToken String
70 HiLink javaccError Error
74 let b:current_syntax = "javacc"