From fafd42a1dcf1fb4aac5c3c6f5b30f8016a8dd625 Mon Sep 17 00:00:00 2001 From: Francois Saint-Jacques Date: Wed, 9 Apr 2025 07:39:58 -0400 Subject: [PATCH] [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. Signed-off-by: Francois Saint-Jacques --- runtime/Go/antlr/v4/lexer.go | 2 +- runtime/Go/antlr/v4/parser.go | 4 ++-- runtime/Go/antlr/v4/token_source.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/runtime/Go/antlr/v4/lexer.go b/runtime/Go/antlr/v4/lexer.go index e5594b2168..c1faf81e4e 100644 --- a/runtime/Go/antlr/v4/lexer.go +++ b/runtime/Go/antlr/v4/lexer.go @@ -159,7 +159,7 @@ func (b *BaseLexer) GetTokenFactory() TokenFactory { return b.factory } -func (b *BaseLexer) setTokenFactory(f TokenFactory) { +func (b *BaseLexer) SetTokenFactory(f TokenFactory) { b.factory = f } diff --git a/runtime/Go/antlr/v4/parser.go b/runtime/Go/antlr/v4/parser.go index fb57ac15db..5ca4ac7e15 100644 --- a/runtime/Go/antlr/v4/parser.go +++ b/runtime/Go/antlr/v4/parser.go @@ -317,8 +317,8 @@ func (p *BaseParser) GetTokenFactory() TokenFactory { } // setTokenFactory is used to tell our token source and error strategy about a new way to create tokens. -func (p *BaseParser) setTokenFactory(factory TokenFactory) { - p.input.GetTokenSource().setTokenFactory(factory) +func (p *BaseParser) SetTokenFactory(factory TokenFactory) { + p.input.GetTokenSource().SetTokenFactory(factory) } // GetATNWithBypassAlts - the ATN with bypass alternatives is expensive to create, so we create it diff --git a/runtime/Go/antlr/v4/token_source.go b/runtime/Go/antlr/v4/token_source.go index a3f36eaa67..1040aa1bfc 100644 --- a/runtime/Go/antlr/v4/token_source.go +++ b/runtime/Go/antlr/v4/token_source.go @@ -12,6 +12,6 @@ type TokenSource interface { GetCharPositionInLine() int GetInputStream() CharStream GetSourceName() string - setTokenFactory(factory TokenFactory) + SetTokenFactory(factory TokenFactory) GetTokenFactory() TokenFactory }