7 Token TokDollarCurly = peek();
8 assert(TokDollarCurly.
kind() == tok_dollar_curly);
10 auto Sync = withSync(tok_r_curly);
13 auto ExprState = withState(
PS_Expr);
17 if (ExpectResult ER = expect(tok_r_curly); ER.ok()) {
20 ER.diag().note(Note::NK_ToMachThis, TokDollarCurly.
range())
23 return std::make_shared<Interpolation>(
31 std::vector<InterpolablePart> Fragments;
32 assert(Begin.
kind() == tok_path_fragment);
35 auto PathState = withState(
PS_Path);
37 Token Current = peek();
38 Fragments.emplace_back(std::string(Current.
view()));
42 if (Next.
kind() == tok_path_end)
44 if (Next.
kind() == tok_dollar_curly) {
46 Fragments.emplace_back(std::move(
Expr));
49 assert(
false &&
"should be path_end or ${");
52 auto Parts = std::make_shared<InterpolatedParts>(
59 std::vector<InterpolablePart> Parts;
62 switch (
Token Tok = peek(0); Tok.
kind()) {
63 case tok_dollar_curly: {
65 Parts.emplace_back(std::move(
Expr));
68 case tok_string_part: {
70 Parts.emplace_back(std::string(Tok.view()));
74 case tok_string_escape:
80 assert(LastToken &&
"LastToken should be set in `parseString`");
81 return std::make_shared<InterpolatedParts>(
90 TokenKind QuoteKind = IsIndented ? tok_quote2 : tok_dquote;
92 assert(Quote.
kind() == QuoteKind &&
"should be a quote");
95 auto Sync = withSync(QuoteKind);
96 assert(LastToken &&
"LastToken should be set after consume()");
100 if (ExpectResult ER = expect(QuoteKind); ER.ok()) {
102 return std::make_shared<ExprString>(
105 ER.diag().note(Note::NK_ToMachThis, Quote.
range()) << QuoteSpel;
106 return std::make_shared<ExprString>(