Skip to content

Commit 677da98

Browse files
committed
[Go] Make SetTokenSource public
This aligns the golang runtime with other languages where the SetTokenSource is publicly available. We require this in our usage of antlr4. We currently have a fork for the sole purpose of this.
1 parent cb85012 commit 677da98

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

runtime/Go/antlr/v4/lexer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ func (b *BaseLexer) GetTokenFactory() TokenFactory {
159159
return b.factory
160160
}
161161

162-
func (b *BaseLexer) setTokenFactory(f TokenFactory) {
162+
func (b *BaseLexer) SetTokenFactory(f TokenFactory) {
163163
b.factory = f
164164
}
165165

runtime/Go/antlr/v4/parser.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,8 @@ func (p *BaseParser) GetTokenFactory() TokenFactory {
317317
}
318318

319319
// setTokenFactory is used to tell our token source and error strategy about a new way to create tokens.
320-
func (p *BaseParser) setTokenFactory(factory TokenFactory) {
321-
p.input.GetTokenSource().setTokenFactory(factory)
320+
func (p *BaseParser) SetTokenFactory(factory TokenFactory) {
321+
p.input.GetTokenSource().SetTokenFactory(factory)
322322
}
323323

324324
// GetATNWithBypassAlts - the ATN with bypass alternatives is expensive to create, so we create it

runtime/Go/antlr/v4/token_source.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ type TokenSource interface {
1212
GetCharPositionInLine() int
1313
GetInputStream() CharStream
1414
GetSourceName() string
15-
setTokenFactory(factory TokenFactory)
15+
SetTokenFactory(factory TokenFactory)
1616
GetTokenFactory() TokenFactory
1717
}

0 commit comments

Comments
 (0)