func TestParse(t *testing.T) { l := lex.New("testlex", journal1, lexStart) pp := &Parser{} p := parse.New(l, pp.Start) p.Run() for _, trans := range pp.Journal { t.Logf("%+v", trans) } }
func BenchmarkHello(b *testing.B) { data, err := ioutil.ReadFile("/home/robert/git/money/rwc-finances.ledger") if err != nil { b.Fatal(err) } s := string(data) for i := 0; i < b.N; i++ { l := lex.New("testlex", s, lexStart) for _ = range l.Tokens { } } }
func Decode(name string, data []byte) (*Journal, error) { l := lex.New(name, string(data), lexStart) return parse(l) }
func TestLex(t *testing.T) { l := lex.New("testlex", journal1, lexStart) for tok := range l.Tokens { t.Logf("%v: '%v'", tokNames[tok.Type], tok.Val) } }
func TestJournalLex(t *testing.T) { l := lex.New("trans2", trans2, lexStart) for tok := range l.Tokens { t.Logf("------ token %v -------\n'''%v'''\n", tokNames[tok.Type], tok.Val) } }