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 / runtime / dos / syntax / ayacc.vim < prev    next >
Encoding:
Text File  |  2012-05-31  |  3.0 KB  |  92 lines

  1. " Vim syntax file
  2. " Language:    AYacc
  3. " Maintainer:    Mathieu Clabaut <mathieu.clabaut@free.fr>
  4. " LastChange:    2011 Dec 25
  5. " Original:    Yacc, maintained by Dr. Charles E. Campbell, Jr.
  6. " Comment:         Replaced sourcing c.vim file by ada.vim and rename yacc*
  7. "        in ayacc*
  8.  
  9. " For version 5.x: Clear all syntax items
  10. " For version 6.x: Quit when a syntax file was already loaded
  11. if version < 600
  12.    syntax clear
  13. elseif exists("b:current_syntax")
  14.    finish
  15. endif
  16.  
  17. " Read the Ada syntax to start with
  18. if version < 600
  19.    so <sfile>:p:h/ada.vim
  20. else
  21.    runtime! syntax/ada.vim
  22.    unlet b:current_syntax
  23. endif
  24.  
  25. let s:cpo_save = &cpo
  26. set cpo&vim
  27.  
  28. " Clusters
  29. syn cluster    ayaccActionGroup    contains=ayaccDelim,cInParen,cTodo,cIncluded,ayaccDelim,ayaccCurlyError,ayaccUnionCurly,ayaccUnion,cUserLabel,cOctalZero,cCppOut2,cCppSkip,cErrInBracket,cErrInParen,cOctalError
  30. syn cluster    ayaccUnionGroup    contains=ayaccKey,cComment,ayaccCurly,cType,cStructure,cStorageClass,ayaccUnionCurly
  31.  
  32. " Yacc stuff
  33. syn match    ayaccDelim    "^[ \t]*[:|;]"
  34. syn match    ayaccOper    "@\d\+"
  35.  
  36. syn match    ayaccKey    "^[ \t]*%\(token\|type\|left\|right\|start\|ident\)\>"
  37. syn match    ayaccKey    "[ \t]%\(prec\|expect\|nonassoc\)\>"
  38. syn match    ayaccKey    "\$\(<[a-zA-Z_][a-zA-Z_0-9]*>\)\=[\$0-9]\+"
  39. syn keyword    ayaccKeyActn    yyerrok yyclearin
  40.  
  41. syn match    ayaccUnionStart    "^%union"    skipwhite skipnl nextgroup=ayaccUnion
  42. syn region    ayaccUnion    contained matchgroup=ayaccCurly start="{" matchgroup=ayaccCurly end="}"    contains=@ayaccUnionGroup
  43. syn region    ayaccUnionCurly    contained matchgroup=ayaccCurly start="{" matchgroup=ayaccCurly end="}" contains=@ayaccUnionGroup
  44. syn match    ayaccBrkt    contained "[<>]"
  45. syn match    ayaccType    "<[a-zA-Z_][a-zA-Z0-9_]*>"    contains=ayaccBrkt
  46. syn match    ayaccDefinition    "^[A-Za-z][A-Za-z0-9_]*[ \t]*:"
  47.  
  48. " special Yacc separators
  49. syn match    ayaccSectionSep    "^[ \t]*%%"
  50. syn match    ayaccSep    "^[ \t]*%{"
  51. syn match    ayaccSep    "^[ \t]*%}"
  52.  
  53. " I'd really like to highlight just the outer {}.  Any suggestions???
  54. syn match    ayaccCurlyError    "[{}]"
  55. syn region    ayaccAction    matchgroup=ayaccCurly start="{" end="}" contains=ALLBUT,@ayaccActionGroup
  56.  
  57. if version >= 508 || !exists("did_ayacc_syntax_inits")
  58.    if version < 508
  59.       let did_ayacc_syntax_inits = 1
  60.       command -nargs=+ HiLink hi link <args>
  61.    else
  62.       command -nargs=+ HiLink hi def link <args>
  63.    endif
  64.  
  65.   " Internal ayacc highlighting links
  66.   HiLink ayaccBrkt    ayaccStmt
  67.   HiLink ayaccKey    ayaccStmt
  68.   HiLink ayaccOper    ayaccStmt
  69.   HiLink ayaccUnionStart    ayaccKey
  70.  
  71.   " External ayacc highlighting links
  72.   HiLink ayaccCurly    Delimiter
  73.   HiLink ayaccCurlyError    Error
  74.   HiLink ayaccDefinition    Function
  75.   HiLink ayaccDelim    Function
  76.   HiLink ayaccKeyActn    Special
  77.   HiLink ayaccSectionSep    Todo
  78.   HiLink ayaccSep    Delimiter
  79.   HiLink ayaccStmt    Statement
  80.   HiLink ayaccType    Type
  81.  
  82.   " since Bram doesn't like my Delimiter :|
  83.   HiLink Delimiter    Type
  84.   delcommand HiLink
  85. endif
  86.  
  87. let b:current_syntax = "ayacc"
  88.  
  89. let &cpo = s:cpo_save
  90. unlet s:cpo_save
  91. " vim: ts=15
  92.