Skip to content

Commit

Permalink
get rid of exxtra prints
Browse files Browse the repository at this point in the history
  • Loading branch information
jmoiron committed May 28, 2014
1 parent 0efeedd commit 4e2aa3c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
12 changes: 10 additions & 2 deletions neo/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,16 @@ func (m *MapExpr) append(n *MapElem) {
}

func (m *MapExpr) String() string {
// FIXME: do it right
return fmt.Sprintf("{%s}", m.Elems)
b := new(bytes.Buffer)
b.WriteString("{")
for i, n := range m.Elems {
fmt.Fprint(b, n)
if i != len(m.Elems)-1 {
b.WriteString(", ")
}
}
b.WriteString("}")
return b.String()
}

func (m *MapExpr) Copy() Node {
Expand Down
6 changes: 1 addition & 5 deletions neo/ast_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package jigo

import (
"fmt"
"testing"
)
import "testing"

func TestStack(t *testing.T) {
var p Pos
Expand Down Expand Up @@ -47,5 +44,4 @@ func TestStack(t *testing.T) {
if s.len() != 1 {
t.Errorf("Expected len of 1, got %d\n", s.len())
}
fmt.Println(s)
}
3 changes: 0 additions & 3 deletions neo/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ func (t *Tree) parse() (next Node) {
switch t.peek().typ {
case tokenBlockBegin:
// the start of a {% .. %} tag block.
fmt.Println("Got BlockBegin")
continue

case tokenVariableBegin:
Expand Down Expand Up @@ -410,7 +409,6 @@ func (t *Tree) parseExpr(stack *nodeStack, terminator itemType) Node {
fmt.Printf("Stack: %#v\n", stack)
t.unexpected(token, "zero length expression")
}
fmt.Println(stack, stack.len())
return stack.pop()
case tokenName:
stack.push(t.lookupExpr())
Expand Down Expand Up @@ -449,7 +447,6 @@ func (t *Tree) parseExpr(stack *nodeStack, terminator itemType) Node {
lhs := stack.pop()
rhs := t.parseExpr(stack, terminator)
// we know this strongly binds ltr so no need to peek
fmt.Println(lhs, rhs)
stack.push(newMulExpr(lhs, rhs, token))
} else {
t.unexpected(token, "binary op")
Expand Down

0 comments on commit 4e2aa3c

Please sign in to comment.