Avatar
omochimetaru 8/30/2022 4:21 AM
SwiftSyntaxのSwift Parserに """" を食わせると、1文字目と5文字目に " が足りませんよ、っていう出力になるんだが """""" は別に正しいコードになってないので謎だ。
4:21 AM
[omochi@omochi-iMacPro swift-syntax (add-fixed-issues-test %=)]$ .build/debug/swift-parser-test dump-tree crash.swift SourceFileSyntax children=2 0: CodeBlockItemListSyntax children=1 0: CodeBlockItemSyntax children=1 0: StringLiteralExprSyntax children=3 0: stringQuote MISSING 1: StringLiteralSegmentsSyntax children=1 0: StringSegmentSyntax children=1 0: stringSegment("\"\"\"\"") 2: stringQuote MISSING 1: eof
4:23 AM
パース結果としてはこうなってるんだけど、「ダブルクォート4個のstring segment」が一つだけの文字列になっているのも謎だ。ダブルクォートが文字列のコンテンツになっちゃった。そして文字列を包むダブルクォートは両端で消失。
4:24 AM
実装を追って調べてみようと思う。