diff --git a/bootstrap.bash b/bootstrap.bash index 5fcc9c9..b9799f9 100755 --- a/bootstrap.bash +++ b/bootstrap.bash @@ -36,5 +36,4 @@ rm -f peg-bootstrap.peg.go # Build peg cd ../.. ./cmd/peg-bootstrap/peg-bootstrap < peg.peg > peg.peg.go -go build -./peg -inline -switch peg.peg +go tool peg -inline -switch peg.peg diff --git a/generate-grammars.bash b/generate-grammars.bash index 092d50e..97b4e61 100755 --- a/generate-grammars.bash +++ b/generate-grammars.bash @@ -1,10 +1,3 @@ #!/bin/bash -set -Eeuo pipefail - -(cd grammars/c/ && go generate) -(cd grammars/calculator/ && go generate) -(cd grammars/calculatorast/ && go generate) -(cd grammars/fexl/ && go generate) -(cd grammars/java/ && go generate) -(cd grammars/longtest/ && go generate) +exec go generate "$@" ./grammars/... diff --git a/go.mod b/go.mod index f657da0..f563cba 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,5 @@ module github.com/pointlander/peg go 1.25 + +tool github.com/pointlander/peg diff --git a/grammars/c/c_test.go b/grammars/c/c_test.go index 1d93a9b..a5a8422 100644 --- a/grammars/c/c_test.go +++ b/grammars/c/c_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:generate ../../peg -switch -inline c.peg +//go:generate go tool peg -switch -inline c.peg package c diff --git a/grammars/calculator/calculator_test.go b/grammars/calculator/calculator_test.go index 7d87775..eff4f39 100644 --- a/grammars/calculator/calculator_test.go +++ b/grammars/calculator/calculator_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:generate ../../peg -switch -inline calculator.peg +//go:generate go tool peg -switch -inline calculator.peg package calculator diff --git a/grammars/calculatorast/calculator_test.go b/grammars/calculatorast/calculator_test.go index da586b0..0bd3015 100644 --- a/grammars/calculatorast/calculator_test.go +++ b/grammars/calculatorast/calculator_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:generate ../../peg -switch -inline calculator.peg +//go:generate go tool peg -switch -inline calculator.peg package calculatorast diff --git a/grammars/fexl/fexl_test.go b/grammars/fexl/fexl_test.go index 8b4cdf6..7c226c4 100644 --- a/grammars/fexl/fexl_test.go +++ b/grammars/fexl/fexl_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:generate ../../peg -switch -inline fexl.peg +//go:generate go tool peg -switch -inline fexl.peg package fexl diff --git a/grammars/java/java_test.go b/grammars/java/java_test.go index ea6b3a7..20d7838 100644 --- a/grammars/java/java_test.go +++ b/grammars/java/java_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:generate ../../peg -switch -inline java_1_7.peg +//go:generate go tool peg -switch -inline java_1_7.peg package java diff --git a/grammars/longtest/long_test.go b/grammars/longtest/long_test.go index fc36e87..506656e 100644 --- a/grammars/longtest/long_test.go +++ b/grammars/longtest/long_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:generate ../../peg -switch -inline long.peg +//go:generate go tool peg -switch -inline long.peg package longtest