function it_should_create_a_label_from_a_node() { $labelNode = new LabelNode('name', new RuleReferenceNode('Foo')); $labelCode = <<<EOS \$_success = \$this->parseFoo(); if (\$_success) { \$name = \$this->value; } EOS; $labelNode->accept($this->getWrappedObject()); $this->getResult()->shouldBe($labelCode); }
public function visitLabel(LabelNode $node) { $this->scope[] = $node->getName(); $this->results[] = <<<EOS {$this->getResult()} if (\$_success) { \${$node->getName()} = \$this->value; } EOS; }