pboyer / antlr4

ANTLR (ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files.
http://antlr.org
Other
26 stars 1 forks source link

Fix remaining tests #64

Closed pboyer closed 8 years ago

pboyer commented 8 years ago

@willfaught PTAL

willfaught commented 8 years ago

I see what you mean. What I described won't work. LGTM.

On Oct 11, 2016, at 12:42 PM, Peter Boyer notifications@github.com wrote:

@pboyer commented on this pull request.

In runtime/Go/antlr/lexer.go:

TokenStartCharIndex int

TokenStartLine int TokenStartColumn int ActionType int

  • Virt Lexer // The most derived lexer implementation. Allows virtual method calls. Hmm. Let me give some context. PositionAdjustingLexer overrides NextToken and then calls BaseLexer's implementation of the same. Previously, BaseLexer had calls in NextToken to BaseLexer.Emit, which *PositionAdjustingLexer also overrides. This method call was not to an interface type, hence no dynamic dispatch and the wrong method was called (that of the "super class").

By passing the interface type Lexer (runtime type of _PositionAdjustLexer) to the "super class" (_BaseLexer) it can make proper virtual method calls. I don't think your solution would do this.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.