home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 February / OpenLinux 2.3 CD.iso / live / usr / share / vim / syntax / lex.vim < prev    next >
Encoding:
Text File  |  1999-08-10  |  3.6 KB  |  74 lines

  1. " Vim syntax file
  2. " Language:    Lex
  3. " Maintainer:    Dr. Charles E. Campbell, Jr. <Charles.Campbell@gsfc.nasa.gov>
  4. " Last change:    Aug 27, 1998
  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
  16. syn cluster lexListPatCodeGroup    contains=lexAbbrvBlock,lexAbbrv,lexAbbrv,lexAbbrvRegExp,lexInclude,lexPatBlock,lexPat,lexBrace,lexPatTag,lexPatTag,lexPatComment,lexPatCodeLine,lexMorePat,lexPatSep,lexSlashQuote,cInParen
  17.  
  18. " Abbreviations Section
  19. syn region lexAbbrvBlock    start="^\([a-zA-Z_]\+\t\|%{\)" end="^%%$"me=e-2    skipnl    nextgroup=lexPatBlock contains=lexAbbrv,lexInclude
  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.  
  25. "%% : Patterns {Actions}
  26. syn region lexPatBlock    matchgroup=Todo    start="^%%$" matchgroup=Todo end="^%%$"    skipnl skipwhite contains=lexPat,lexPatTag,lexPatComment
  27. syn region lexPat        start=+\S+ skip="\(\\\\\)*\\." end="\s"me=e-1 contained nextgroup=lexMorePat,lexPatSep contains=lexPatString,lexSlashQuote,lexBrace
  28. syn region lexBrace    start="\[" skip=+\(\\\\\)*\\+ end="]"            contained
  29. syn region lexPatString    matchgroup=String start=+"+ skip=+\(\\\\\)*\\"+ matchgroup=String end=+"+    contained
  30. syn match  lexPatTag    "^<\I\i*\(,\I\i*\)*>*"            contained nextgroup=lexPat,lexPatTag,lexMorePat,lexPatSep
  31. syn match  lexPatTag    +^<\I\i*\(,\I\i*\)*>*\(\\\\\)*\\"+        contained nextgroup=lexPat,lexPatTag,lexMorePat,lexPatSep
  32. syn region lexPatComment    start="^\s*/\*" end="\*/"        skipnl    contained contains=cTodo nextgroup=lexPatComment,lexPat,lexPatString,lexPatTag
  33. syn match  lexPatCodeLine    ".*$"                    contained contains=ALLBUT,@lexListGroup
  34. syn match  lexMorePat    "\s*|\s*$"            skipnl    contained nextgroup=lexPat,lexPatString,lexPatTag,lexPatComment
  35. syn match  lexPatSep    "\s\+"                    contained nextgroup=lexMorePat,lexPatCode,lexPatCodeLine
  36. syn match  lexSlashQuote    +\(\\\\\)*\\"+                contained
  37. syn region lexPatCode matchgroup=Delimiter start="{" matchgroup=Delimiter end="}"     skipnl contained contains=ALLBUT,@lexListPatCodeGroup
  38.  
  39. syn keyword ClexFunctions    BEGIN    input    unput    woutput    yyleng    yylook    yytext
  40. syn keyword ClexFunctions    ECHO    output    winput    wunput    yyless    yymore    yywrap
  41.  
  42. " <c.vim> includes several ALLBUTs; these have to be treated so as to exclude lex* groups
  43. syn cluster cParenGroup    add=lex.*
  44. syn cluster cDefineGroup    add=lex.*
  45. syn cluster cPreProcGroup    add=lex.*
  46. syn cluster cMultiGroup    add=lex.*
  47.  
  48. " Synchronization
  49. syn sync clear
  50. syn sync minlines=300
  51. syn sync match lexSyncPat    grouphere  lexPatBlock    "^%[a-zA-Z]"
  52. syn sync match lexSyncPat    groupthere lexPatBlock    "^<$"
  53. syn sync match lexSyncPat    groupthere lexPatBlock    "^%%$"
  54.  
  55. if !exists("did_lex_syntax_inits")
  56.   let did_lex_synax_inits = 1
  57.   hi link    lexSlashQuote    lexPat
  58.   hi link    lexBrace        lexPat
  59.  
  60.   hi link    ClexFunctions    Function
  61.   hi link    lexAbbrv        SpecialChar
  62.   hi link    lexAbbrvRegExp    Macro
  63.   hi link    lexMorePat    SpecialChar
  64.   hi link    lexPat        Function
  65.   hi link    lexPatComment    Comment
  66.   hi link    lexPatString    Function
  67.   hi link    lexPatTag        Special
  68.   hi link    lexSep        Delimiter
  69. endif
  70.  
  71. let b:current_syntax = "lex"
  72.  
  73. " vim:ts=10
  74.