Skip to content

Add error message for illegal literals - Parser.scala:602 #1667

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

Merged
merged 1 commit into from
Nov 6, 2016
Merged

Add error message for illegal literals - Parser.scala:602 #1667

merged 1 commit into from
Nov 6, 2016

Conversation

maseev
Copy link
Contributor

@maseev maseev commented Nov 6, 2016

This pull request is related to the following issue

Copy link
Contributor

@felixmulder felixmulder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except for a few nitpicks this looks great! 👍

| - Character Literals: 'a', '\u0041', '\\n'
| - String Literals: "Hello, World!"
| - null
|""".stripMargin
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strip margin isn't necessary on hl strings :)

| - Integer literals: 0, 21, 0xFFFFFFFF, -42L
| - Floating Point Literals: 0.0, 1e30f, 3.14159f, 1.0e-100, .1
| - Boolean Literals: true, false
| - Character Literals: 'a', '\u0041', '\\n'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There shouldn't be an extra \ in '\\n' right? You don't need to escape things (except $) in triple quoted strings.

val kind = "Syntax"
val msg = "illegal literal"
val explanation =
hl"""|Expected a valid literal.
Copy link
Contributor

@felixmulder felixmulder Nov 6, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would skip this line, the error message already says "illegal literal" right? If you think it should be kept, you could bake it into the sentence where you present the legal literals in Scala.

@maseev
Copy link
Contributor Author

maseev commented Nov 6, 2016

@felixmulder PTAL

@felixmulder
Copy link
Contributor

LGTM

@felixmulder felixmulder merged commit d6b9749 into scala:master Nov 6, 2016
val kind = "Syntax"
val msg = "illegal literal"
val explanation =
hl"""|Available literals can be divided into the several groups:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: "into the several groups" -> "into several groups"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in: bffefe9

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, snap! Sorry for this typo guys.

@maseev maseev deleted the iss1589-literal-error-message branch November 8, 2016 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants