-
Notifications
You must be signed in to change notification settings - Fork 16
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
manipulateConfig: doesn't handle GAMS comments properly #121
Comments
I'm not quite sure, where to go from here. I see the following solutions:
Sorry to make a big thing out of this again, but given the amount of work we have lately (not only connected to rewriting the start scripts) which revolves around parsing GAMS code with regex, I can't help but think we are busy fixing an ultimately unnecessary approach given the other, saner, options. Sure, GAMSTRANSFER doesn't support |
|
For REMIND, this problem should be mitigated now by this test that fails if |
If given something like this:
and tasked with changing
cm_FlexTaxFeedback
to 1,manipulateConfig
will detect the/
in the comment inside the parameter definition and will change everything between the slashes so the file ends up as:i.e. swallowing a good part of the comments.
Within the current framework of
manipulateConfig
this is very hard to solve. manipulateConfig uses regular expressions, which are best for context-free grammars, but to properly detect what is happening, we have to detect two contexts - first, the definition context, which in the example goes fromparameter
to the first;
, but can also span multiple definitions, and then, second, the comment context within the definition context, which spans from***
to the next end of line. While I think it should be theoretically possible to solve this in perl-compatible regular expressions (they are turing-complete, after all), practically, the regular expressions are completely unreadable already, and adding another context detection to them is practically impossible. For the record, this is the regex which detects parameter definitions currently, which does not handle comments properly:The text was updated successfully, but these errors were encountered: