From c919ddd918d71f498929cbb3db801b7adf4d14ed Mon Sep 17 00:00:00 2001 From: "Jim.Idle" Date: Thu, 18 May 2023 17:52:25 +0800 Subject: [PATCH 1/5] feat: Switch code generation over to the new antlr4-go/antlr repo, update main README.md Signed-off-by: Jim.Idle --- README.md | 6 ++++-- .../antlr/v4/tool/templates/codegen/Go/Go.stg | 16 ++++++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 12bea263d5..c05b3f8c0b 100644 --- a/README.md +++ b/README.md @@ -38,11 +38,13 @@ The default branch for this repo is [`master`](https://github.com/antlr/antlr4/t -Targets such as Go that pull directly from the repository can use the default `master` branch but can also pull from the active `dev` branch: +The Go target now has its own dedicated repo: ```bash -$ go get github.com/antlr/antlr4/runtime/Go/antlr@dev +$ go get github.com/antlr4-go/antlr ``` +**Note** +The dedicated Go repo is for `go get` and `import` only. Go runtime development is still performed in the main `antlr/antlr4` repo. ## Authors and major contributors diff --git a/tool/resources/org/antlr/v4/tool/templates/codegen/Go/Go.stg b/tool/resources/org/antlr/v4/tool/templates/codegen/Go/Go.stg index 27b93c5730..19dcc3f435 100644 --- a/tool/resources/org/antlr/v4/tool/templates/codegen/Go/Go.stg +++ b/tool/resources/org/antlr/v4/tool/templates/codegen/Go/Go.stg @@ -25,7 +25,7 @@ import ( // Grammar author supplied additional includes - "github.com/antlr/antlr4/runtime/Go/antlr/v4" + "github.com/antlr4-go/antlr/v4" ) @@ -54,7 +54,8 @@ package // package parser // -import "github.com/antlr/antlr4/runtime/Go/antlr/v4" +import "github.com/antlr4-go/antlr/v4" + // Listener is a complete listener for a parse tree produced by . type Listener interface { @@ -78,7 +79,7 @@ package // package parser // -import "github.com/antlr/antlr4/runtime/Go/antlr/v4" +import "github.com/antlr4-go/antlr/v4" // BaseListener is a complete listener for a parse tree produced by . type BaseListener struct{} @@ -114,7 +115,9 @@ package // package parser // -import "github.com/antlr/antlr4/runtime/Go/antlr/v4" +import "github.com/antlr4-go/antlr/v4" + +
@@ -140,7 +143,8 @@ package // package parser // -import "github.com/antlr/antlr4/runtime/Go/antlr/v4" +import "github.com/antlr4-go/antlr/v4" + type BaseVisitor struct { *antlr.BaseParseTreeVisitor @@ -1460,7 +1464,7 @@ import ( // Grammar author supplied additional includes - "github.com/antlr/antlr4/runtime/Go/antlr/v4" + "github.com/antlr4-go/antlr/v4" ) From 561ef8588a50190e15cc3085b4e6a1a274bf36b6 Mon Sep 17 00:00:00 2001 From: "Jim.Idle" Date: Thu, 18 May 2023 18:20:26 +0800 Subject: [PATCH 2/5] feat: Move to new Go repo Signed-off-by: Jim.Idle --- .../resources/org/antlr/v4/test/runtime/helpers/Test.go.stg | 2 +- .../test/org/antlr/v4/test/runtime/go/GoRunner.java | 2 +- runtime/Go/antlr/v4/go.mod | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/helpers/Test.go.stg b/runtime-testsuite/resources/org/antlr/v4/test/runtime/helpers/Test.go.stg index 18331fef45..e91b429575 100644 --- a/runtime-testsuite/resources/org/antlr/v4/test/runtime/helpers/Test.go.stg +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/helpers/Test.go.stg @@ -1,7 +1,7 @@ package main import ( "fmt" - "github.com/antlr/antlr4/runtime/Go/antlr/v4" + "github.com/antlr4-go/antlr/v4" "os" "test/parser" ) diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/GoRunner.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/GoRunner.java index 0acea980ed..69943126e9 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/GoRunner.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/GoRunner.java @@ -64,7 +64,7 @@ public String[] getExtraRunArgs() { return new String[]{"run"}; } - private static final String GoRuntimeImportPath = "github.com/antlr/antlr4/runtime/Go/antlr/v4"; + private static final String GoRuntimeImportPath = "github.com/antlr4-go/antlr/v4"; private final static Map environment; diff --git a/runtime/Go/antlr/v4/go.mod b/runtime/Go/antlr/v4/go.mod index ec024f41bb..79a2576f0c 100644 --- a/runtime/Go/antlr/v4/go.mod +++ b/runtime/Go/antlr/v4/go.mod @@ -1,4 +1,4 @@ -module github.com/antlr/antlr4/runtime/Go/antlr/v4 +module github.com/antlr4-go/antlr/v4 go 1.20 From b37e20848211892e3a6759d34343629ee00fb71e Mon Sep 17 00:00:00 2001 From: "Jim.Idle" Date: Fri, 19 May 2023 10:00:33 +0800 Subject: [PATCH 3/5] fix: Remove go.mod from v1 tree - it wasn't being found anyway Signed-off-by: Jim.Idle --- runtime/Go/antlr/go.mod | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 runtime/Go/antlr/go.mod diff --git a/runtime/Go/antlr/go.mod b/runtime/Go/antlr/go.mod deleted file mode 100644 index a3d3a77616..0000000000 --- a/runtime/Go/antlr/go.mod +++ /dev/null @@ -1,4 +0,0 @@ -// Deprecated: Please switch to the new v4 module path: github.com/antlr/antlr4/runtime/Go/antlr/v4 - see https://github.com/antlr/antlr4/blob/master/doc/go-target.md -module github.com/antlr/antlr4/runtime/Go/antlr - -go 1.18 From e95657d793fc18d36e3ced46db97157addb2c509 Mon Sep 17 00:00:00 2001 From: "Jim.Idle" Date: Fri, 19 May 2023 10:02:06 +0800 Subject: [PATCH 4/5] feat: Use the latest version of x/exp Signed-off-by: Jim.Idle --- runtime/Go/antlr/v4/go.mod | 2 +- runtime/Go/antlr/v4/go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/runtime/Go/antlr/v4/go.mod b/runtime/Go/antlr/v4/go.mod index 79a2576f0c..cc695e09ba 100644 --- a/runtime/Go/antlr/v4/go.mod +++ b/runtime/Go/antlr/v4/go.mod @@ -2,4 +2,4 @@ module github.com/antlr4-go/antlr/v4 go 1.20 -require golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e +require golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc diff --git a/runtime/Go/antlr/v4/go.sum b/runtime/Go/antlr/v4/go.sum index 2b05f22a47..5bdfc81b53 100644 --- a/runtime/Go/antlr/v4/go.sum +++ b/runtime/Go/antlr/v4/go.sum @@ -1,2 +1,4 @@ golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA= golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA= +golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc h1:mCRnTeVUjcrhlRmO0VK8a6k6Rrf6TF9htwo2pJVSjIU= +golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w= From c316fefb9af495ada705d05abd8f289c13ff900c Mon Sep 17 00:00:00 2001 From: "Jim.Idle" Date: Fri, 19 May 2023 10:14:17 +0800 Subject: [PATCH 5/5] doc: Make sure that we are using the latest LICENSE file inthe go module Signed-off-by: Jim.Idle --- runtime/Go/antlr/v4/LICENSE | 44 +++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/runtime/Go/antlr/v4/LICENSE b/runtime/Go/antlr/v4/LICENSE index 52cf18e425..a22292eb5a 100644 --- a/runtime/Go/antlr/v4/LICENSE +++ b/runtime/Go/antlr/v4/LICENSE @@ -1,26 +1,28 @@ -Copyright 2021 The ANTLR Project +Copyright (c) 2012-2023 The ANTLR Project. All rights reserved. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. +1. Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. +2. Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. - 3. Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. +3. Neither name of copyright holders nor the names of its contributors +may be used to endorse or promote products derived from this software +without specific prior written permission. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.