Behat\Gherkin\Parser::parseStep PHP Method

parseStep() protected method

Parses step token & returns it's node.
protected parseStep ( ) : Behat\Gherkin\Node\StepNode
return Behat\Gherkin\Node\StepNode
    protected function parseStep()
    {
        $token = $this->expectTokenType('Step');
        $keyword = $token['value'];
        $keywordType = $token['keyword_type'];
        $text = trim($token['text']);
        $line = $token['line'];
        $arguments = array();
        while (in_array($predicted = $this->predictTokenType(), array('PyStringOp', 'TableRow', 'Newline', 'Comment'))) {
            if ('Comment' === $predicted || 'Newline' === $predicted) {
                $this->acceptTokenType($predicted);
                continue;
            }
            $node = $this->parseExpression();
            if ($node instanceof PyStringNode || $node instanceof TableNode) {
                $arguments[] = $node;
            }
        }
        return new StepNode($keyword, $text, $arguments, $line, $keywordType);
    }

Usage Example

Beispiel #1
0
 /**
  * {@inheritdoc}
  */
 protected function parseStep()
 {
     $node = parent::parseStep();
     return $node;
 }