Loading androidmk/parser/ast.go +2 −1 Original line number Diff line number Diff line Loading @@ -84,6 +84,7 @@ type Rule struct { Prerequisites *MakeString RecipePos Pos Recipe string RecipeEndPos Pos } func (x *Rule) Dump() string { Loading @@ -95,7 +96,7 @@ func (x *Rule) Dump() string { } func (x *Rule) Pos() Pos { return x.Target.Pos() } func (x *Rule) End() Pos { return Pos(int(x.RecipePos) + len(x.Recipe)) } func (x *Rule) End() Pos { return x.RecipeEndPos } type Variable struct { Name *MakeString Loading androidmk/parser/parser.go +1 −0 Original line number Diff line number Diff line Loading @@ -448,6 +448,7 @@ loop: Prerequisites: prerequisites, Recipe: recipe, RecipePos: recipePos, RecipeEndPos: p.pos(), }) } } Loading androidmk/parser/parser_test.go +22 −0 Original line number Diff line number Diff line Loading @@ -124,3 +124,25 @@ func TestParse(t *testing.T) { }) } } func TestRuleEnd(t *testing.T) { name := "ruleEndTest" in := `all: ifeq (A, A) echo foo echo foo echo foo echo foo endif echo bar ` p := NewParser(name, bytes.NewBufferString(in)) got, errs := p.Parse() if len(errs) != 0 { t.Fatalf("Unexpected errors while parsing: %v", errs) } if got[0].End() < got[len(got) -1].Pos() { t.Errorf("Rule's end (%d) is smaller than directive that inside of rule's start (%v)\n", got[0].End(), got[len(got) -1].Pos()) } } Loading
androidmk/parser/ast.go +2 −1 Original line number Diff line number Diff line Loading @@ -84,6 +84,7 @@ type Rule struct { Prerequisites *MakeString RecipePos Pos Recipe string RecipeEndPos Pos } func (x *Rule) Dump() string { Loading @@ -95,7 +96,7 @@ func (x *Rule) Dump() string { } func (x *Rule) Pos() Pos { return x.Target.Pos() } func (x *Rule) End() Pos { return Pos(int(x.RecipePos) + len(x.Recipe)) } func (x *Rule) End() Pos { return x.RecipeEndPos } type Variable struct { Name *MakeString Loading
androidmk/parser/parser.go +1 −0 Original line number Diff line number Diff line Loading @@ -448,6 +448,7 @@ loop: Prerequisites: prerequisites, Recipe: recipe, RecipePos: recipePos, RecipeEndPos: p.pos(), }) } } Loading
androidmk/parser/parser_test.go +22 −0 Original line number Diff line number Diff line Loading @@ -124,3 +124,25 @@ func TestParse(t *testing.T) { }) } } func TestRuleEnd(t *testing.T) { name := "ruleEndTest" in := `all: ifeq (A, A) echo foo echo foo echo foo echo foo endif echo bar ` p := NewParser(name, bytes.NewBufferString(in)) got, errs := p.Parse() if len(errs) != 0 { t.Fatalf("Unexpected errors while parsing: %v", errs) } if got[0].End() < got[len(got) -1].Pos() { t.Errorf("Rule's end (%d) is smaller than directive that inside of rule's start (%v)\n", got[0].End(), got[len(got) -1].Pos()) } }