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

Line Commented out XML + Escapes causes illegitimate compiler error #5100

Closed
scabug opened this issue Oct 20, 2011 · 4 comments
Closed

Line Commented out XML + Escapes causes illegitimate compiler error #5100

scabug opened this issue Oct 20, 2011 · 4 comments
Assignees

Comments

@scabug
Copy link

scabug commented Oct 20, 2011

So I was copy pasting over portions of the Ecma-262 ref to a little Scala dsl I am working on.

The following code is causing compiler errors when being parsed

// XmlCrasher.scala
object XmlCrasher {
    //...Skipping parts that enumerate legal ways to make numbers and so on
    //String Escape Codes
    //\b \u0008 backspace <BS>
    //\t \u0009 horizontal tab <HT>
    //\n \u000A line feed (new line) <LF>
    //\v \u000B vertical tab <VT>
    //\f \u000C form feed <FF>
    //\r \u000D carriage return <CR>
    //\" \u0022 double quote "
    //\' \u0027 single quote '
    //\\ \u005C backslash \
}

[error] ...XmlCrasher.scala:127: ';' expected but $XMLSTART$< found.
[error]     //\n \u000A line feed (new line) <LF>
[error]                                      ^
[error] ...XmlCrasher.scala:130: ';' expected but 'return' found.
[error]     //\r \u000D carriage return <CR>
[error]                          ^
[error] two errors found

I tried searching for duplicates to see if they are fixed in master. I have verified this is an error in both 2.7.7 using the repl there (well a gui frontend to it), and 2.9.1 compiling with sbt.

Now for some keywords to help search:

xml linecomment line comment compiler error
xml and unicode escapes and named escapes in line comment causes spurious and unwarranted compiler error.

Also block comments seem to compile just fine.

@scabug
Copy link
Author

scabug commented Oct 20, 2011

Imported From: https://issues.scala-lang.org/browse/SI-5100?orig=1
Reporter: Ben Jackman (benjaminjackman)
Affected Versions: 2.7.7, 2.9.1

@scabug
Copy link
Author

scabug commented Oct 20, 2011

Ben Jackman (benjaminjackman) said:
After a bit more digging i have boiled it down to:

Either of these comments are bad, sorry about the spurious xml nonsense above.

//\n \u000A FOO
//\r \u000D return

so it seems to be some combination of (\n | \r) ~ (\u000A | \u000D) as best i can tell.

@scabug
Copy link
Author

scabug commented Oct 20, 2011

Ben Jackman (benjaminjackman) said:
Gotta get that binary bug search mojo working better, or just figure out how to edit comments in Jira.

Reduced case:
//\u000A FOO
//\u000D return

Will cause the error best I can tell.

@scabug
Copy link
Author

scabug commented Oct 31, 2011

@paulp said:
This is as specified. See SLS section 1.

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

No branches or pull requests

2 participants