print it nicer

This commit is contained in:
Miek Gieben 2011-09-21 14:34:42 +02:00
parent f73eb899f0
commit 7363deccfe
2 changed files with 10 additions and 1 deletions

View File

@ -44,7 +44,7 @@ func startParse(addr string) {
// Not completely sure about this code..
for {
item := <-l.items
fmt.Printf("%v\n", item)
fmt.Printf("{%s %s}\n", itemString[item.typ], item.val)
if l.state == nil {
break
}

View File

@ -25,6 +25,15 @@ const (
itemVersionPatch // the patch level of the software (empty if not determined)
)
var itemString = map[itemType]string{
itemError: "error",
itemSoftware: "software",
itemVendor: "vendor",
itemVersionMajor: "major",
itemVersionMinor: "minor",
itemVersionPatch: "patch",
}
// stateFn represents the state of the scanner as a function that returns the next state.
type stateFn func(*lexer) stateFn