From 8ac42a22efd46baba876399a035cce586fc86f13 Mon Sep 17 00:00:00 2001 From: brettlangdon Date: Sun, 23 Aug 2015 12:27:31 -0400 Subject: [PATCH] give main similar output as python -m tokenize --- main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index e6a075c..897d9fe 100644 --- a/main.go +++ b/main.go @@ -15,9 +15,11 @@ func main() { } for { tok := tokenizer.Next() + tokenRange := fmt.Sprintf("%d,%d-%d,%d:", tok.LineStart, tok.ColumnStart, tok.LineEnd, tok.ColumnEnd) + literalRep := fmt.Sprintf("%#v", tok.Literal) + fmt.Printf("%-20s%-15s%15s\n", tokenRange, tok.String(), literalRep) if tok.ID == token.ENDMARKER || tok.ID == token.ERRORTOKEN { break } - fmt.Println(fmt.Sprintf("<%s> %s", tok, tok.Repr())) } }