pccts.vim 4.0 KB

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