1" Vim syntax file 2" Language: PCCTS 3" Maintainer: Scott Bigham <[email protected]> 4" Last Change: 10 Aug 1999 5 6" quit when a syntax file was already loaded 7if exists("b:current_syntax") 8 finish 9endif 10 11" Read the C++ syntax to start with 12syn include @cppTopLevel syntax/cpp.vim 13 14syn region pcctsAction matchgroup=pcctsDelim start="<<" end=">>?\=" contains=@cppTopLevel,pcctsRuleRef 15 16syn region pcctsArgBlock matchgroup=pcctsDelim start="\(>\s*\)\=\[" end="\]" contains=@cppTopLevel,pcctsRuleRef 17 18syn region pcctsString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=pcctsSpecialChar 19syn match pcctsSpecialChar "\\\\\|\\\"" contained 20 21syn region pcctsComment start="/\*" end="\*/" contains=cTodo 22syn match pcctsComment "//.*$" contains=cTodo 23 24syn region pcctsDirective start="^\s*#header\s\+<<" end=">>" contains=pcctsAction keepend 25syn match pcctsDirective "^\s*#parser\>.*$" contains=pcctsString,pcctsComment 26syn match pcctsDirective "^\s*#tokdefs\>.*$" contains=pcctsString,pcctsComment 27syn match pcctsDirective "^\s*#token\>.*$" contains=pcctsString,pcctsAction,pcctsTokenName,pcctsComment 28syn region pcctsDirective start="^\s*#tokclass\s\+[A-Z]\i*\s\+{" end="}" contains=pcctsString,pcctsTokenName 29syn match pcctsDirective "^\s*#lexclass\>.*$" contains=pcctsTokenName 30syn region pcctsDirective start="^\s*#errclass\s\+[^{]\+\s\+{" end="}" contains=pcctsString,pcctsTokenName 31syn match pcctsDirective "^\s*#pred\>.*$" contains=pcctsTokenName,pcctsAction 32 33syn cluster pcctsInRule contains=pcctsString,pcctsRuleName,pcctsTokenName,pcctsAction,pcctsArgBlock,pcctsSubRule,pcctsLabel,pcctsComment 34 35syn region pcctsRule start="\<[a-z][A-Za-z0-9_]*\>\(\s*\[[^]]*\]\)\=\(\s*>\s*\[[^]]*\]\)\=\s*:" end=";" contains=@pcctsInRule 36 37syn region pcctsSubRule matchgroup=pcctsDelim start="(" end=")\(+\|\*\|?\(\s*=>\)\=\)\=" contains=@pcctsInRule contained 38syn region pcctsSubRule matchgroup=pcctsDelim start="{" end="}" contains=@pcctsInRule contained 39 40syn match pcctsRuleName "\<[a-z]\i*\>" contained 41syn match pcctsTokenName "\<[A-Z]\i*\>" contained 42 43syn match pcctsLabel "\<\I\i*:\I\i*" contained contains=pcctsLabelHack,pcctsRuleName,pcctsTokenName 44syn match pcctsLabel "\<\I\i*:\"\([^\\]\|\\.\)*\"" contained contains=pcctsLabelHack,pcctsString 45syn match pcctsLabelHack "\<\I\i*:" contained 46 47syn match pcctsRuleRef "\$\I\i*\>" contained 48syn match pcctsRuleRef "\$\d\+\(\.\d\+\)\>" contained 49 50syn keyword pcctsClass class nextgroup=pcctsClassName skipwhite 51syn match pcctsClassName "\<\I\i*\>" contained nextgroup=pcctsClassBlock skipwhite skipnl 52syn region pcctsClassBlock start="{" end="}" contained contains=pcctsRule,pcctsComment,pcctsDirective,pcctsAction,pcctsException,pcctsExceptionHandler 53 54syn keyword pcctsException exception nextgroup=pcctsExceptionRuleRef skipwhite 55syn match pcctsExceptionRuleRef "\[\I\i*\]" contained contains=pcctsExceptionID 56syn match pcctsExceptionID "\I\i*" contained 57syn keyword pcctsExceptionHandler catch default 58syn keyword pcctsExceptionHandler NoViableAlt NoSemViableAlt 59syn keyword pcctsExceptionHandler MismatchedToken 60 61syn sync clear 62syn sync match pcctsSyncAction grouphere pcctsAction "<<" 63syn sync match pcctsSyncAction "<<\([^>]\|>[^>]\)*>>" 64syn sync match pcctsSyncRule grouphere pcctsRule "\<[a-z][A-Za-z0-9_]*\>\s*\[[^]]*\]\s*:" 65syn sync match pcctsSyncRule grouphere pcctsRule "\<[a-z][A-Za-z0-9_]*\>\(\s*\[[^]]*\]\)\=\s*>\s*\[[^]]*\]\s*:" 66 67" Define the default highlighting. 68" Only when an item doesn't have highlighting yet 69 70hi def link pcctsDelim Special 71hi def link pcctsTokenName Identifier 72hi def link pcctsRuleName Statement 73hi def link pcctsLabelHack Label 74hi def link pcctsDirective PreProc 75hi def link pcctsString String 76hi def link pcctsComment Comment 77hi def link pcctsClass Statement 78hi def link pcctsClassName Identifier 79hi def link pcctsException Statement 80hi def link pcctsExceptionHandler Keyword 81hi def link pcctsExceptionRuleRef pcctsDelim 82hi def link pcctsExceptionID Identifier 83hi def link pcctsRuleRef Identifier 84hi def link pcctsSpecialChar SpecialChar 85 86 87let b:current_syntax = "pccts" 88 89" vim: ts=8 90