box-o-sand/farse/cmd/farse-test/main.go

32 lines
477 B
Go

package main
import (
"fmt"
"log"
"os"
farse "../.."
)
func main() {
fl := farse.New()
err := fl.AddKnown(
"-a", "-n", "-q", "-m",
"--azimuth", "--noodle", "--quince",
"whoop", "fizzle", "flim",
)
if err != nil {
log.Fatal(err)
}
fmt.Println("known:")
for key, tokType := range fl.Known() {
fmt.Printf(" %v: %s\n", key, tokType)
}
fmt.Println("scanned:")
for _, tok := range fl.Scan(os.Args) {
fmt.Printf(" %v: %s\n", tok.Value, tok.Type)
}
}