Start anew
[msysgit.git] / share / vim / vim58 / syntax / pccts.vim
blobef52681179d7c10f587e9e7725b4ed74f91c4a76
1 " Vim syntax file
2 " Language:     PCCTS
3 " Maintainer:   Scott Bigham <dsb@cs.duke.edu>
4 " Last Change:  10 Aug 1999
6 " For version 5.x: Clear all syntax items
7 " For version 6.x: Quit when a syntax file was already loaded
8 if version < 600
9   syntax clear
10 elseif exists("b:current_syntax")
11   finish
12 endif
14 " Read the C++ syntax to start with
15 if version < 600
16   syn include @cppTopLevel <sfile>:p:h/cpp.vim
17 else
18   syn include @cppTopLevel syntax/cpp.vim
19 endif
21 syn region pcctsAction matchgroup=pcctsDelim start="<<" end=">>?\=" contains=@cppTopLevel,pcctsRuleRef
23 syn region pcctsArgBlock matchgroup=pcctsDelim start="\(>\s*\)\=\[" end="\]" contains=@cppTopLevel,pcctsRuleRef
25 syn region pcctsString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=pcctsSpecialChar
26 syn match  pcctsSpecialChar "\\\\\|\\\"" contained
28 syn region pcctsComment start="/\*" end="\*/" contains=cTodo
29 syn match  pcctsComment "//.*$" contains=cTodo
31 syn region pcctsDirective start="^\s*#header\s\+<<" end=">>" contains=pcctsAction keepend
32 syn match  pcctsDirective "^\s*#parser\>.*$" contains=pcctsString,pcctsComment
33 syn match  pcctsDirective "^\s*#tokdefs\>.*$" contains=pcctsString,pcctsComment
34 syn match  pcctsDirective "^\s*#token\>.*$" contains=pcctsString,pcctsAction,pcctsTokenName,pcctsComment
35 syn region pcctsDirective start="^\s*#tokclass\s\+[A-Z]\i*\s\+{" end="}" contains=pcctsString,pcctsTokenName
36 syn match  pcctsDirective "^\s*#lexclass\>.*$" contains=pcctsTokenName
37 syn region pcctsDirective start="^\s*#errclass\s\+[^{]\+\s\+{" end="}" contains=pcctsString,pcctsTokenName
38 syn match pcctsDirective "^\s*#pred\>.*$" contains=pcctsTokenName,pcctsAction
40 syn cluster pcctsInRule contains=pcctsString,pcctsRuleName,pcctsTokenName,pcctsAction,pcctsArgBlock,pcctsSubRule,pcctsLabel,pcctsComment
42 syn region pcctsRule start="\<[a-z][A-Za-z0-9_]*\>\(\s*\[[^]]*\]\)\=\(\s*>\s*\[[^]]*\]\)\=\s*:" end=";" contains=@pcctsInRule
44 syn region pcctsSubRule matchgroup=pcctsDelim start="(" end=")\(+\|\*\|?\(\s*=>\)\=\)\=" contains=@pcctsInRule contained
45 syn region pcctsSubRule matchgroup=pcctsDelim start="{" end="}" contains=@pcctsInRule contained
47 syn match pcctsRuleName  "\<[a-z]\i*\>" contained
48 syn match pcctsTokenName "\<[A-Z]\i*\>" contained
50 syn match pcctsLabel "\<\I\i*:\I\i*" contained contains=pcctsLabelHack,pcctsRuleName,pcctsTokenName
51 syn match pcctsLabel "\<\I\i*:\"\([^\\]\|\\.\)*\"" contained contains=pcctsLabelHack,pcctsString
52 syn match pcctsLabelHack "\<\I\i*:" contained
54 syn match pcctsRuleRef "\$\I\i*\>" contained
55 syn match pcctsRuleRef "\$\d\+\(\.\d\+\)\>" contained
57 syn keyword pcctsClass     class   nextgroup=pcctsClassName skipwhite
58 syn match   pcctsClassName "\<\I\i*\>" contained nextgroup=pcctsClassBlock skipwhite skipnl
59 syn region pcctsClassBlock start="{" end="}" contained contains=pcctsRule,pcctsComment,pcctsDirective,pcctsAction,pcctsException,pcctsExceptionHandler
61 syn keyword pcctsException exception nextgroup=pcctsExceptionRuleRef skipwhite
62 syn match pcctsExceptionRuleRef "\[\I\i*\]" contained contains=pcctsExceptionID
63 syn match pcctsExceptionID "\I\i*" contained
64 syn keyword pcctsExceptionHandler       catch default
65 syn keyword pcctsExceptionHandler       NoViableAlt NoSemViableAlt
66 syn keyword pcctsExceptionHandler       MismatchedToken
68 syn sync clear
69 syn sync match pcctsSyncAction grouphere pcctsAction "<<"
70 syn sync match pcctsSyncAction "<<\([^>]\|>[^>]\)*>>"
71 syn sync match pcctsSyncRule grouphere pcctsRule "\<[a-z][A-Za-z0-9_]*\>\s*\[[^]]*\]\s*:"
72 syn sync match pcctsSyncRule grouphere pcctsRule "\<[a-z][A-Za-z0-9_]*\>\(\s*\[[^]]*\]\)\=\s*>\s*\[[^]]*\]\s*:"
74 " Define the default highlighting.
75 " For version 5.7 and earlier: only when not done already
76 " For version 5.8 and later: only when an item doesn't have highlighting yet
77 if version >= 508 || !exists("did_pccts_syntax_inits")
78   if version < 508
79     let did_pccts_syntax_inits = 1
80     command -nargs=+ HiLink hi link <args>
81   else
82     command -nargs=+ HiLink hi def link <args>
83   endif
85   HiLink pcctsDelim             Special
86   HiLink pcctsTokenName         Identifier
87   HiLink pcctsRuleName          Statement
88   HiLink pcctsLabelHack         Label
89   HiLink pcctsDirective         PreProc
90   HiLink pcctsString            String
91   HiLink pcctsComment           Comment
92   HiLink pcctsClass             Statement
93   HiLink pcctsClassName         Identifier
94   HiLink pcctsException         Statement
95   HiLink pcctsExceptionHandler  Keyword
96   HiLink pcctsExceptionRuleRef  pcctsDelim
97   HiLink pcctsExceptionID       Identifier
98   HiLink pcctsRuleRef           Identifier
99   HiLink pcctsSpecialChar       SpecialChar
101   delcommand HiLink
102 endif
104 let b:current_syntax = "pccts"
106 " vim: ts=8