Closed ArcticLight closed 10 years ago
This appears to be the answer - it looks like the Position.longString
method is what we want. Too tired to actually write the method atm though.
That looks exactly right to me.
Getting it to caret underline the whole token is actually gonna be Hard - we need to somehow pass the offset up all the way from the DecafToken
to the ASTNode
to the TypeAnnotation
which is gonna be a pain.
Does it really really matter about the full offset? By that I mean, we indicate the position with a good amount of clarity. If JJ doesn't like the way that we do it, then yeah, we might have to put more carets under the phrase in question. But - if this is just about underlining the specific DecafToken, it really shouldn't matter all that much. You could just repeat the caret for the number of characters in the token's text. We should only actually need the full offset IF we were required to underline the complete expression, etc
This should be closable as of 385196
We need to implement a prettyprinter for our errors that prints things with the program line, location, and carrots underlining the specific offending lines.
The Scala standard lib does this for its error reporting when you throw errors during a parse, so presumably there exists code that does the correct printing. Therefore, we should look for this code and see if we can make it work in our typechecker.