codekingpro/portable-devtools
114k
1" Vim syntax file2" Language: Speedup, plant simulator from AspenTech3" Maintainer: Stefan.Schwarzer <s.schwarzer@ndh.net>4" URL: http://www.ndh.net/home/sschwarzer/download/spup.vim5" Last Change: 2012 Feb 03 by Thilo Six6" Filename: spup.vim7 8" Bugs9" - in the appropriate sections keywords are always highlighted10" even if they are not used with the appropriate meaning;11" example: in12" MODEL demonstration13" TYPE14" *area AS area15" both "area" are highlighted as spupType.16"17" If you encounter problems or have questions or suggestions, mail me18 19" Remove old syntax stuff20" quit when a syntax file was already loaded21if exists("b:current_syntax")22 finish23endif24 25let s:cpo_save = &cpo26set cpo&vim27 28" don't highlight several keywords like subsections29"let strict_subsections = 130 31" highlight types usually found in DECLARE section32if !exists("highlight_types")33 let highlight_types = 134endif35 36" one line comment syntax (# comments)37" 1. allow appended code after comment, do not complain38" 2. show code beginning with the second # as an error39" 3. show whole lines with more than one # as an error40if !exists("oneline_comments")41 let oneline_comments = 242endif43 44" Speedup SECTION regions45syn case ignore46syn region spupCdi matchgroup=spupSection start="^CDI" end="^\*\*\*\*" contains=spupCdiSubs,@spupOrdinary47syn region spupConditions matchgroup=spupSection start="^CONDITIONS" end="^\*\*\*\*" contains=spupConditionsSubs,@spupOrdinary,spupConditional,spupOperator,spupCode48syn region spupDeclare matchgroup=spupSection start="^DECLARE" end="^\*\*\*\*" contains=spupDeclareSubs,@spupOrdinary,spupTypes,spupCode49syn region spupEstimation matchgroup=spupSection start="^ESTIMATION" end="^\*\*\*\*" contains=spupEstimationSubs,@spupOrdinary50syn region spupExternal matchgroup=spupSection start="^EXTERNAL" end="^\*\*\*\*" contains=spupExternalSubs,@spupOrdinary51syn region spupFlowsheet matchgroup=spupSection start="^FLOWSHEET" end="^\*\*\*\*" contains=spupFlowsheetSubs,@spupOrdinary,spupStreams,@spupTextproc52syn region spupFunction matchgroup=spupSection start="^FUNCTION" end="^\*\*\*\*" contains=spupFunctionSubs,@spupOrdinary,spupHelp,spupCode,spupTypes53syn region spupGlobal matchgroup=spupSection start="^GLOBAL" end="^\*\*\*\*" contains=spupGlobalSubs,@spupOrdinary54syn region spupHomotopy matchgroup=spupSection start="^HOMOTOPY" end="^\*\*\*\*" contains=spupHomotopySubs,@spupOrdinary55syn region spupMacro matchgroup=spupSection start="^MACRO" end="^\*\*\*\*" contains=spupMacroSubs,@spupOrdinary,@spupTextproc,spupTypes,spupStreams,spupOperator56syn region spupModel matchgroup=spupSection start="^MODEL" end="^\*\*\*\*" contains=spupModelSubs,@spupOrdinary,spupConditional,spupOperator,spupTypes,spupStreams,@spupTextproc,spupHelp57syn region spupOperation matchgroup=spupSection start="^OPERATION" end="^\*\*\*\*" contains=spupOperationSubs,@spupOrdinary,@spupTextproc58syn region spupOptions matchgroup=spupSection start="^OPTIONS" end="^\*\*\*\*" contains=spupOptionsSubs,@spupOrdinary59syn region spupProcedure matchgroup=spupSection start="^PROCEDURE" end="^\*\*\*\*" contains=spupProcedureSubs,@spupOrdinary,spupHelp,spupCode,spupTypes60syn region spupProfiles matchgroup=spupSection start="^PROFILES" end="^\*\*\*\*" contains=@spupOrdinary,@spupTextproc61syn region spupReport matchgroup=spupSection start="^REPORT" end="^\*\*\*\*" contains=spupReportSubs,@spupOrdinary,spupHelp,@spupTextproc62syn region spupTitle matchgroup=spupSection start="^TITLE" end="^\*\*\*\*" contains=spupTitleSubs,spupComment,spupConstant,spupError63syn region spupUnit matchgroup=spupSection start="^UNIT" end="^\*\*\*\*" contains=spupUnitSubs,@spupOrdinary64 65" Subsections66syn keyword spupCdiSubs INPUT FREE OUTPUT LINEARTIME MINNONZERO CALCULATE FILES SCALING contained67syn keyword spupDeclareSubs TYPE STREAM contained68syn keyword spupEstimationSubs ESTIMATE SSEXP DYNEXP RESULT contained69syn keyword spupExternalSubs TRANSMIT RECEIVE contained70syn keyword spupFlowsheetSubs STREAM contained71syn keyword spupFunctionSubs INPUT OUTPUT contained72syn keyword spupGlobalSubs VARIABLES MAXIMIZE MINIMIZE CONSTRAINT contained73syn keyword spupHomotopySubs VARY OPTIONS contained74syn keyword spupMacroSubs MODEL FLOWSHEET contained75syn keyword spupModelSubs CATEGORY SET TYPE STREAM EQUATION PROCEDURE contained76syn keyword spupOperationSubs SET PRESET INITIAL SSTATE FREE contained77syn keyword spupOptionsSubs ROUTINES TRANSLATE EXECUTION contained78syn keyword spupProcedureSubs INPUT OUTPUT SPACE PRECALL POSTCALL DERIVATIVE STREAM contained79" no subsections for Profiles80syn keyword spupReportSubs SET INITIAL FIELDS FIELDMARK DISPLAY WITHIN contained81syn keyword spupUnitSubs ROUTINES SET contained82 83" additional keywords for subsections84if !exists( "strict_subsections" )85 syn keyword spupConditionsSubs STOP PRINT contained86 syn keyword spupDeclareSubs UNIT SET COMPONENTS THERMO OPTIONS contained87 syn keyword spupEstimationSubs VARY MEASURE INITIAL contained88 syn keyword spupFlowsheetSubs TYPE FEED PRODUCT INPUT OUTPUT CONNECTION OF IS contained89 syn keyword spupMacroSubs CONNECTION STREAM SET INPUT OUTPUT OF IS FEED PRODUCT TYPE contained90 syn keyword spupModelSubs AS ARRAY OF INPUT OUTPUT CONNECTION contained91 syn keyword spupOperationSubs WITHIN contained92 syn keyword spupReportSubs LEFT RIGHT CENTER CENTRE UOM TIME DATE VERSION RELDATE contained93 syn keyword spupUnitSubs IS A contained94endif95 96" Speedup data types97if exists( "highlight_types" )98 syn keyword spupTypes act_coeff_liq area coefficient concentration contained99 syn keyword spupTypes control_signal cond_liq cond_vap cp_mass_liq contained100 syn keyword spupTypes cp_mol_liq cp_mol_vap cv_mol_liq cv_mol_vap contained101 syn keyword spupTypes diffus_liq diffus_vap delta_p dens_mass contained102 syn keyword spupTypes dens_mass_sol dens_mass_liq dens_mass_vap dens_mol contained103 syn keyword spupTypes dens_mol_sol dens_mol_liq dens_mol_vap enthflow contained104 syn keyword spupTypes enth_mass enth_mass_liq enth_mass_vap enth_mol contained105 syn keyword spupTypes enth_mol_sol enth_mol_liq enth_mol_vap entr_mol contained106 syn keyword spupTypes entr_mol_sol entr_mol_liq entr_mol_vap fraction contained107 syn keyword spupTypes flow_mass flow_mass_liq flow_mass_vap flow_mol contained108 syn keyword spupTypes flow_mol_vap flow_mol_liq flow_vol flow_vol_vap contained109 syn keyword spupTypes flow_vol_liq fuga_vap fuga_liq fuga_sol contained110 syn keyword spupTypes gibb_mol_sol heat_react heat_trans_coeff contained111 syn keyword spupTypes holdup_heat holdup_heat_liq holdup_heat_vap contained112 syn keyword spupTypes holdup_mass holdup_mass_liq holdup_mass_vap contained113 syn keyword spupTypes holdup_mol holdup_mol_liq holdup_mol_vap k_value contained114 syn keyword spupTypes length length_delta length_short liqfraction contained115 syn keyword spupTypes liqmassfraction mass massfraction molefraction contained116 syn keyword spupTypes molweight moment_inertia negative notype percent contained117 syn keyword spupTypes positive pressure press_diff press_drop press_rise contained118 syn keyword spupTypes ratio reaction reaction_mass rotation surf_tens contained119 syn keyword spupTypes temperature temperature_abs temp_diff temp_drop contained120 syn keyword spupTypes temp_rise time vapfraction vapmassfraction contained121 syn keyword spupTypes velocity visc_liq visc_vap volume zmom_rate contained122 syn keyword spupTypes seg_rate smom_rate tmom_rate zmom_mass seg_mass contained123 syn keyword spupTypes smom_mass tmom_mass zmom_holdup seg_holdup contained124 syn keyword spupTypes smom_holdup tmom_holdup contained125endif126 127" stream types128syn keyword spupStreams mainstream vapour liquid contained129 130" "conditional" keywords131syn keyword spupConditional IF THEN ELSE ENDIF contained132" Operators, symbols etc.133syn keyword spupOperator AND OR NOT contained134syn match spupSymbol "[,\-+=:;*/\"<>@%()]" contained135syn match spupSpecial "[&\$?]" contained136" Surprisingly, Speedup allows no unary + instead of the -137syn match spupError "[(=+\-*/]\s*+\d\+\([ed][+-]\=\d\+\)\=\>"lc=1 contained138syn match spupError "[(=+\-*/]\s*+\d\+\.\([ed][+-]\=\d\+\)\=\>"lc=1 contained139syn match spupError "[(=+\-*/]\s*+\d*\.\d\+\([ed][+-]\=\d\+\)\=\>"lc=1 contained140" String141syn region spupString start=+"+ end=+"+ oneline contained142syn region spupString start=+'+ end=+'+ oneline contained143" Identifier144syn match spupIdentifier "\<[a-z][a-z0-9_]*\>" contained145" Textprocessor directives146syn match spupTextprocGeneric "?[a-z][a-z0-9_]*\>" contained147syn region spupTextprocError matchgroup=spupTextprocGeneric start="?ERROR" end="?END"he=s-1 contained148" Number, without decimal point149syn match spupNumber "-\=\d\+\([ed][+-]\=\d\+\)\=" contained150" Number, allows 1. before exponent151syn match spupNumber "-\=\d\+\.\([ed][+-]\=\d\+\)\=" contained152" Number allows .1 before exponent153syn match spupNumber "-\=\d*\.\d\+\([ed][+-]\=\d\+\)\=" contained154" Help subsections155syn region spupHelp start="^HELP"hs=e+1 end="^\$ENDHELP"he=s-1 contained156" Fortran code157syn region spupCode start="^CODE"hs=e+1 end="^\$ENDCODE"he=s-1 contained158" oneline comments159if oneline_comments > 3160 oneline_comments = 2 " default161endif162if oneline_comments == 1163 syn match spupComment "#[^#]*#\="164elseif oneline_comments == 2165 syn match spupError "#.*$"166 syn match spupComment "#[^#]*" nextgroup=spupError167elseif oneline_comments == 3168 syn match spupComment "#[^#]*"169 syn match spupError "#[^#]*#.*"170endif171" multiline comments172syn match spupOpenBrace "{" contained173syn match spupError "}"174syn region spupComment matchgroup=spupComment2 start="{" end="}" keepend contains=spupOpenBrace175 176syn cluster spupOrdinary contains=spupNumber,spupIdentifier,spupSymbol177syn cluster spupOrdinary add=spupError,spupString,spupComment178syn cluster spupTextproc contains=spupTextprocGeneric,spupTextprocError179 180" define synchronizing; especially OPERATION sections can become very large181syn sync clear182syn sync minlines=100183syn sync maxlines=500184 185syn sync match spupSyncOperation grouphere spupOperation "^OPERATION"186syn sync match spupSyncCdi grouphere spupCdi "^CDI"187syn sync match spupSyncConditions grouphere spupConditions "^CONDITIONS"188syn sync match spupSyncDeclare grouphere spupDeclare "^DECLARE"189syn sync match spupSyncEstimation grouphere spupEstimation "^ESTIMATION"190syn sync match spupSyncExternal grouphere spupExternal "^EXTERNAL"191syn sync match spupSyncFlowsheet grouphere spupFlowsheet "^FLOWSHEET"192syn sync match spupSyncFunction grouphere spupFunction "^FUNCTION"193syn sync match spupSyncGlobal grouphere spupGlobal "^GLOBAL"194syn sync match spupSyncHomotopy grouphere spupHomotopy "^HOMOTOPY"195syn sync match spupSyncMacro grouphere spupMacro "^MACRO"196syn sync match spupSyncModel grouphere spupModel "^MODEL"197syn sync match spupSyncOperation grouphere spupOperation "^OPERATION"198syn sync match spupSyncOptions grouphere spupOptions "^OPTIONS"199syn sync match spupSyncProcedure grouphere spupProcedure "^PROCEDURE"200syn sync match spupSyncProfiles grouphere spupProfiles "^PROFILES"201syn sync match spupSyncReport grouphere spupReport "^REPORT"202syn sync match spupSyncTitle grouphere spupTitle "^TITLE"203syn sync match spupSyncUnit grouphere spupUnit "^UNIT"204 205" Define the default highlighting.206" Only when an item doesn't have highlighting yet207 208hi def link spupCdi spupSection209hi def link spupConditions spupSection210hi def link spupDeclare spupSection211hi def link spupEstimation spupSection212hi def link spupExternal spupSection213hi def link spupFlowsheet spupSection214hi def link spupFunction spupSection215hi def link spupGlobal spupSection216hi def link spupHomotopy spupSection217hi def link spupMacro spupSection218hi def link spupModel spupSection219hi def link spupOperation spupSection220hi def link spupOptions spupSection221hi def link spupProcedure spupSection222hi def link spupProfiles spupSection223hi def link spupReport spupSection224hi def link spupTitle spupConstant " this is correct, truly ;)225hi def link spupUnit spupSection226 227hi def link spupCdiSubs spupSubs228hi def link spupConditionsSubs spupSubs229hi def link spupDeclareSubs spupSubs230hi def link spupEstimationSubs spupSubs231hi def link spupExternalSubs spupSubs232hi def link spupFlowsheetSubs spupSubs233hi def link spupFunctionSubs spupSubs234hi def link spupHomotopySubs spupSubs235hi def link spupMacroSubs spupSubs236hi def link spupModelSubs spupSubs237hi def link spupOperationSubs spupSubs238hi def link spupOptionsSubs spupSubs239hi def link spupProcedureSubs spupSubs240hi def link spupReportSubs spupSubs241hi def link spupUnitSubs spupSubs242 243hi def link spupCode Normal244hi def link spupComment Comment245hi def link spupComment2 spupComment246hi def link spupConditional Statement247hi def link spupConstant Constant248hi def link spupError Error249hi def link spupHelp Normal250hi def link spupIdentifier Identifier251hi def link spupNumber Constant252hi def link spupOperator Special253hi def link spupOpenBrace spupError254hi def link spupSection Statement255hi def link spupSpecial spupTextprocGeneric256hi def link spupStreams Type257hi def link spupString Constant258hi def link spupSubs Statement259hi def link spupSymbol Special260hi def link spupTextprocError Normal261hi def link spupTextprocGeneric PreProc262hi def link spupTypes Type263 264 265let b:current_syntax = "spup"266 267let &cpo = s:cpo_save268unlet s:cpo_save269" vim:ts=8270 