psf.vim 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. " Vim syntax file
  2. " Language: Software Distributor product specification file
  3. " (POSIX 1387.2-1995).
  4. " Maintainer: Rex Barzee <rex_barzee@hp.com>
  5. " Last change: 25 Apr 2001
  6. " quit when a syntax file was already loaded
  7. if exists("b:current_syntax")
  8. finish
  9. endif
  10. " Product specification files are case sensitive
  11. syn case match
  12. syn keyword psfObject bundle category control_file depot distribution
  13. syn keyword psfObject end file fileset host installed_software media
  14. syn keyword psfObject product root subproduct vendor
  15. syn match psfUnquotString +[^"# ][^#]*+ contained
  16. syn region psfQuotString start=+"+ skip=+\\"+ end=+"+ contained
  17. syn match psfObjTag "\<[-_+A-Z0-9a-z]\+\(\.[-_+A-Z0-9a-z]\+\)*" contained
  18. syn match psfAttAbbrev ",\<\(fa\|fr\|[aclqrv]\)\(<\|>\|<=\|>=\|=\|==\)[^,]\+" contained
  19. syn match psfObjTags "\<[-_+A-Z0-9a-z]\+\(\.[-_+A-Z0-9a-z]\+\)*\(\s\+\<[-_+A-Z0-9a-z]\+\(\.[-_+A-Z0-9a-z]\+\)*\)*" contained
  20. syn match psfNumber "\<\d\+\>" contained
  21. syn match psfFloat "\<\d\+\>\(\.\<\d\+\>\)*" contained
  22. syn match psfLongDate "\<\d\d\d\d\d\d\d\d\d\d\d\d\.\d\d\>" contained
  23. syn keyword psfState available configured corrupt installed transient contained
  24. syn keyword psfPState applied committed superseded contained
  25. syn keyword psfBoolean false true contained
  26. "Some of the attributes covered by attUnquotString and attQuotString:
  27. " architecture category_tag control_directory copyright
  28. " create_date description directory file_permissions install_source
  29. " install_type location machine_type mod_date number os_name os_release
  30. " os_version pose_as_os_name pose_as_os_release readme revision
  31. " share_link title vendor_tag
  32. syn region psfAttUnquotString matchgroup=psfAttrib start=~^\s*[^# ]\+\s\+[^#" ]~rs=e-1 contains=psfUnquotString,psfComment end=~$~ keepend oneline
  33. syn region psfAttQuotString matchgroup=psfAttrib start=~^\s*[^# ]\+\s\+"~rs=e-1 contains=psfQuotString,psfComment skip=~\\"~ matchgroup=psfQuotString end=~"~ keepend
  34. " These regions are defined in attempt to do syntax checking for some
  35. " of the attributes.
  36. syn region psfAttTag matchgroup=psfAttrib start="^\s*tag\s\+" contains=psfObjTag,psfComment end="$" keepend oneline
  37. syn region psfAttSpec matchgroup=psfAttrib start="^\s*\(ancestor\|applied_patches\|applied_to\|contents\|corequisites\|exrequisites\|prerequisites\|software_spec\|supersedes\|superseded_by\)\s\+" contains=psfObjTag,psfAttAbbrev,psfComment end="$" keepend
  38. syn region psfAttTags matchgroup=psfAttrib start="^\s*all_filesets\s\+" contains=psfObjTags,psfComment end="$" keepend
  39. syn region psfAttNumber matchgroup=psfAttrib start="^\s*\(compressed_size\|instance_id\|media_sequence_number\|sequence_number\|size\)\s\+" contains=psfNumber,psfComment end="$" keepend oneline
  40. syn region psfAttTime matchgroup=psfAttrib start="^\s*\(create_time\|ctime\|mod_time\|mtime\|timestamp\)\s\+" contains=psfNumber,psfComment end="$" keepend oneline
  41. syn region psfAttFloat matchgroup=psfAttrib start="^\s*\(data_model_revision\|layout_version\)\s\+" contains=psfFloat,psfComment end="$" keepend oneline
  42. syn region psfAttLongDate matchgroup=psfAttrib start="^\s*install_date\s\+" contains=psfLongDate,psfComment end="$" keepend oneline
  43. syn region psfAttState matchgroup=psfAttrib start="^\s*\(state\)\s\+" contains=psfState,psfComment end="$" keepend oneline
  44. syn region psfAttPState matchgroup=psfAttrib start="^\s*\(patch_state\)\s\+" contains=psfPState,psfComment end="$" keepend oneline
  45. syn region psfAttBoolean matchgroup=psfAttrib start="^\s*\(is_kernel\|is_locatable\|is_patch\|is_protected\|is_reboot\|is_reference\|is_secure\|is_sparse\)\s\+" contains=psfBoolean,psfComment end="$" keepend oneline
  46. syn match psfComment "#.*$"
  47. " Define the default highlighting.
  48. " Only when an item doesn't have highlighting yet
  49. hi def link psfObject Statement
  50. hi def link psfAttrib Type
  51. hi def link psfQuotString String
  52. hi def link psfObjTag Identifier
  53. hi def link psfAttAbbrev PreProc
  54. hi def link psfObjTags Identifier
  55. hi def link psfComment Comment
  56. " Long descriptions and copyrights confuse the syntax highlighting, so
  57. " force vim to backup at least 100 lines before the top visible line
  58. " looking for a sync location.
  59. syn sync lines=100
  60. let b:current_syntax = "psf"