-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ClassCastException when combining a Tuple2 parser #29
Comments
@Benjozork did you manage to solve this for Cyan? I've run into exactly the same problem, on a much smaller grammar |
I think the issue is that the public class SkipParser(public val innerParser: Parser<*>) Can't this be made generic? |
Hey, it's been a long time since I worked on cyan and I think I just reshuffled the parser a bit to where it wasn't causing an issue and forgot about it. Sorry I don't have a more useful solution 😬 |
Hello,
The following code :
Yields the following exception :
From a quick look into the code, it seems like in
andFunctions.kt
this is function is called for the first * operator intypePrefix * -znws * -trait
:But looking at the debugger, I see values packed into a tuple and not "flat mapped" (don't know if that makess sense, couldn't think of a better way to put it) :
Here,
t1
of element 0 (which is the result oftypePrefix
) is the match for tokentype
, andt2
is fromparser(this::referenceParser)
. Yet, the code thinkst1
is element 0, andt2
is element 1, while they are in fact both inside element 0. This obviously causes aClassCastException
when it tries to cast element0
into what I assume reified type parameterT1
is (TokenMatch
).I couldn't figure out which part of the library laid out those elements like that, which is where I'm stuck.
I hope this all made sense, and thanks in advance.
The text was updated successfully, but these errors were encountered: