cmd/easm: print debug to stderr

This commit is contained in:
Jeffrey Wilcke 2017-02-19 22:52:21 +01:00
parent 10a090a75a
commit 75bb2958cc
No known key found for this signature in database
GPG key ID: 63FF149CD6945F9E
2 changed files with 3 additions and 3 deletions

View file

@ -2,6 +2,7 @@ package main
import ( import (
"fmt" "fmt"
"os"
"strings" "strings"
"unicode" "unicode"
"unicode/utf8" "unicode/utf8"
@ -168,7 +169,7 @@ func (l *Lexer) emit(t itemType) {
item := item{t, l.lineno, l.blob()} item := item{t, l.lineno, l.blob()}
if l.debug { if l.debug {
fmt.Printf("%04d: (%-20v) %s\n", item.lineno, item.typ, item.text) fmt.Fprintf(os.Stderr, "%04d: (%-20v) %s\n", item.lineno, item.typ, item.text)
} }
l.items <- item l.items <- item

View file

@ -111,7 +111,6 @@ func newCompiler(debug bool) *Compiler {
// position. // position.
func (c *Compiler) feed(ch <-chan item) { func (c *Compiler) feed(ch <-chan item) {
for i := range ch { for i := range ch {
fmt.Println(c.pc, i.text)
switch i.typ { switch i.typ {
case number: case number:
num := common.String2Big(i.text).Bytes() num := common.String2Big(i.text).Bytes()
@ -133,7 +132,7 @@ func (c *Compiler) feed(ch <-chan item) {
c.tokens = append(c.tokens, i) c.tokens = append(c.tokens, i)
} }
if c.debug { if c.debug {
fmt.Println("found", len(c.labels), "labels") fmt.Sprintln(os.Stderr, "found", len(c.labels), "labels")
} }
} }