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

  1. " Filename:    spec.vim
  2. " Purpose:    Vim syntax file
  3. " Language:    SPEC: Build/install scripts for Linux RPM packages
  4. " Maintainer:    Donovan Rebbechi elflord@pegasus.rutgers.edu
  5. " URL:        http://pegasus.rutgers.edu/~elflord/vim/syntax/spec.vim
  6. " Last change:    Tue Aug  4 23:25:43 EDT 1998
  7.  
  8. syn clear
  9.  
  10.  
  11. syn region specDeref         start="\${" end="}" contains=specSpecialVariables,specSpecialChar
  12. syn match  specDeref         "\$\<[a-zA-Z_][a-zA-Z0-9_]*\>" contains=specSpecialVariables,specSpecialChar
  13.  
  14. syn match specSpecialChar +[][!\$()\\|>^;:{}]+
  15. syn match specColon contained ':'
  16.  
  17. syn match specSpecialVariables '\$[0-9]\|\${[0-9]}'
  18.  
  19. syn match specInstallOption contained '-[ogmd]' 
  20. syn match specNoNumberHilite 'X11\|X11R6\|[a-zA-Z]*\.\d\|[a-zA-Z][-/]\d'
  21. syn match specManpageFile '[a-zA-Z]\.1'
  22.  
  23. syn case ignore
  24.  
  25. "rudimentary macros with little-nothing in the way of scripts inside them
  26. syn region specMacroBody matchgroup=specMacro  start='%changelog\|%description\|%patch' end='^%'me=e-1 contains=specEmail,specURL,specWeekday,specMonth,specNumber
  27. syn region specMacroBody2 matchgroup=specMacro  start='%define\|%vendor\|%distribution' end='$' oneline
  28.  
  29.  
  30. "PreAmble
  31. syn region specPreAmble matchgroup=specCommand start='^\(Prereq\|Summary\|Name\|Version\|Packager\|Requires\|Icon\|URL\|Source\d*\|Patch\d*\|Prefix\|Packager\|Group\|Copyright\|Release\|BuildRoot\|Distribution\|Vendor\|Provides\|ExclusiveArch\|ExclusiveOS\|Serial\)' end='$' contains=specEmail,specURL,specSpecial,specColon oneline
  32.  
  33. syn region specPackage matchgroup=specMacro start='%package' end='^%'me=e-1 contains=specPreAmble
  34. " sections that contain a lot of scripts
  35. syn region specScriptMacro  matchgroup=specMacro start='%setup\|%install\|%postun\|%post\|%prep\|%pre\|%build\|%clean' end='^%'me=e-1 contains=specSpecialVariables,@specCommands,specDeref,shDo,shFor,shCaseEsac,specNoNumberHilite,specCommandOpts,specComment,specIf,specSpecialChar
  36.  
  37. syn case match
  38.  
  39. syn match specURL '\(ftp\|http\)://[^ \t]*' 
  40. syn match specWeekday 'Mon\|Tue\|Wed\|Thu\|Fri\|Sat\|Sun'
  41. syn match specMonth 'January\|February\|March\|April\|May\|June\|July\|August\|September\|October\|November\|December\|Jan\|Feb\|Mar\|Apr\|Jun\|Jul\|Aug\|Sep\|Oct\|Nov\\Dec'
  42. syn match specNumber +^-\=[0-9.-]*[0-9]\|[ \t]-\=[0-9.-]*[0-9]\|-[0-9.-]*[0-9]+
  43. syn match specListedFilesPrefix        contained '/usr/\|/local/\|/opt/\|/X11R6/\|/X11/'me=e-1 
  44. syn match specListedFilesBin        contained '/bin/\|/sbin/'me=e-1
  45. syn match speclistedFilesLib        contained '/lib/\|/include/'me=e-1
  46. syn match specListedFilesDoc        contained '/man\d*\|/doc\|/info'
  47. syn match specListedFilesEtc        contained '/etc/'me=e-1
  48. syn match specListedFilesShare    contained '/share/'me=e-1
  49.  
  50. syn cluster specListedFiles contains=specListedFilesBin,specListedFilesLib,specListedFilesDoc,specListedFilesEtc,specListedFilesShare,specListedFilesPrefix
  51.  
  52. syn region specFiles matchgroup=specMacro start='^%[Ff]iles' start='^%[Cc]onfig' start='%[Dd]oc' skip='%attr\|%dir\|%config\|%doc' end='^%'me=e-1 contains=@specListedFiles,specFilesMacro
  53.  
  54. syn match specFilesMacro '%attrib\|%attr\|%dir\|%config\|%doc'
  55.  
  56. syn match specEmail '<[a-zA-Z0-9\-_]*\@.*>'
  57.  
  58. syn match specCommandOpts '[ \t]--\=[a-zA-Z-]\+' 
  59.  
  60. syn match specConfigure '\./configure'
  61. syn match specTarCommand 'tar[ \t]*[xvzf]\{,5}[ \t]'
  62. syn cluster specCommands contains=specCommand,specTarCommand,specConfigureCommand,specCommandSpecial
  63.  
  64. syn keyword specSpecialVariables    RPM_BUILD_ROOT RPM_SOURCE_DIR RPM_OPT_FLAGS LDFLAGS CC CC_FLAGS CPPNAME CFLAGS
  65.  
  66. syn keyword specCommand    make xmkmf mkdir  chmod ln find sed rm strip moc echo grep ls rm mv mkdir install cp pwd cat tail then else cd gzip rmdir ln
  67. syn keyword specSpecial        GPL Makefile  LGPL
  68. syn keyword specCommandSpecial root
  69.  
  70. syn region specComment start='#' end='$'
  71. syn region  shDo transparent matchgroup=specBlock start="\<do\>" end="\<done\>" contains=ALLBUT,shFunction,shDoError,shCase,specPreAmble,@specListedFiles
  72. syn region  shIf transparent matchgroup=specBlock start="\<if\>" end="\<fi\>" contains=ALLBUT,shFunction,shIfError,shCase,@specListedFiles
  73.  
  74. syn region  shFor  matchgroup=specBlock start="\<for\>" end="\<in\>" contains=ALLBUT,shFunction,shInError,shCase,@specListedFiles
  75.  
  76. syn region shCaseEsac transparent matchgroup=specBlock start="\<case\>" matchgroup=NONE end="\<in\>"me=s-1 contains=ALLBUT,shFunction,shCaseError,@specListedFiles nextgroup=shCaseEsac
  77. syn region shCaseEsac matchgroup=specBlock start="\<in\>" end="\<esac\>" contains=ALLBUT,shFunction,shCaseError,@specListedFilesBin
  78. syn region shCase matchgroup=specBlock contained start=")"  end=";;" contains=ALLBUT,shFunction,shCaseError,shCase,@specListedFiles
  79.  
  80.  
  81. syn sync match shDoSync       grouphere  shDo       "\<do\>"
  82. syn sync match shDoSync       groupthere shDo       "\<done\>"
  83. syn sync match shIfSync       grouphere  shIf       "\<if\>"
  84. syn sync match shIfSync       groupthere shIf       "\<fi\>"
  85. syn sync match shForSync      grouphere  shFor      "\<for\>"
  86. syn sync match shForSync      groupthere shFor      "\<in\>"
  87. syn sync match shCaseEsacSync grouphere  shCaseEsac "\<case\>"
  88. syn sync match shCaseEsacSync groupthere shCaseEsac "\<esac\>"
  89.  
  90. if !exists("did_spec_syntax_inits")
  91.     let did_spec_syntax_inits = 1
  92.     " The default methods for highlighting. Can be overridden later.
  93.  
  94.  
  95.       hi link specBlock            Function
  96.       hi link specColon            Special
  97.       hi link specCommand            Statement
  98.       hi link specCommandOpts        Operator
  99.       hi link specCommandSpecial        Special
  100.       hi link specComment            Comment
  101.       hi link specConfigure            specCommand
  102.       hi link specDate            String
  103.       hi link specDeref            Identifier
  104.       hi link specDescription        NONE
  105.       hi link specEmail            String
  106.       hi link specFiles            NONE
  107.       hi link specFilesMacro        Identifier
  108.       hi link specInstallOption        Operator
  109.       hi link specMacro            Identifier
  110.       hi link specMacroHeading        Identifier
  111.       hi link specManpageFile        NONE
  112.       hi link specMonth specDate
  113.       hi link specNoNumberHilite        NONE
  114.       hi link specNumber            String
  115.       hi link specSpecial            String
  116.       hi link specSpecialChar        Special
  117.       hi link specSpecialVariables        Identifier
  118.       hi link specTarCommand        specCommand
  119.       hi link specURL                String
  120.       hi link specWeekday specDate
  121.       hi specListedFilesBin        ctermfg=DarkGreen gui=bold guifg=DarkGreen
  122.       hi specListedFilesDoc        ctermfg=blue guifg=Blue
  123.       hi specListedFilesEtc        ctermfg=Cyan guifg=Cyan
  124.       hi specListedFilesLib        ctermfg=DarkGreen guifg=Brown
  125.       hi specListedFilesPrefix    ctermfg=magenta gui=bold guifg=#aa4444
  126.       hi specListedFilesShare    ctermfg=lightred guifg=LightRed
  127.   endif
  128.  
  129. let b:current_syntax = "spec"
  130.  
  131. " vim: ts=8
  132.