| Summary: | LexerErrorContext should not implement IParserErrorContext | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Holger Schill <Holger.Schill> |
| Component: | Xtext Backlog | Assignee: | Project Inbox <tmf.xtext-inbox> |
| Status: | NEW --- | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | btickets, christian.dietrich.opensource, mail, oliver, sebastian.zarnekow |
| Version: | 2.0.0 | Keywords: | helpwanted |
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
|
Description
Holger Schill
I encountered the same problem, but I wonder why LexerErrorContext doesn't supply the RecognitionException. In the nextToken() method of org.eclipse.xtext.parser.antlr.Lexer you have a RecognitionException (line 80 in Xtext 2.4.1): tokenErrorMap.put(t, getErrorMessage(re, this.getTokenNames())); Unfortunately this one is consumed by the getErrorMessage method. If you held the exception in the tokenErrorMap, it would be possible to pass it to the LexerErrorContext in org.eclipse.xtext.parser.antlr.AbstractInternalAntlrParser: String lexerErrorMessage = ((XtextTokenStream) input).getLexerErrorMessage(token); LexerErrorContext errorContext = new LexerErrorContext(lexerErrorMessage); (line 257) A patch is most welcome :-) |