-
Notifications
You must be signed in to change notification settings - Fork 273
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
Backticky symbol parsing #3525
Backticky symbol parsing #3525
Conversation
(.) f g x = f (g x) | ||
(`.`) f g x = f (g x) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is interesting; it makes me think that there are some unambiguous syntaxes we could accept without ``
, e.g. if it's in parens, all symbols, with no spaces, like the (.)
above, or a group of symboly chars that are separated with spaces or other tokens, from any other identifiers, thus not a path-qualified name, like the id . id
below, but this is still fine/good for now.
(base.function..) f g x = f (g x) | ||
(base.function.`.`) f g x = f (g x) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even with the relaxed rules proposed in the previous comment, this would still need the ``
s, because it's got other .
in it, which would mean it's a path-qualified name.
-- yes "wordy" - just like a wordy keyword like "true", the literal "." (as in the dot in | ||
-- "forall a. a -> a") is considered the keyword "." so long as it is either followed by EOF, a space, or some | ||
-- non-wordy character (because ".foo" is a single identifier lexeme) | ||
wordyKw "." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not symboly
, because the "eof/space/non-wordy-character" definition of wordy just is what we need here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the definition of wordyKw
is what we need here. I can't remember exactly what bug symbolyKw
was causing at the moment, unfortunately, but it's not correct
@mitchellwrosen Could you add a regression test for #2970 and #1519 and then we'll get it merged. |
Overview
This PR adds two features:
Names now consist of 1+ wordy or symboly name segments. Previously, they consisted of 0+ wordy name segments followed by 1 wordy or symboly name segment. That means
foo.++.doc
is now valid, the primary purpose of the PR.Historical naming accidents
.
and()
are now handled better - they are valid name segments, so long as they belong to a name segment escaped in backticks, e.g.`.`
or`()()()`
. Reserved symbols and names (such as=
andmatch
) are also valid name segments, if they are escaped (`=`
,`match`
).Fixes #1519
Fixes #1589
Fixes #2970