PHP Class Behat\Gherkin\Lexer

Author: Konstantin Kudryashov ([email protected])
Exibir arquivo Open project: behat/gherkin

Public Methods

Method Description
__construct ( Behat\Gherkin\Keywords\KeywordsInterface $keywords ) Initializes lexer.
analyse ( string $input, string $language = 'en' ) Sets lexer input.
deferToken ( array $token ) Defers token.
getAdvancedToken ( ) : array Returns next token or previously stashed one.
getLanguage ( ) : string Returns current lexer language.
predictToken ( ) : array Predicts for number of tokens.
takeToken ( string $type, string $value = null ) : array Constructs token with specified parameters.

Protected Methods

Method Description
consumeLine ( ) Consumes line from input & increments line counter.
getDeferredToken ( ) : array | null Returns deferred token or null if hasn't.
getKeywords ( string $type ) : string Returns keywords for provided type.
getNextToken ( ) : array Returns next token from input.
getStashedToken ( ) : array | null Returns stashed token or null if hasn't.
getTrimmedLine ( ) : string Returns trimmed version of line.
scanBackground ( ) : null | array Scans Background from input & returns it if found.
scanComment ( ) : null | array Scans Comment from input & returns it if found.
scanEOS ( ) : null | array Scans EOS from input & returns it if found.
scanExamples ( ) : null | array Scans Scenario Outline Examples from input & returns it if found.
scanFeature ( ) : null | array Scans Feature from input & returns it if found.
scanInput ( string $regex, string $type ) : null | array Scans for token with specified regex.
scanInputForKeywords ( string $keywords, string $type ) : null | array Scans for token with specified keywords.
scanLanguage ( ) : null | array Scans Language specifier from input & returns it if found.
scanNewline ( ) : null | array Scans Newline from input & returns it if found.
scanOutline ( ) : null | array Scans Scenario Outline from input & returns it if found.
scanPyStringContent ( ) : null | array Scans PyString content.
scanPyStringOp ( ) : null | array Scans PyString from input & returns it if found.
scanScenario ( ) : null | array Scans Scenario from input & returns it if found.
scanStep ( ) : null | array Scans Step from input & returns it if found.
scanTableRow ( ) : null | array Scans Table Row from input & returns it if found.
scanTags ( ) : null | array Scans Tags from input & returns it if found.
scanText ( ) : null | array Scans text from input & returns it if found.

Private Methods

Method Description
getStepKeywordType ( string $native ) : string Returns step type keyword (Given, When, Then, etc.).

Method Details

__construct() public method

Initializes lexer.
public __construct ( Behat\Gherkin\Keywords\KeywordsInterface $keywords )
$keywords Behat\Gherkin\Keywords\KeywordsInterface Keywords holder

analyse() public method

Sets lexer input.
public analyse ( string $input, string $language = 'en' )
$input string Input string
$language string Language name

consumeLine() protected method

Consumes line from input & increments line counter.
protected consumeLine ( )

deferToken() public method

Defers token.
public deferToken ( array $token )
$token array Token to defer

getAdvancedToken() public method

Returns next token or previously stashed one.
public getAdvancedToken ( ) : array
return array

getDeferredToken() protected method

Returns deferred token or null if hasn't.
protected getDeferredToken ( ) : array | null
return array | null

getKeywords() protected method

Returns keywords for provided type.
protected getKeywords ( string $type ) : string
$type string Keyword type
return string

getLanguage() public method

Returns current lexer language.
public getLanguage ( ) : string
return string

getNextToken() protected method

Returns next token from input.
protected getNextToken ( ) : array
return array

getStashedToken() protected method

Returns stashed token or null if hasn't.
protected getStashedToken ( ) : array | null
return array | null

getTrimmedLine() protected method

Returns trimmed version of line.
protected getTrimmedLine ( ) : string
return string

predictToken() public method

Predicts for number of tokens.
public predictToken ( ) : array
return array

scanBackground() protected method

Scans Background from input & returns it if found.
protected scanBackground ( ) : null | array
return null | array

scanComment() protected method

Scans Comment from input & returns it if found.
protected scanComment ( ) : null | array
return null | array

scanEOS() protected method

Scans EOS from input & returns it if found.
protected scanEOS ( ) : null | array
return null | array

scanExamples() protected method

Scans Scenario Outline Examples from input & returns it if found.
protected scanExamples ( ) : null | array
return null | array

scanFeature() protected method

Scans Feature from input & returns it if found.
protected scanFeature ( ) : null | array
return null | array

scanInput() protected method

Scans for token with specified regex.
protected scanInput ( string $regex, string $type ) : null | array
$regex string Regular expression
$type string Expected token type
return null | array

scanInputForKeywords() protected method

Scans for token with specified keywords.
protected scanInputForKeywords ( string $keywords, string $type ) : null | array
$keywords string Keywords (splitted with |)
$type string Expected token type
return null | array

scanLanguage() protected method

Scans Language specifier from input & returns it if found.
protected scanLanguage ( ) : null | array
return null | array

scanNewline() protected method

Scans Newline from input & returns it if found.
protected scanNewline ( ) : null | array
return null | array

scanOutline() protected method

Scans Scenario Outline from input & returns it if found.
protected scanOutline ( ) : null | array
return null | array

scanPyStringContent() protected method

Scans PyString content.
protected scanPyStringContent ( ) : null | array
return null | array

scanPyStringOp() protected method

Scans PyString from input & returns it if found.
protected scanPyStringOp ( ) : null | array
return null | array

scanScenario() protected method

Scans Scenario from input & returns it if found.
protected scanScenario ( ) : null | array
return null | array

scanStep() protected method

Scans Step from input & returns it if found.
protected scanStep ( ) : null | array
return null | array

scanTableRow() protected method

Scans Table Row from input & returns it if found.
protected scanTableRow ( ) : null | array
return null | array

scanTags() protected method

Scans Tags from input & returns it if found.
protected scanTags ( ) : null | array
return null | array

scanText() protected method

Scans text from input & returns it if found.
protected scanText ( ) : null | array
return null | array

takeToken() public method

Constructs token with specified parameters.
public takeToken ( string $type, string $value = null ) : array
$type string Token type
$value string Token value
return array