HumHub Documentation (unofficial)

Parser
in package

Gherkin parser.

$lexer = new Behat\Gherkin\Lexer($keywords); $parser = new Behat\Gherkin\Parser($lexer); $featuresArray = $parser->parse('/path/to/feature.feature');

Tags
author

Konstantin Kudryashov ever.zet@gmail.com

Table of Contents

Properties

$file  : mixed
$input  : mixed
$languageSpecifierLine  : mixed
$lexer  : mixed
$passedNodesStack  : mixed
$tags  : mixed

Methods

__construct()  : mixed
Initializes parser.
parse()  : FeatureNode|null
Parses input & returns features array.
acceptTokenType()  : null|array<string|int, mixed>
Returns next token if it's type equals to expected.
expectTokenType()  : array<string|int, mixed>
Returns next token if it's type equals to expected.
guardTags()  : mixed
Checks the tags fit the required format
parseBackground()  : BackgroundNode
Parses background token & returns it's node.
parseExamples()  : ExampleTableNode
Parses examples table node.
parseExpression()  : string|FeatureNode|BackgroundNode|ScenarioNode|OutlineNode|TableNode|StepNode
Parses current expression & returns Node.
parseFeature()  : FeatureNode
Parses feature token & returns it's node.
parseLanguage()  : BackgroundNode|FeatureNode|OutlineNode|ScenarioNode|StepNode|TableNode|string
Parses language block and updates lexer configuration based on it.
parseNewline()  : string
Parses next newline & returns \n.
parseOutline()  : OutlineNode
Parses scenario outline token & returns it's node.
parsePyString()  : PyStringNode
Parses PyString token & returns it's node.
parseScenario()  : ScenarioNode
Parses scenario token & returns it's node.
parseStep()  : StepNode
Parses step token & returns it's node.
parseTable()  : TableNode
Parses table token & returns it's node.
parseTags()  : BackgroundNode|FeatureNode|OutlineNode|ScenarioNode|StepNode|TableNode|string
Parses tags.
parseText()  : string
Parses next text line & returns it.
popTags()  : array<string|int, mixed>
Returns current set of tags and clears tag buffer.
predictTokenType()  : string
Returns next token type without real input reading (prediction).
normalizeStepNodeKeywordType()  : StepNode
Changes step node type for types But, And to type of previous step if it exists else sets to Given
parseTableRows()  : array<string|int, array<string|int, string>>
Parses the rows of a table
rethrowNodeException()  : void

Properties

$languageSpecifierLine

private mixed $languageSpecifierLine

$passedNodesStack

private mixed $passedNodesStack = array()

$tags

private mixed $tags = array()

Methods

__construct()

Initializes parser.

public __construct(Lexer $lexer) : mixed
Parameters
$lexer : Lexer

Lexer instance

parse()

Parses input & returns features array.

public parse(string $input[, string $file = null ]) : FeatureNode|null
Parameters
$input : string

Gherkin string document

$file : string = null

File name

Tags
throws
ParserException
Return values
FeatureNode|null

acceptTokenType()

Returns next token if it's type equals to expected.

protected acceptTokenType(string $type) : null|array<string|int, mixed>
Parameters
$type : string

Token type

Return values
null|array<string|int, mixed>

expectTokenType()

Returns next token if it's type equals to expected.

protected expectTokenType(string $type) : array<string|int, mixed>
Parameters
$type : string

Token type

Tags
throws
ParserException
Return values
array<string|int, mixed>

guardTags()

Checks the tags fit the required format

protected guardTags(array<string|int, string> $tags) : mixed
Parameters
$tags : array<string|int, string>

parseNewline()

Parses next newline & returns \n.

protected parseNewline() : string
Return values
string

parseText()

Parses next text line & returns it.

protected parseText() : string
Return values
string

popTags()

Returns current set of tags and clears tag buffer.

protected popTags() : array<string|int, mixed>
Return values
array<string|int, mixed>

predictTokenType()

Returns next token type without real input reading (prediction).

protected predictTokenType() : string
Return values
string

normalizeStepNodeKeywordType()

Changes step node type for types But, And to type of previous step if it exists else sets to Given

private normalizeStepNodeKeywordType(StepNode $node[, array<string|int, StepNode$steps = array() ]) : StepNode
Parameters
$node : StepNode
$steps : array<string|int, StepNode> = array()
Return values
StepNode

parseTableRows()

Parses the rows of a table

private parseTableRows() : array<string|int, array<string|int, string>>
Return values
array<string|int, array<string|int, string>>

        
On this page

Search results