Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid generated code when model variable name includes parentheses #582

Closed
chrispcampbell opened this issue Dec 7, 2024 · 0 comments · Fixed by #585 or #577
Closed

Invalid generated code when model variable name includes parentheses #582

chrispcampbell opened this issue Dec 7, 2024 · 0 comments · Fixed by #585 or #577
Assignees

Comments

@chrispcampbell
Copy link
Contributor

We have a model that has a variable name that includes parentheses, and we can't easily change it for [reasons]. This case is not currently handled correctly in SDE, so it results in incorrect generated code.

There are actually two problems:

  1. During preprocessing when generating the key used for flattening, we split on (, but this code doesn't account for the case where the ( appears inside a quoted variable name. In the case of the sde flatten command, this means if you have two variables (Var (1) and Var (2), only the first one will be preserved in the preprocessed model.
  2. During parsing, the canonicalId function does not transform paren characters to underscore like we do for other punctuation, so the generated C/JS code will include for example _var_(1) which is not a valid identifier.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant