NAME
Gherkin::TokenMatcher - Line token matching for the Gherkin parser
SYNOPSIS
use Gherkin::TokenMatcher;
use Gherkin::Dialect;
# Instantiate a token matcher with the default language 'Emoji'
my $matcher = Gherkin::TokenMatcher->new( {
dialect => Gherkin::Dialect->new( { dialect => 'em'} )
} );
DESCRIPTION
The Gherkin language has a line-based structure. The parser knows about state, but defers identifying the type of line tokens to the token matcher. The matcher knows how to identify line tokens based on the grammar's keywords. Although the matcher knows how to identify line tokens based on the keywords, it depends on Gherkin::Dialect to provide the actual keyword texts.
METHODS
new( [$options] )
Constructor.
$options
is a hashref with the following keys:
dialect
-
An instance of Gherkin::Dialect to provide the keyword texts used to identify the type of line-token being matched.
dialect_name
Returns the name of the current dialect selected from the dialect
instance.
change_dialect
Changes the selected dialect on the dialect
instance. Dialects are groups of keywords belonging together; this is how keyword translations are being handled.
reset
Changes the token scanner's state back to its initial state; used to restart scanning a document. Multiple documents may be parsed using a single token scanner with a reset
call in-between.
SEE ALSO
LICENSE
See Gherkin.