Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bobertlo committed Dec 5, 2024
1 parent 3400e64 commit 8e67aee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
11 changes: 5 additions & 6 deletions forexpand.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ type forExpander struct {
// output fields
tokens chan token
closed bool
err error
}

type forStateFn func(f *forExpander) forStateFn
Expand Down Expand Up @@ -150,7 +149,7 @@ func forConsumeLabels(f *forExpander) forStateFn {
f.next()
return forConsumeLabels
} else {
f.err = fmt.Errorf("expected label, op, newlines, or comment, got '%s'", f.nextToken)
f.tokens <- token{tokError, fmt.Sprintf("expected label, op, newlines, or comment, got '%s'", f.nextToken)}
return nil
}
}
Expand Down Expand Up @@ -212,11 +211,11 @@ func forConsumeExpression(f *forExpander) forStateFn {
// always returns forInnerLine or Error
func forFor(f *forExpander) forStateFn {
expr := make([]token, 0, len(f.exprBuf))
for _, token := range f.exprBuf {
if token.typ == tokEOF || token.typ == tokError {
f.err = fmt.Errorf("unexpected expression term: %s", token)
for _, tok := range f.exprBuf {
if tok.typ == tokEOF || tok.typ == tokError {
f.tokens <- token{tokError, fmt.Sprintf("unexpected expression term: %s", tok)}
}
expr = append(expr, token)
expr = append(expr, tok)
}
f.exprBuf = expr

Expand Down
1 change: 0 additions & 1 deletion parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ func (p *parser) validateSymbols() error {
for symbol, i := range p.references {
_, ok := p.symbols[symbol]
if !ok {
fmt.Println(p.lines)
return fmt.Errorf("line %d: symbol '%s' undefined", i, symbol)
}
}
Expand Down

0 comments on commit 8e67aee

Please sign in to comment.