src/Behat/Gherkin/Lexer.php
protected function scanInputForKeywords($keywords, $type)
    {
        if (!preg_match('/^(\s*)(' . $keywords . '):\s*(.*)/u', $this->line, $matches)) {
            return null;
        }

        $token = $this->takeToken($type, $matches[3]);
        $token['keyword'] = $matches[2];
        $token['indent'] = mb_strlen($matches[1], 'utf8');

        $this->consumeLine();

        // turn off language searching
        if ('Feature' === $type) {
            $this->featureStarted = true;
        }

        // turn off PyString and Table searching
        if ('Feature' === $type || 'Scenario' === $type || 'Outline' === $type) {
            $this->allowMultilineArguments = false;
        } elseif ('Examples' === $type) {
            $this->allowMultilineArguments = true;
        }

        // turn on steps searching
        if ('Scenario' === $type || 'Background' === $type || 'Outline' === $type) {
            $this->allowSteps = true;
        }

        return $token;
    }
protected function scanInputForKeywords($keywords, $type)
    {
        if (!preg_match('/^(\s*)(' . $keywords . '):\s*(.*)/u', $this->line, $matches)) {
            return null;
        }

        $token = $this->takeToken($type, $matches[3]);
        $token['keyword'] = $matches[2];
        $token['indent'] = mb_strlen($matches[1], 'utf8');

        $this->consumeLine();

        // turn off language searching
        if ('Feature' === $type) {
            $this->featureStarted = true;
        }

        // turn off PyString and Table searching
        if ('Feature' === $type || 'Scenario' === $type || 'Outline' === $type) {
            $this->allowMultilineArguments = false;
        } elseif ('Examples' === $type) {
            $this->allowMultilineArguments = true;
        }

        // turn on steps searching
        if ('Scenario' === $type || 'Background' === $type || 'Outline' === $type) {
            $this->allowSteps = true;
        }

        return $token;
    }
protected function scanInputForKeywords ( $ keywords , $ type ) { if ( ! preg_match ( '/^(\s*)(' . $ keywords . '):\s*(.*)/u' , $ this -> line , $ matches ) ) { return null ; } $ token = $ this -> takeToken ( $ type , $ matches [ 3 ] ) ; $ token [ 'keyword' ] = $ matches [ 2 ] ; $ token [ 'indent' ] = mb_strlen ( $ matches [ 1 ] , 'utf8' ) ; $ this -> consumeLine ( ) ; // turn off language searching if ( 'Feature' === $ type ) { $ this -> featureStarted = true ; } // turn off PyString and Table searching if ( 'Feature' === $ type || 'Scenario' === $ type || 'Outline' === $ type ) { $ this -> allowMultilineArguments = false ; } elseif ( 'Examples' === $ type ) { $ this -> allowMultilineArguments = true ; } // turn on steps searching if ( 'Scenario' === $ type || 'Background' === $ type || 'Outline' === $ type ) { $ this -> allowSteps = true ; } return $ token ; }
Scans for token with specified keywords.

@param string $keywords Keywords (splitted with |)
@param string $type     Expected token type

@return null|array
Scans for token with specified keywords .