climateinteractive / antlr4-vensim

Vensim grammar in ANTLR 4
MIT License
1 stars 0 forks source link

Numeric range embedded in subscript range fails #9

Closed ToddFincannonEI closed 11 months ago

ToddFincannonEI commented 1 year ago

Subscript ranges can include a numeric range that abbreviates a sequence of subscript indices as in the ref sample model.

Target: (t1-t3)

The ANTLR4 grammar only handles this when the numeric range is the entire subscript definition as shown above. It fails when the numeric range occurs inside a subscript index list like this:

DimC: C1, (C2-C4), C5
t[DimC] = 1
ToddFincannonEI commented 11 months ago

I moved the subscriptSequence rule to the Expr.g4 grammar, so it could be used in the subscriptList rule. This change works with a corresponding change in the 318-numeric-range branch of SDEverywhere that handles the new grammar. This requires bumping the antlr4-vensim version number to 0.6.2.