sync with peg

- Parse now returns an `error'
- leg parser generator writes to stdout now, doesn't
  create a file xy.leg.go anymore
- turn on new optimizations
This commit is contained in:
Michael Teichgräber 2012-04-24 00:15:47 +02:00
parent 0cbfa7b920
commit 0248d52f7e
4 changed files with 7716 additions and 8801 deletions

View File

@ -30,7 +30,7 @@ nuke:
ifeq ($(MAKECMDGOALS),parser) ifeq ($(MAKECMDGOALS),parser)
include $(shell go list -f '{{.Dir}}' github.com/knieriem/peg)/Make.inc include $(shell go list -f '{{.Dir}}' github.com/knieriem/peg)/Make.inc
%.leg.go: %.leg $(LEG) %.leg.go: %.leg $(LEG)
$(LEG) -switch $< $(LEG) -verbose -switch -O all $< > $@
endif endif

View File

@ -60,8 +60,8 @@ func (d *Doc) parseRule(rule int, s string) {
if m.ResetBuffer(s) != "" { if m.ResetBuffer(s) != "" {
log.Fatalf("Buffer not empty") log.Fatalf("Buffer not empty")
} }
if !m.Parse(rule) { if err := m.Parse(rule); err != nil {
m.PrintError() log.Fatalln("markdown:", err)
} }
} }

View File

@ -106,8 +106,6 @@ type Doc struct {
%YYSTYPE *element %YYSTYPE *element
%switchexcl(HtmlBlock Code Title RefTitle)
Doc = a:StartList ( Block { a = cons($$, a) } )* Doc = a:StartList ( Block { a = cons($$, a) } )*
{ p.tree = reverse(a) } { p.tree = reverse(a) }
commit commit

File diff suppressed because it is too large Load Diff