catala icon indicating copy to clipboard operation
catala copied to clipboard

Parser is a bit too tolerant after multi-word keywords

Open AltGr opened this issue 6 months ago • 0 comments

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.

AltGr avatar Jul 07 '25 16:07 AltGr