Why does the lexer allow relations that start with an underscore? #1163
Labels
bug
Indicates an unexpected problem or unintended behavior
component: compiler
component:parser
priority:normal
Syntax
What happened
I noticed that a relation name in Ampersand may start with an underscore. The compiler accepts the following code fragment:
The compiler lets me work with this underscored identifier without problems.
What I expected
I expected an error because the documentation states clearly that relation names start with a lower case letter.
Version of ampersand that was used
Ampersand-v4.1.4 [no git info], build time: 10-Mar-21 13:53:13 UTC
Steps to reproduce
Analysis
I found this error by code inspection.
I traced it back to the lexer, in the function isIdStart:
It is used in the following code fragment in file
lexer.hs
:It is clear that the function
isIdStart
is deliberate. So I wonder why it was inserted. Maybe @DanielSchiavini knows?In the meantime I suggest we treat this like an error and fix it. I propose the following change:
This change is ready for testing in commit 7c4d1ac
The text was updated successfully, but these errors were encountered: