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

Can we allow identifier escapes without initial quote? #656

Closed
jclark opened this issue Nov 24, 2020 · 4 comments
Closed

Can we allow identifier escapes without initial quote? #656

jclark opened this issue Nov 24, 2020 · 4 comments
Assignees
Labels
Area/Lang Relates to the Ballerina language specification Type/Improvement Enhancement to language design

Comments

@jclark
Copy link
Collaborator

jclark commented Nov 24, 2020

Currently 'a\-b is allowed as an identifier but a\-b is not: an initial quote ' is required before escapes (starting with \) are recognized. Can/should we relax this, so that e.g. a\-b would be a legal identifier?

@jclark jclark added Type/Improvement Enhancement to language design Area/Lang Relates to the Ballerina language specification labels Nov 24, 2020
@jclark jclark added this to the Swan Lake Alpha milestone Nov 24, 2020
@jclark jclark self-assigned this Nov 24, 2020
@jclark
Copy link
Collaborator Author

jclark commented Nov 24, 2020

This would change grammar to:

identifier := UnquotedIdentifier | QuotedIdentifier
UnquotedIdentifier :=  (IdentifierInitialChar|IdentifierEscape) (IdentifierFollowingChar|IdentifierEscape)*
QuotedIdentifier := "'" (IdentifierFollowingChar|IdentifierEscape)+
IdentifierEscape := IdentifierSimpleEscape | StringNumericEscape
IdentifierSimpleEscape := "\" ^(AsciiLetter | 0x9 | 0xA | 0xD | UnicodePatternWhiteSpaceChar)

@jclark
Copy link
Collaborator Author

jclark commented Nov 27, 2020

See #193 and #243 for background.

@jclark
Copy link
Collaborator Author

jclark commented Nov 27, 2020

We approved this change today.

@jclark
Copy link
Collaborator Author

jclark commented Nov 27, 2020

Currently we do Option K described in #243 (comment); this is Option I, which was a loosening that we anticipated #243 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/Lang Relates to the Ballerina language specification Type/Improvement Enhancement to language design
Projects
None yet
Development

No branches or pull requests

1 participant