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

inconsistency in spec around stringLiterals #9557

Closed
scabug opened this issue Nov 16, 2015 · 7 comments
Closed

inconsistency in spec around stringLiterals #9557

scabug opened this issue Nov 16, 2015 · 7 comments

Comments

@scabug
Copy link

scabug commented Nov 16, 2015

The spec says:

id ::= plainid | ‘`’ stringLiteral ‘`’

That seems fine. But what is stringLiteral?
Section 1.3.5 says

stringLiteral  ::="’ {stringElement} ‘"

This seems wrong because I don't need double quotes to make a back-quoted identifier.

stringLiteral   ::="""’ multiLineChars ‘"""

seems wrong for the same reason.

What is a stringLiteral?

Side question: which escape characters are allowed in the identifier string literal? Because it's some, but apparently not ```

Thanks!

@scabug
Copy link
Author

scabug commented Nov 16, 2015

Imported From: https://issues.scala-lang.org/browse/SI-9557?orig=1
Reporter: @refried
See #9925, #6810

@scabug
Copy link
Author

scabug commented Nov 16, 2015

@refried said:
The Scala 2.9 spec pdf defines id ::= plainid | ‘’ stringLit ‘, but I couldn't find a definition of stringLit anywhere.

@scabug
Copy link
Author

scabug commented Nov 16, 2015

@som-snytt said (edited on Nov 16, 2015 11:30:57 PM UTC):
You have come up with a use case for triple backticks.

val ```abc`def``` = 42

There is revised language at this change around "printable". I don't see a more recent nightly or 2.12 spec yet, but the source says this.

Also conceivably, it could accept abc\u0060def by blessing the unicode form.

Backtick is not backslashable.

@scabug
Copy link
Author

scabug commented Nov 17, 2015

@refried said:
I don't really want to support ` in identifiers (seems like a very low priority), I just want to bugfix the spec documents (seems like a higher priority).

@scabug
Copy link
Author

scabug commented Nov 17, 2015

@refried said:
@apm I'm saying that the definitions and usage of stringLiteral in my initial ticket, taken together, aren't true.

@scabug
Copy link
Author

scabug commented Sep 17, 2016

@dsbos said:
I've run into this error in the specification too.

So if the second form of non-terminal id is not back quotes (Unicode GRAVE ACCENT) around a string literal--which can contain unescaped back quotes--what exactly is the syntax the second form of id?

@scabug
Copy link
Author

scabug commented Sep 18, 2016

@som-snytt said:
scala/scala#5407

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants