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 / runtime / dos / syntax / spup.vim < prev    next >
Encoding:
Text File  |  2012-05-31  |  14.2 KB  |  283 lines

  1. " Vim syntax file
  2. " Language:     Speedup, plant simulator from AspenTech
  3. " Maintainer:   Stefan.Schwarzer <s.schwarzer@ndh.net>
  4. " URL:        http://www.ndh.net/home/sschwarzer/download/spup.vim
  5. " Last Change:  2012 Feb 03 by Thilo Six
  6. " Filename:     spup.vim
  7.  
  8. " Bugs
  9. " - in the appropriate sections keywords are always highlighted
  10. "   even if they are not used with the appropriate meaning;
  11. "   example: in
  12. "       MODEL demonstration
  13. "       TYPE
  14. "      *area AS area
  15. "   both "area" are highlighted as spupType.
  16. "
  17. " If you encounter problems or have questions or suggestions, mail me
  18.  
  19. " Remove old syntax stuff
  20. " For version 5.x: Clear all syntax items
  21. " For version 6.x: Quit when a syntax file was already loaded
  22. if version < 600
  23.     syntax clear
  24. elseif exists("b:current_syntax")
  25.     finish
  26. endif
  27.  
  28. let s:cpo_save = &cpo
  29. set cpo&vim
  30.  
  31. " don't hightlight several keywords like subsections
  32. "let strict_subsections = 1
  33.  
  34. " highlight types usually found in DECLARE section
  35. if !exists("hightlight_types")
  36.     let highlight_types = 1
  37. endif
  38.  
  39. " one line comment syntax (# comments)
  40. " 1. allow appended code after comment, do not complain
  41. " 2. show code beginnig with the second # as an error
  42. " 3. show whole lines with more than one # as an error
  43. if !exists("oneline_comments")
  44.     let oneline_comments = 2
  45. endif
  46.  
  47. " Speedup SECTION regions
  48. syn case ignore
  49. syn region spupCdi      matchgroup=spupSection start="^CDI"         end="^\*\*\*\*" contains=spupCdiSubs,@spupOrdinary
  50. syn region spupConditions matchgroup=spupSection start="^CONDITIONS" end="^\*\*\*\*" contains=spupConditionsSubs,@spupOrdinary,spupConditional,spupOperator,spupCode
  51. syn region spupDeclare    matchgroup=spupSection start="^DECLARE"    end="^\*\*\*\*" contains=spupDeclareSubs,@spupOrdinary,spupTypes,spupCode
  52. syn region spupEstimation matchgroup=spupSection start="^ESTIMATION" end="^\*\*\*\*" contains=spupEstimationSubs,@spupOrdinary
  53. syn region spupExternal   matchgroup=spupSection start="^EXTERNAL"   end="^\*\*\*\*" contains=spupExternalSubs,@spupOrdinary
  54. syn region spupFlowsheet  matchgroup=spupSection start="^FLOWSHEET"  end="^\*\*\*\*" contains=spupFlowsheetSubs,@spupOrdinary,spupStreams,@spupTextproc
  55. syn region spupFunction   matchgroup=spupSection start="^FUNCTION"   end="^\*\*\*\*" contains=spupFunctionSubs,@spupOrdinary,spupHelp,spupCode,spupTypes
  56. syn region spupGlobal     matchgroup=spupSection start="^GLOBAL"     end="^\*\*\*\*" contains=spupGlobalSubs,@spupOrdinary
  57. syn region spupHomotopy   matchgroup=spupSection start="^HOMOTOPY"   end="^\*\*\*\*" contains=spupHomotopySubs,@spupOrdinary
  58. syn region spupMacro      matchgroup=spupSection start="^MACRO"      end="^\*\*\*\*" contains=spupMacroSubs,@spupOrdinary,@spupTextproc,spupTypes,spupStreams,spupOperator
  59. syn region spupModel      matchgroup=spupSection start="^MODEL"      end="^\*\*\*\*" contains=spupModelSubs,@spupOrdinary,spupConditional,spupOperator,spupTypes,spupStreams,@spupTextproc,spupHelp
  60. syn region spupOperation  matchgroup=spupSection start="^OPERATION"  end="^\*\*\*\*" contains=spupOperationSubs,@spupOrdinary,@spupTextproc
  61. syn region spupOptions    matchgroup=spupSection start="^OPTIONS"    end="^\*\*\*\*" contains=spupOptionsSubs,@spupOrdinary
  62. syn region spupProcedure  matchgroup=spupSection start="^PROCEDURE"  end="^\*\*\*\*" contains=spupProcedureSubs,@spupOrdinary,spupHelp,spupCode,spupTypes
  63. syn region spupProfiles   matchgroup=spupSection start="^PROFILES"   end="^\*\*\*\*" contains=@spupOrdinary,@spupTextproc
  64. syn region spupReport     matchgroup=spupSection start="^REPORT"     end="^\*\*\*\*" contains=spupReportSubs,@spupOrdinary,spupHelp,@spupTextproc
  65. syn region spupTitle      matchgroup=spupSection start="^TITLE"      end="^\*\*\*\*" contains=spupTitleSubs,spupComment,spupConstant,spupError
  66. syn region spupUnit       matchgroup=spupSection start="^UNIT"       end="^\*\*\*\*" contains=spupUnitSubs,@spupOrdinary
  67.  
  68. " Subsections
  69. syn keyword spupCdiSubs           INPUT FREE OUTPUT LINEARTIME MINNONZERO CALCULATE FILES SCALING contained
  70. syn keyword spupDeclareSubs    TYPE STREAM contained
  71. syn keyword spupEstimationSubs ESTIMATE SSEXP DYNEXP RESULT contained
  72. syn keyword spupExternalSubs   TRANSMIT RECEIVE contained
  73. syn keyword spupFlowsheetSubs  STREAM contained
  74. syn keyword spupFunctionSubs   INPUT OUTPUT contained
  75. syn keyword spupGlobalSubs     VARIABLES MAXIMIZE MINIMIZE CONSTRAINT contained
  76. syn keyword spupHomotopySubs   VARY OPTIONS contained
  77. syn keyword spupMacroSubs      MODEL FLOWSHEET contained
  78. syn keyword spupModelSubs      CATEGORY SET TYPE STREAM EQUATION PROCEDURE contained
  79. syn keyword spupOperationSubs  SET PRESET INITIAL SSTATE FREE contained
  80. syn keyword spupOptionsSubs    ROUTINES TRANSLATE EXECUTION contained
  81. syn keyword spupProcedureSubs  INPUT OUTPUT SPACE PRECALL POSTCALL DERIVATIVE STREAM contained
  82. " no subsections for Profiles
  83. syn keyword spupReportSubs     SET INITIAL FIELDS FIELDMARK DISPLAY WITHIN contained
  84. syn keyword spupUnitSubs       ROUTINES SET contained
  85.  
  86. " additional keywords for subsections
  87. if !exists( "strict_subsections" )
  88.     syn keyword spupConditionsSubs STOP PRINT contained
  89.     syn keyword spupDeclareSubs    UNIT SET COMPONENTS THERMO OPTIONS contained
  90.     syn keyword spupEstimationSubs VARY MEASURE INITIAL contained
  91.     syn keyword spupFlowsheetSubs  TYPE FEED PRODUCT INPUT OUTPUT CONNECTION OF IS contained
  92.     syn keyword spupMacroSubs      CONNECTION STREAM SET INPUT OUTPUT OF IS FEED PRODUCT TYPE contained
  93.     syn keyword spupModelSubs      AS ARRAY OF INPUT OUTPUT CONNECTION contained
  94.     syn keyword spupOperationSubs  WITHIN contained
  95.     syn keyword spupReportSubs     LEFT RIGHT CENTER CENTRE UOM TIME DATE VERSION RELDATE contained
  96.     syn keyword spupUnitSubs       IS A contained
  97. endif
  98.  
  99. " Speedup data types
  100. if exists( "highlight_types" )
  101.     syn keyword spupTypes act_coeff_liq area coefficient concentration contained
  102.     syn keyword spupTypes control_signal cond_liq cond_vap cp_mass_liq contained
  103.     syn keyword spupTypes cp_mol_liq cp_mol_vap cv_mol_liq cv_mol_vap contained
  104.     syn keyword spupTypes diffus_liq diffus_vap delta_p dens_mass contained
  105.     syn keyword spupTypes dens_mass_sol dens_mass_liq dens_mass_vap dens_mol contained
  106.     syn keyword spupTypes dens_mol_sol dens_mol_liq dens_mol_vap enthflow contained
  107.     syn keyword spupTypes enth_mass enth_mass_liq enth_mass_vap enth_mol contained
  108.     syn keyword spupTypes enth_mol_sol enth_mol_liq enth_mol_vap entr_mol contained
  109.     syn keyword spupTypes entr_mol_sol entr_mol_liq entr_mol_vap fraction contained
  110.     syn keyword spupTypes flow_mass flow_mass_liq flow_mass_vap flow_mol contained
  111.     syn keyword spupTypes flow_mol_vap flow_mol_liq flow_vol flow_vol_vap contained
  112.     syn keyword spupTypes flow_vol_liq fuga_vap fuga_liq fuga_sol contained
  113.     syn keyword spupTypes gibb_mol_sol heat_react heat_trans_coeff contained
  114.     syn keyword spupTypes holdup_heat holdup_heat_liq holdup_heat_vap contained
  115.     syn keyword spupTypes holdup_mass holdup_mass_liq holdup_mass_vap contained
  116.     syn keyword spupTypes holdup_mol holdup_mol_liq holdup_mol_vap k_value contained
  117.     syn keyword spupTypes length length_delta length_short liqfraction contained
  118.     syn keyword spupTypes liqmassfraction mass massfraction molefraction contained
  119.     syn keyword spupTypes molweight moment_inertia negative notype percent contained
  120.     syn keyword spupTypes positive pressure press_diff press_drop press_rise contained
  121.     syn keyword spupTypes ratio reaction reaction_mass rotation surf_tens contained
  122.     syn keyword spupTypes temperature temperature_abs temp_diff temp_drop contained
  123.     syn keyword spupTypes temp_rise time vapfraction vapmassfraction contained
  124.     syn keyword spupTypes velocity visc_liq visc_vap volume zmom_rate contained
  125.     syn keyword spupTypes seg_rate smom_rate tmom_rate zmom_mass seg_mass contained
  126.     syn keyword spupTypes smom_mass tmom_mass zmom_holdup seg_holdup contained
  127.     syn keyword spupTypes smom_holdup tmom_holdup contained
  128. endif
  129.  
  130. " stream types
  131. syn keyword spupStreams  mainstream vapour liquid contained
  132.  
  133. " "conditional" keywords
  134. syn keyword spupConditional  IF THEN ELSE ENDIF contained
  135. " Operators, symbols etc.
  136. syn keyword spupOperator  AND OR NOT contained
  137. syn match spupSymbol  "[,\-+=:;*/\"<>@%()]" contained
  138. syn match spupSpecial  "[&\$?]" contained
  139. " Surprisingly, Speedup allows no unary + instead of the -
  140. syn match spupError  "[(=+\-*/]\s*+\d\+\([ed][+-]\=\d\+\)\=\>"lc=1 contained
  141. syn match spupError  "[(=+\-*/]\s*+\d\+\.\([ed][+-]\=\d\+\)\=\>"lc=1 contained
  142. syn match spupError  "[(=+\-*/]\s*+\d*\.\d\+\([ed][+-]\=\d\+\)\=\>"lc=1 contained
  143. " String
  144. syn region spupString  start=+"+  end=+"+  oneline contained
  145. syn region spupString  start=+'+  end=+'+  oneline contained
  146. " Identifier
  147. syn match spupIdentifier  "\<[a-z][a-z0-9_]*\>" contained
  148. " Textprocessor directives
  149. syn match spupTextprocGeneric  "?[a-z][a-z0-9_]*\>" contained
  150. syn region spupTextprocError matchgroup=spupTextprocGeneric start="?ERROR"  end="?END"he=s-1 contained
  151. " Number, without decimal point
  152. syn match spupNumber  "-\=\d\+\([ed][+-]\=\d\+\)\=" contained
  153. " Number, allows 1. before exponent
  154. syn match spupNumber  "-\=\d\+\.\([ed][+-]\=\d\+\)\=" contained
  155. " Number allows .1 before exponent
  156. syn match spupNumber  "-\=\d*\.\d\+\([ed][+-]\=\d\+\)\=" contained
  157. " Help subsections
  158. syn region spupHelp  start="^HELP"hs=e+1  end="^\$ENDHELP"he=s-1 contained
  159. " Fortran code
  160. syn region spupCode  start="^CODE"hs=e+1  end="^\$ENDCODE"he=s-1 contained
  161. " oneline comments
  162. if oneline_comments > 3
  163.     oneline_comments = 2   " default
  164. endif
  165. if oneline_comments == 1
  166.     syn match spupComment  "#[^#]*#\="
  167. elseif oneline_comments == 2
  168.     syn match spupError  "#.*$"
  169.     syn match spupComment  "#[^#]*"  nextgroup=spupError
  170. elseif oneline_comments == 3
  171.     syn match spupComment  "#[^#]*"
  172.     syn match spupError  "#[^#]*#.*"
  173. endif
  174. " multiline comments
  175. syn match spupOpenBrace "{" contained
  176. syn match spupError  "}"
  177. syn region spupComment  matchgroup=spupComment2  start="{"  end="}"  keepend  contains=spupOpenBrace
  178.  
  179. syn cluster spupOrdinary  contains=spupNumber,spupIdentifier,spupSymbol
  180. syn cluster spupOrdinary  add=spupError,spupString,spupComment
  181. syn cluster spupTextproc  contains=spupTextprocGeneric,spupTextprocError
  182.  
  183. " define syncronizing; especially OPERATION sections can become very large
  184. syn sync clear
  185. syn sync minlines=100
  186. syn sync maxlines=500
  187.  
  188. syn sync match spupSyncOperation  grouphere spupOperation  "^OPERATION"
  189. syn sync match spupSyncCdi      grouphere spupCdi       "^CDI"
  190. syn sync match spupSyncConditions grouphere spupConditions "^CONDITIONS"
  191. syn sync match spupSyncDeclare    grouphere spupDeclare    "^DECLARE"
  192. syn sync match spupSyncEstimation grouphere spupEstimation "^ESTIMATION"
  193. syn sync match spupSyncExternal   grouphere spupExternal   "^EXTERNAL"
  194. syn sync match spupSyncFlowsheet  grouphere spupFlowsheet  "^FLOWSHEET"
  195. syn sync match spupSyncFunction   grouphere spupFunction   "^FUNCTION"
  196. syn sync match spupSyncGlobal     grouphere spupGlobal     "^GLOBAL"
  197. syn sync match spupSyncHomotopy   grouphere spupHomotopy   "^HOMOTOPY"
  198. syn sync match spupSyncMacro      grouphere spupMacro      "^MACRO"
  199. syn sync match spupSyncModel      grouphere spupModel      "^MODEL"
  200. syn sync match spupSyncOperation  grouphere spupOperation  "^OPERATION"
  201. syn sync match spupSyncOptions    grouphere spupOptions    "^OPTIONS"
  202. syn sync match spupSyncProcedure  grouphere spupProcedure  "^PROCEDURE"
  203. syn sync match spupSyncProfiles   grouphere spupProfiles   "^PROFILES"
  204. syn sync match spupSyncReport     grouphere spupReport     "^REPORT"
  205. syn sync match spupSyncTitle      grouphere spupTitle      "^TITLE"
  206. syn sync match spupSyncUnit       grouphere spupUnit       "^UNIT"
  207.  
  208. " Define the default highlighting.
  209. " For version 5.7 and earlier: only when not done already
  210. " For version 5.8 and later: only when an item doesn't have highlighting yet
  211. if version >= 508 || !exists("did_spup_syn_inits")
  212.     if version < 508
  213.     let did_spup_syn_inits = 1
  214.     command -nargs=+ HiLink hi link <args>
  215.     else
  216.     command -nargs=+ HiLink hi def link <args>
  217.     endif
  218.  
  219.     HiLink spupCdi        spupSection
  220.     HiLink spupConditions   spupSection
  221.     HiLink spupDeclare        spupSection
  222.     HiLink spupEstimation   spupSection
  223.     HiLink spupExternal        spupSection
  224.     HiLink spupFlowsheet    spupSection
  225.     HiLink spupFunction        spupSection
  226.     HiLink spupGlobal        spupSection
  227.     HiLink spupHomotopy        spupSection
  228.     HiLink spupMacro        spupSection
  229.     HiLink spupModel        spupSection
  230.     HiLink spupOperation    spupSection
  231.     HiLink spupOptions        spupSection
  232.     HiLink spupProcedure    spupSection
  233.     HiLink spupProfiles        spupSection
  234.     HiLink spupReport        spupSection
  235.     HiLink spupTitle        spupConstant  " this is correct, truly ;)
  236.     HiLink spupUnit        spupSection
  237.  
  238.     HiLink spupCdiSubs          spupSubs
  239.     HiLink spupConditionsSubs spupSubs
  240.     HiLink spupDeclareSubs    spupSubs
  241.     HiLink spupEstimationSubs spupSubs
  242.     HiLink spupExternalSubs   spupSubs
  243.     HiLink spupFlowsheetSubs  spupSubs
  244.     HiLink spupFunctionSubs   spupSubs
  245.     HiLink spupHomotopySubs   spupSubs
  246.     HiLink spupMacroSubs      spupSubs
  247.     HiLink spupModelSubs      spupSubs
  248.     HiLink spupOperationSubs  spupSubs
  249.     HiLink spupOptionsSubs    spupSubs
  250.     HiLink spupProcedureSubs  spupSubs
  251.     HiLink spupReportSubs     spupSubs
  252.     HiLink spupUnitSubs          spupSubs
  253.  
  254.     HiLink spupCode           Normal
  255.     HiLink spupComment           Comment
  256.     HiLink spupComment2           spupComment
  257.     HiLink spupConditional     Statement
  258.     HiLink spupConstant           Constant
  259.     HiLink spupError           Error
  260.     HiLink spupHelp           Normal
  261.     HiLink spupIdentifier      Identifier
  262.     HiLink spupNumber           Constant
  263.     HiLink spupOperator           Special
  264.     HiLink spupOpenBrace       spupError
  265.     HiLink spupSection           Statement
  266.     HiLink spupSpecial           spupTextprocGeneric
  267.     HiLink spupStreams           Type
  268.     HiLink spupString           Constant
  269.     HiLink spupSubs           Statement
  270.     HiLink spupSymbol           Special
  271.     HiLink spupTextprocError   Normal
  272.     HiLink spupTextprocGeneric PreProc
  273.     HiLink spupTypes           Type
  274.  
  275.     delcommand HiLink
  276. endif
  277.  
  278. let b:current_syntax = "spup"
  279.  
  280. let &cpo = s:cpo_save
  281. unlet s:cpo_save
  282. " vim:ts=8
  283.