Add lexing of string interpolation #44
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds lexing of string interpolations, both single- and double-quoted. It required some manual parsing, which took a few tries, but it's not too bad and can serve as a proof-of-concept if we need some more manual lexing in the Logos lexer.
One limitation is that the string intepolations cannot host the same types of quotes, for example
$"foo("bar")baz"is not allowed, but in Nushell it is allowed. It might be possible to add it, but would require more hassle, so I left it out for now as it's not a severe limitation.It also adds a LexError for reporting lexing errors. Now it is used only in string interpolation, but it can be expanded in the future.