Example #1
0
 /**
  * @test
  */
 public function pushAndGetFromStackWorks()
 {
     $rootNode = new RootNode();
     $this->parsingState->pushNodeToStack($rootNode);
     $this->assertSame($rootNode, $this->parsingState->getNodeFromStack($rootNode), 'Node returned from stack was not the right one.');
     $this->assertSame($rootNode, $this->parsingState->popNodeFromStack($rootNode), 'Node popped from stack was not the right one.');
 }
Example #2
0
 /**
  * Handler for array syntax. This creates the array object recursively and
  * adds it to the current node.
  *
  * @param ParsingState $state The current parsing state
  * @param array $arrayText The array as string.
  * @return void
  */
 protected function arrayHandler(ParsingState $state, $arrayText)
 {
     $arrayNode = new ArrayNode($arrayText);
     $state->getNodeFromStack()->addChildNode($arrayNode);
 }