Skip to content

Commit

Permalink
Change a couple of function names for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
asmaloney committed Jan 22, 2024
1 parent 656a905 commit ffb0f17
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions amod/amod.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions amod/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
}
4 changes: 2 additions & 2 deletions amod/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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)) &&
Expand Down

0 comments on commit ffb0f17

Please sign in to comment.