Skip to content
Discussion options

You must be logged in to vote

The problem here is with the way you've designed the token parser. Let's take the simplest problematic example:

"#{}"

In theory, this should be parsed as String([Literal(""), Interpolation([]), Literal("")]), if I understand correctly.

The problem occurs when we hit the #{, which starts the interpolated expression. Here, we start looking for more tokens (since an interpolation just contains a list of tokens). What's the next character? Well, it's }. But because you've got your rbrace parser enabled, this successfully parses as a token, even though we shouldn't be finding any tokens in the interpolation!

This continues: the next character is a ", which means the start of a string token. Bu…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@jimmycuadra
Comment options

@jimmycuadra
Comment options

@zesterer
Comment options

@jimmycuadra
Comment options

@zesterer
Comment options

Answer selected by jimmycuadra
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants