Skip to contents

Splits the part of an equation before .. into its name, index list and optional $ condition.

Usage

parse_equation_header(line)

Arguments

line

A single line of GAMS source ending in ...

Value

A list with the header's components, or NULL if line is not an equation header.

Details

Exported because consumers that compile their own GAMS-flavoured IR into multimod equations need exactly this parse. energyRt's user constraints (newConstraint()) arrive as GAMS strings whose headers look like eqCnsX(region, year)$mCnsForEachX(region, year).., and re-implementing the split would let the two parsers disagree.

Examples

parse_equation_header("eqCost(region, year).. ")
#> $name
#> [1] "eqCost"
#> 
#> $dims
#> [1] "region" "year"  
#> 
#> $condition
#> NULL
#>