Skip to content

Draft: Fix parsing of keywords with same name as elements

finesse importer requested to merge fix/parsing-of-q into develop

Closes #475

This changes the way keywords and constants are parsed.

With the removal of the & operator in !110 (merged), elements with the same name as keywords (e.g. q) are resolved as keywords. Inside the new MathDetector this problem is particularly visible as it means an expression like q*2 will resolve as the string "qq", since keywords are passed to Finesse as strings, in this case "q".

The problem with the above case is twofold: it should be possible (though not recommended) to give elements the same name as keywords, and expressions should not allow keywords as arguments in the first place.

This MR changes the compiler to avoid resolving keywords and constants until it has been made sure that the name is not already an element. Only at that point are they really converted into strings or constants and passed to Finesse.

Edited by finesse importer

Merge request reports