From 205736c98601329851896bc43e8243bbfe27b31b Mon Sep 17 00:00:00 2001 From: Andy Maloney Date: Mon, 22 Jan 2024 11:09:40 -0500 Subject: [PATCH] Change a couple of function names for clarity (#405) --- amod/amod.go | 4 ++-- amod/parse.go | 6 +++--- amod/parse_test.go | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/amod/amod.go b/amod/amod.go index 9f4b4b90..1ba16445 100644 --- a/amod/amod.go +++ b/amod/amod.go @@ -56,7 +56,7 @@ func GenerateModel(buffer string) (model *actr.Model, iLog *issues.Log, err erro log := newLog() iLog = &log.Log - amod, err := parse(r) + amod, err := parseAMOD(r) if err != nil { pErr, ok := err.(participle.Error) if ok { @@ -88,7 +88,7 @@ func GenerateModelFromFile(fileName string) (model *actr.Model, iLog *issues.Log log := newLog() iLog = &log.Log - amod, err := parseFile(fileName) + amod, err := parseAMODFile(fileName) if err != nil { pErr, ok := err.(participle.Error) if ok { diff --git a/amod/parse.go b/amod/parse.go index b962af63..2d4b9c08 100644 --- a/amod/parse.go +++ b/amod/parse.go @@ -443,7 +443,7 @@ var amodParser = participle.MustBuild[amodFile]( participle.Unquote(), ) -func parse(r io.Reader) (amod *amodFile, err error) { +func parseAMOD(r io.Reader) (amod *amodFile, err error) { amod, err = amodParser.Parse("", r) if err != nil { return nil, err @@ -452,12 +452,12 @@ func parse(r io.Reader) (amod *amodFile, err error) { return } -func parseFile(filename string) (*amodFile, error) { +func parseAMODFile(filename string) (*amodFile, error) { file, err := os.Open(filename) if err != nil { return nil, err } defer file.Close() - return parse(file) + return parseAMOD(file) } diff --git a/amod/parse_test.go b/amod/parse_test.go index 396987c8..a39c08f8 100644 --- a/amod/parse_test.go +++ b/amod/parse_test.go @@ -20,7 +20,7 @@ func TestMinimumModel(t *testing.T) { ~~ init ~~ ~~ productions ~~` - _, err := parse(strings.NewReader(src)) + _, err := parseAMOD(strings.NewReader(src)) if err != nil { t.Errorf("Could not parse minimal src: %s", err.Error()) @@ -43,7 +43,7 @@ func FuzzExampleModels(f *testing.F) { } f.Fuzz(func(t *testing.T, orig string) { - _, err := parse(strings.NewReader(orig)) + _, err := parseAMOD(strings.NewReader(orig)) if err != nil && !errors.As(err, new(*participle.ParseError)) && !errors.As(err, new(*participle.UnexpectedTokenError)) &&