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 / lex.vim < prev    next >
Encoding:
Text File  |  1999-09-25  |  3.8 KB  |  76 lines  |  [TEXT/VIM!]

  1. " Vim syntax file
  2. " Language:    Lex
  3. " Maintainer:    Dr. Charles E. Campbell, Jr. <Charles.Campbell@gsfc.nasa.gov>
  4. " Last change:    May 13, 1999
  5.  
  6. " Remove any old syntax stuff hanging around
  7. syn clear
  8.  
  9. " Read the C syntax to start with
  10. so <sfile>:p:h/c.vim
  11.  
  12. " --- Lex stuff ---
  13.  
  14. "I'd prefer to use lex.* , but it doesn't handle forward definitions yet
  15. syn cluster lexListGroup        contains=lexAbbrvBlock,lexAbbrv,lexAbbrv,lexAbbrvRegExp,lexInclude,lexPatBlock,lexPat,lexBrace,lexPatString,lexPatTag,lexPatTag,lexPatComment,lexPatCodeLine,lexMorePat,lexPatSep,lexSlashQuote,lexPatCode,cInParen,cUserLabel,cOctalZero,cCppSkip,cErrInBracket,cErrInParen,cOctalError,cCppOut2
  16. syn cluster lexListPatCodeGroup    contains=lexAbbrvBlock,lexAbbrv,lexAbbrv,lexAbbrvRegExp,lexInclude,lexPatBlock,lexPat,lexBrace,lexPatTag,lexPatTag,lexPatComment,lexPatCodeLine,lexMorePat,lexPatSep,lexSlashQuote,cInParen,cUserLabel,cOctalZero,cCppSkip,cErrInBracket,cErrInParen,cOctalError,cCppOut2
  17.  
  18. " Abbreviations Section
  19. syn region lexAbbrvBlock    start="^\([a-zA-Z_]\+\t\|%{\)" end="^%%$"me=e-2    skipnl    nextgroup=lexPatBlock contains=lexAbbrv,lexInclude,lexAbbrvComment
  20. syn match  lexAbbrv        "^\I\i*\s"me=e-1            skipwhite    contained nextgroup=lexAbbrvRegExp
  21. syn match  lexAbbrv        "^%[sx]"                    contained
  22. syn match  lexAbbrvRegExp    "\s\S.*$"lc=1                contained nextgroup=lexAbbrv,lexInclude
  23. syn region lexInclude    matchgroup=lexSep    start="^%{" end="%}"    contained    contains=ALLBUT,@lexListGroup
  24. syn region lexAbbrvComment    start="^\s\+/\*"    end="\*/"
  25.  
  26. "%% : Patterns {Actions}
  27. syn region lexPatBlock    matchgroup=Todo    start="^%%$" matchgroup=Todo end="^%%$"    skipnl skipwhite contains=lexPat,lexPatTag,lexPatComment
  28. syn region lexPat        start=+\S+ skip="\\\\\|\\."    end="\s"me=e-1    contained nextgroup=lexMorePat,lexPatSep contains=lexPatString,lexSlashQuote,lexBrace
  29. syn region lexBrace    start="\[" skip=+\\\\\|\\+        end="]"        contained
  30. syn region lexPatString    matchgroup=String start=+"+    skip=+\\\\\|\\"+    matchgroup=String end=+"+    contained
  31. syn match  lexPatTag    "^<\I\i*\(,\I\i*\)*>*"            contained nextgroup=lexPat,lexPatTag,lexMorePat,lexPatSep
  32. syn match  lexPatTag    +^<\I\i*\(,\I\i*\)*>*\(\\\\\)*\\"+        contained nextgroup=lexPat,lexPatTag,lexMorePat,lexPatSep
  33. syn region lexPatComment    start="^\s*/\*" end="\*/"        skipnl    contained contains=cTodo nextgroup=lexPatComment,lexPat,lexPatString,lexPatTag
  34. syn match  lexPatCodeLine    ".*$"                    contained contains=ALLBUT,@lexListGroup
  35. syn match  lexMorePat    "\s*|\s*$"            skipnl    contained nextgroup=lexPat,lexPatTag,lexPatComment
  36. syn match  lexPatSep    "\s\+"                    contained nextgroup=lexMorePat,lexPatCode,lexPatCodeLine
  37. syn match  lexSlashQuote    +\(\\\\\)*\\"+                contained
  38. syn region lexPatCode matchgroup=Delimiter start="{" matchgroup=Delimiter end="}"    skipnl contained contains=ALLBUT,@lexListPatCodeGroup
  39.  
  40. syn keyword lexCFunctions    BEGIN    input    unput    woutput    yyleng    yylook    yytext
  41. syn keyword lexCFunctions    ECHO    output    winput    wunput    yyless    yymore    yywrap
  42.  
  43. " <c.vim> includes several ALLBUTs; these have to be treated so as to exclude lex* groups
  44. syn cluster cParenGroup    add=lex.*
  45. syn cluster cDefineGroup    add=lex.*
  46. syn cluster cPreProcGroup    add=lex.*
  47. syn cluster cMultiGroup    add=lex.*
  48.  
  49. " Synchronization
  50. syn sync clear
  51. syn sync minlines=300
  52. syn sync match lexSyncPat    grouphere  lexPatBlock    "^%[a-zA-Z]"
  53. syn sync match lexSyncPat    groupthere lexPatBlock    "^<$"
  54. syn sync match lexSyncPat    groupthere lexPatBlock    "^%%$"
  55.  
  56. if !exists("did_lex_syntax_inits")
  57.   let did_lex_synax_inits = 1
  58.   hi link    lexSlashQuote    lexPat
  59.   hi link    lexBrace        lexPat
  60.   hi link lexAbbrvComment    lexPatComment
  61.  
  62.   hi link    lexAbbrv        SpecialChar
  63.   hi link    lexAbbrvRegExp    Macro
  64.   hi link    lexCFunctions    Function
  65.   hi link    lexMorePat    SpecialChar
  66.   hi link    lexPat        Function
  67.   hi link    lexPatComment    Comment
  68.   hi link    lexPatString    Function
  69.   hi link    lexPatTag        Special
  70.   hi link    lexSep        Delimiter
  71. endif
  72.  
  73. let b:current_syntax = "lex"
  74.  
  75. " vim:ts=10
  76.