-
Notifications
You must be signed in to change notification settings - Fork 149
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
Parser: possible to recover from missing "? #7677
Comments
As things are now I don't think it is feasible. I think this is tied pretty directly to how many restrictions we are willing to place on strings, and right now there just isn't enough to make recovery possible. If for instance we disallow multi-line strings, recovery is possible and easy to reason about. But then perhaps we need special syntax for multi-line strings ala /// Multi line strings could use "escaped newlines" for instance
def f(): M = Map#{ 1 /**/=>/**/ "Hello \
" |
Do we allow multi line strings? In the old parser? I don't think we should, in any case. |
I believe the old parser did. Here are the rule(s): def Str: Rule1[ParsedAst.Literal.Str] = rule {
SP ~ "\"" ~ zeroOrMore(!("\"" | atomic("${") | atomic("%{")) ~ Chars.CharCode) ~ "\"" ~ SP ~> ParsedAst.Literal.Str
}
// And then Chars is defined like this
object Chars {
def Literal: Rule1[ParsedAst.CharCode.Literal] = rule {
SP ~ !("\\" | EOI) ~ capture(CharPredicate.All) ~ SP ~> ParsedAst.CharCode.Literal
}
def Escape: Rule1[ParsedAst.CharCode.Escape] = rule {
SP ~ "\\" ~ capture(CharPredicate.All) ~ SP ~> ParsedAst.CharCode.Escape
}
def CharCode: Rule1[ParsedAst.CharCode] = rule {
Escape | Literal
}
} |
Hmm! |
Ok; we can discuss this later. I don't think its important for now :) |
This is not a bug.
The text was updated successfully, but these errors were encountered: