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

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