Skip to content
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

Several characters legal in bare identifiers cause confusing or ambiguous behavior #75

Closed
Tracked by #112
hkolbeck-streem opened this issue Jan 13, 2021 · 1 comment
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@hkolbeck-streem
Copy link

hkolbeck-streem commented Jan 13, 2021

Currently, the characters /,*, +, and - are legal in bare identifiers and at their start. This leads to a few ambiguous situations while parsing. Some examples:

  • -10/+10 are valid bare identifiers, at least in the node identifier position. How to parse things like -10=10 is a bit more difficult.
  • a/**/ is a valid bare identifier
  • a// is a valid bare identifier

It seems in keeping with the current rules about bare identifier start chars to add -/+ to the forbidden list. How to handle the latter case seems a bit tougher.

@zkat zkat added bug Something isn't working help wanted Extra attention is needed labels Jan 13, 2021
@hkolbeck-streem
Copy link
Author

hkolbeck-streem commented Jan 13, 2021

After some more thinking it feels reasonable to disallow just / in bare identifiers, as it already seems a little odd to allow a character that would require escaping in an escaped string. Raw strings could still surprise people, since you could have documents like:

node r"Hello,
//Here comes the cool part
World" 

which would be written "node Hello,\n\/\/Here comes the cool part\nWorld" if written with escaped strings. This still feels not entirely surprising because of the semantics of raw strings, and I don't see a way around it that would be less confusing.

@zkat zkat mentioned this issue Sep 1, 2021
12 tasks
@zkat zkat closed this as completed in 3f739ca Sep 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants