SR-10469 Unknown syntax for interpolated string literal
I would like to have a better way to extract raw string without quotes from `StringLiteralExprSyntax`. `StringInterpolationExprSyntax` looks well-organized because its cursor has openQuote, segments and closeQuote to express strings and quotes separately.
Seems good idea to me. The benefit is you will be able to structurally distinguish what kind of quotes (multiline or single) were used, instead of searching the string literal text string in order to distinguish.
If we do this we should probably get rid of 'string_literal' token kind and use 'string_segment' token kind for the non-interpolation case as well.
I have a question about literal expression for this. I'm looking into Parser and wondering whether I should extend 'StringLiteralExpr' or create new one like 'NonInterpolatedStringLiteralExpr'. Which one do you think is better? @akyrtzi
I figured out how 'string_segment' is parsed in 'parseExprStringLiteral' func, but I haven't had conclusion for the interface yet.
I'm not a big fan of adding `NonInterpolatedStringLiteralExpr` either. The reason is users are likely to have two overrides for either visit or rewrite functions to handle all string literal cases. We should strive to help users reduce code duplication. However, feel free to add a convenient function to `StringLIteralExpr` indicating whether there are interpolations in the node.