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 / vim54rt.sit / runtime / syntax / yacc.vim < prev    next >
Encoding:
Text File  |  1999-08-14  |  2.3 KB  |  69 lines  |  [TEXT/ALFA]

  1. " Vim syntax file
  2. " Language:    Yacc
  3. " Maintainer:  Dr. Charles E. Campbell, Jr. <Charles.Campbell@gsfc.nasa.gov>
  4. " Last change:    April 8, 1999
  5.  
  6. " Remove any old syntax stuff hanging around
  7. syn clear
  8.  
  9. " Read the C syntax to start with
  10. source <sfile>:p:h/c.vim
  11.  
  12. " Clusters
  13. syn cluster    yaccActionGroup    contains=yaccDelim,cInParen,cTodo,cIncluded,yaccDelim,yaccCurlyError,yaccUnionCurly,yaccUnion,cUserLabel,cOctalZero,cCppOut2,cCppSkip,cErrInBracket,cErrInParen,cOctalError
  14. syn cluster    yaccUnionGroup    contains=yaccKey,cComment,yaccCurly,cType,cStructure,cStorageClass,yaccUnionCurly
  15.  
  16. " Yacc stuff
  17. syn match    yaccDelim    "^[ \t]*[:|;]"
  18. syn match    yaccOper    "@\d\+"
  19.  
  20. syn match    yaccKey    "^[ \t]*%\(token\|type\|left\|right\|start\|ident\)\>"
  21. syn match    yaccKey    "[ \t]%\(prec\|expect\|nonassoc\)\>"
  22. syn match    yaccKey    "\$\(<[a-zA-Z_][a-zA-Z_0-9]*>\)\=[\$0-9]\+"
  23. syn keyword    yaccKeyActn    yyerrok yyclearin
  24.  
  25. syn match    yaccUnionStart    "^%union"    skipwhite skipnl nextgroup=yaccUnion
  26. syn region    yaccUnion    contained matchgroup=yaccCurly start="{" matchgroup=yaccCurly end="}"    contains=@yaccUnionGroup
  27. syn region    yaccUnionCurly    contained matchgroup=yaccCurly start="{" matchgroup=yaccCurly end="}" contains=@yaccUnionGroup
  28. syn match    yaccBrkt    contained "[<>]"
  29. syn match    yaccType    "<[a-zA-Z_][a-zA-Z0-9_]*>"    contains=yaccBrkt
  30. syn match    yaccDefinition    "^[A-Za-z][A-Za-z0-9_]*[ \t]*:"
  31.  
  32. " special Yacc separators
  33. syn match    yaccSectionSep    "^[ \t]*%%"
  34. syn match    yaccSep    "^[ \t]*%{"
  35. syn match    yaccSep    "^[ \t]*%}"
  36.  
  37. " I'd really like to highlight just the outer {}.  Any suggestions???
  38. syn match    yaccCurlyError    "[{}]"
  39. syn region    yaccAction    matchgroup=yaccCurly start="{" end="}" contains=ALLBUT,@yaccActionGroup
  40.  
  41. if !exists("did_yacc_syntax_inits")
  42.   " The default methods for highlighting.  Can be overridden later
  43.   let did_yacc_syntax_inits = 1
  44.  
  45.   " Internal yacc highlighting links
  46.   hi link yaccBrkt    yaccStmt
  47.   hi link yaccKey    yaccStmt
  48.   hi link yaccOper    yaccStmt
  49.   hi link yaccUnionStart    yaccKey
  50.  
  51.   " External yacc highlighting links
  52.   hi link yaccCurly    Delimiter
  53.   hi link yaccCurlyError    Error
  54.   hi link yaccDefinition    Function
  55.   hi link yaccDelim    Function
  56.   hi link yaccKeyActn    Special
  57.   hi link yaccSectionSep    Todo
  58.   hi link yaccSep    Delimiter
  59.   hi link yaccStmt    Statement
  60.   hi link yaccType    Type
  61.  
  62.   " since Bram doesn't like my Delimiter :|
  63.   hi link Delimiter    Type
  64. endif
  65.  
  66. let b:current_syntax = "yacc"
  67.  
  68. " vim: ts=15
  69.