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

[WIP] Enable double dollar for triple quoted interpolated strings #13259

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Compiler/Facilities/prim-lexing.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ type internal LexBuffer<'Char> =
member LexemeContains: 'Char -> bool

/// The length of the lexeme.
member LexemeLength: int
member LexemeLength: int with get, set

/// Fast helper to turn the matched characters into a string, avoiding an intermediate array.
static member LexemeString: LexBuffer<char> -> string
Expand Down
6 changes: 6 additions & 0 deletions src/Compiler/lex.fsl
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,9 @@ rule token args skip = parse
// Note, we do not update the 'm', any incomplete-interpolation error
// will be reported w.r.t. the first '{'
args.stringNest <- (counter + 1, style, isDoubleDollar, m) :: rest
| _ when isDouble ->
lexbuf.LexemeLength <- 1
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks plausible. Does it work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dsyme Maybe, I'm not sure. Tests are failing but it seems that it's not detecting well when an interpolation gap closes now. I wasn't sure how to debug the lexer tests. Unfortunately I won't be able to work on the PR this week, so it'd be great if someone could take over.

lexbuf.EndPos <- lexbuf.EndPos.ShiftColumnBy -1
| _ -> ()
// To continue token-by-token lexing may involve picking up the new args.stringNes
let cont = LexCont.Token(args.ifdefStack, args.stringNest)
Expand Down Expand Up @@ -887,6 +890,9 @@ rule token args skip = parse
RBRACE cont

| _ ->
if isDouble then
lexbuf.LexemeLength <- 1
lexbuf.EndPos <- lexbuf.EndPos.ShiftColumnBy -1
let cont = LexCont.Token(args.ifdefStack, args.stringNest)
RBRACE cont
}
Expand Down