Vensim variable names that are quoted because they contain a
comma – for example "Climate (Temp, rainfall, etc.)" – are
no longer split into several fake variables. The argument tokenizer
matched [^,]+ before the quoted alternative, and because
Vensim writes a space after the opening parenthesis, that branch fired
first and swallowed the opening quote along with everything up to the
first comma. Splitting is now quote-aware
((?:"[^"]*"|[^,])+, perl = TRUE). On a
26-variable reference model this removed 9 spurious edges and 3 phantom
variables.
Diagram legend arrows are removed whatever punctuation the
modeller used. Legends are drawn with invisible placeholder labels –
., .., ,, ,,,
,,,, .... – but only . and
KEY were recognised, so the rest leaked into the edge list
as if they were model variables. Any label containing no letters or
digits is now treated as a legend anchor.
Models written with real equations rather than the
A FUNCTION OF(...) shorthand now yield edges. Previously
the equation section produced nothing for them, because there was no
second pass to resolve variable names against the model’s own
vocabulary, and the name boundary pattern excluded a leading quote so a
quoted punctuated name could never match.
Added tests/testthat/test-parsers.R: regression
tests for each of the above, unit tests for the argument tokenizer
(nested quotes, hyphenated names, unterminated quotes, empty input) and
the legend-anchor predicate, plus checks that control variables are
never emitted, that a self-referencing variable produces no self-loop,
and that the edge list contains no duplicate rows.
The bundled example_model.mdl now contains a quoted
comma-bearing variable and a legend pair, so the shipped example
exercises both regressions.