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