Skip to content

Commit

Permalink
avoid weird side effects by cloning the parsers that assembly macro p…
Browse files Browse the repository at this point in the history
…atterns
  • Loading branch information
marcioAlmada committed Nov 28, 2015
1 parent 094422a commit c8837e1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Macro.php
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ private function layer(string $start, string $end, Parser $parser) : Parser {
)
->onCommit(function(Ast $result) use($parser) {
$id = $this->lookupCapture($result->label);
$this->parsers[] = $parser->as($id);
$this->parsers[] = (clone $parser)->as($id);
});
}

Expand Down

0 comments on commit c8837e1

Please sign in to comment.