Skip to content

Commit aa5b719

Browse files
authored
Add support for triple quoted ASCII byte string (#19182)
1 parent d216077 commit aa5b719

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

docs/release-notes/.FSharp.Compiler.Service/11.0.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
* Type checker: recover on checking binding parameter constraints ([#19046](https://github.com/dotnet/fsharp/pull/19046))
2222
* Debugger: provide breakpoint ranges for short lambdas ([#19067](https://github.com/dotnet/fsharp/pull/19067))
2323
* FSharpDiagnostic: add default severity ([#19152](https://github.com/dotnet/fsharp/pull/19152))
24+
* Add support for triple quoted ASCII byte string ([#19182](https://github.com/dotnet/fsharp/pull/19182))
2425

2526
### Changed
2627

src/Compiler/lex.fsl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,6 +1502,12 @@ and tripleQuoteString (sargs: LexerStringArgs) (skip: bool) = parse
15021502
let cont = LexCont.Token(args.ifdefStack, args.stringNest)
15031503
fin.Finish buf kind LexerStringFinisherContext.TripleQuote cont }
15041504

1505+
| '"' '"' '"' 'B'
1506+
{ let (buf, fin, _m, kind, args) = sargs
1507+
args.interpolationDelimiterLength <- 0
1508+
let cont = LexCont.Token(args.ifdefStack, args.stringNest)
1509+
fin.Finish buf { kind with IsByteString = true } LexerStringFinisherContext.TripleQuote cont }
1510+
15051511
| newline
15061512
{ let (buf, _fin, m, kind, args) = sargs
15071513
incrLine lexbuf

tests/fsharp/Compiler/Conformance/BasicGrammarElements/BasicConstants.fs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ module ``Basic Grammar Element Constants`` =
99

1010
[<Fact>]
1111
let ``Basic constants compile `` () =
12+
let tripleQuotedByteString = " \"\"\" \" \"\"\"B "
13+
1214
CompilerAssert.Pass
13-
"""
15+
$"""
1416
let sbyteConst = 1y
1517
let int16Const = 1us
1618
let int32Const = 1ul
@@ -42,6 +44,8 @@ let charConst = '1'
4244
let stringConst = "1"
4345
4446
let bytestringConst = "1"B
47+
48+
let byteTripleQuotedStringConst = {tripleQuotedByteString}
4549
4650
let bytecharConst = '1'B
4751

0 commit comments

Comments
 (0)