home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / mac / vim55rt.sit / runtime / syntax / pccts.vim < prev    next >
Encoding:
Text File  |  1999-09-25  |  4.0 KB  |  88 lines  |  [TEXT/VIM!]

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