catala
catala copied to clipboard
Parser is a bit too tolerant after multi-word keywords
Fun fact: space is not mandatory after multi-word keywords. For example, this is accepted:
declaration scope Foo:
output f content integer depends onx content integer
scope Foo under conditiontrue:
definition f of x equals 0
normally, this is refused because there is an ambiguity between identifier and keyword, that is solved by being greedy, so definitionfoo is lexed as an identifier. Here, because of the space within the keyword, we no longer have this ambiguity (or rather, it's hidden behind a different branch : keywords are not a subset or identifiers)
This is not critical, but can be surprising, and could lead to breakages later on if unnoticed in the code and we fix the bug.