added .Input to newly created Results
This commit is contained in:
parent
a7c195f799
commit
cf289e6474
@ -12,6 +12,7 @@ func Seq(parsers ...Parserish) Parser {
|
|||||||
node.Child = make([]Result, len(parserfied))
|
node.Child = make([]Result, len(parserfied))
|
||||||
startpos := ps.Pos
|
startpos := ps.Pos
|
||||||
for i, parser := range parserfied {
|
for i, parser := range parserfied {
|
||||||
|
node.Child[i].Input = node.Input
|
||||||
parser(ps, &node.Child[i])
|
parser(ps, &node.Child[i])
|
||||||
if ps.Errored() {
|
if ps.Errored() {
|
||||||
ps.Pos = startpos
|
ps.Pos = startpos
|
||||||
@ -97,7 +98,7 @@ func manyImpl(min int, op Parserish, sep ...Parserish) Parser {
|
|||||||
node.Child = make([]Result, 0, 5)
|
node.Child = make([]Result, 0, 5)
|
||||||
startpos := ps.Pos
|
startpos := ps.Pos
|
||||||
for {
|
for {
|
||||||
node.Child = append(node.Child, Result{})
|
node.Child = append(node.Child, Result{Input: node.Input})
|
||||||
opParser(ps, &node.Child[len(node.Child)-1])
|
opParser(ps, &node.Child[len(node.Child)-1])
|
||||||
if ps.Errored() {
|
if ps.Errored() {
|
||||||
if len(node.Child)-1 < min || ps.Cut > ps.Pos {
|
if len(node.Child)-1 < min || ps.Cut > ps.Pos {
|
||||||
|
Loading…
Reference in New Issue
Block a user