Skip to content

Commit

Permalink
Don't use infinite loop and use correct file for test
Browse files Browse the repository at this point in the history
Gamelan currently playing: And The Darkest Hour Is Just Before The Dawn
co-authored-by: Connor Walsh <[email protected]>
co-authored-by: Octavia <[email protected]>
  • Loading branch information
mouse-reeve committed Apr 7, 2018
1 parent 97460a6 commit eff5c13
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
1 change: 1 addition & 0 deletions lexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func (c *Compterpreter) GetNextToken() (Token, error) {
case c.IsIdentifierFirstSymbol(c.CurrentChar):
// is it a keyword?
// is it a function/variable identifier?
err = c.TokenizeIdentifier(c.CurrentChar)
case c.IsPunctuation(c.CurrentChar):
err = c.TokenizePunctuation(c.CurrentChar)
default:
Expand Down
2 changes: 1 addition & 1 deletion lexer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (s *LexerSuite) TestTokenizeIdentifier() {
// advance ptr to first character
for _, op := range []string{"myVariable"} {
compt.CurrentToken = Token{}
compt.TokenizeOperator(compt.CurrentChar)
compt.TokenizeIdentifier(compt.CurrentChar)
if string(compt.CurrentChar) == "EOF" {
break
}
Expand Down
6 changes: 0 additions & 6 deletions parser.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package dockerlang

import "fmt"

type Stack struct {
Elements []AST
}
Expand Down Expand Up @@ -64,7 +62,6 @@ func (c *Compterpreter) Parse() error {
for i := 0; i < opsExpr.Arity; i++ {
// make sure we're not popping nil into exprs
if exprStack.Peek() == nil {
fmt.Println("1")
return DockerlangSyntaxError
}
opsExpr.Operands = append([]AST{exprStack.Pop()}, opsExpr.Operands...)
Expand All @@ -83,13 +80,10 @@ func (c *Compterpreter) Parse() error {
return DockerlangSyntaxError
}
if opsStack.Peek() != nil {
fmt.Println(opsStack.Peek())
// oh noooo!
return DockerlangSyntaxError
}

fmt.Println(exprStack)

c.StackTree.Operands = []AST{exprStack.Pop().(*Expr)}

return nil
Expand Down

0 comments on commit eff5c13

Please sign in to comment.