Documentation ¶
Index ¶
- Constants
- type AstBuilder
- type Background
- type Builder
- type Comment
- type DataTable
- type DocString
- type Examples
- type Feature
- type GherkinDialect
- func (g *GherkinDialect) BackgroundKeywords() []string
- func (g *GherkinDialect) ExamplesKeywords() []string
- func (g *GherkinDialect) FeatureKeywords() []string
- func (g *GherkinDialect) ScenarioKeywords() []string
- func (g *GherkinDialect) ScenarioOutlineKeywords() []string
- func (g *GherkinDialect) StepKeywords() []string
- type GherkinDialectProvider
- type Line
- type LineSpan
- type Location
- type Matcher
- type Node
- type Parser
- type RuleType
- type Scanner
- type Scenario
- type ScenarioDefinition
- type ScenarioOutline
- type Step
- type TableCell
- type TableRow
- type Tag
- type Token
- type TokenType
Constants ¶
const ( DEFAULT_DIALECT = "en" COMMENT_PREFIX = "#" TAG_PREFIX = "@" TITLE_KEYWORD_SEPARATOR = ":" TABLE_CELL_SEPARATOR = '|' ESCAPE_CHAR = '\\' ESCAPED_NEWLINE = 'n' DOCSTRING_SEPARATOR = "\"\"\"" DOCSTRING_ALTERNATIVE_SEPARATOR = "```" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AstBuilder ¶
func NewAstBuilder ¶
func NewAstBuilder() AstBuilder
type Background ¶
type Background struct {
ScenarioDefinition
}
type Feature ¶
type Feature struct { Node Tags []*Tag `json:"tags"` Language string `json:"language,omitempty"` Keyword string `json:"keyword"` Name string `json:"name"` Description string `json:"description,omitempty"` Background *Background `json:"background,omitempty"` ScenarioDefinitions []interface{} `json:"scenarioDefinitions"` Comments []*Comment `json:"comments"` }
type GherkinDialect ¶
type GherkinDialect struct { Language string Name string Native string Keywords map[string][]string }
func (*GherkinDialect) BackgroundKeywords ¶
func (g *GherkinDialect) BackgroundKeywords() []string
func (*GherkinDialect) ExamplesKeywords ¶
func (g *GherkinDialect) ExamplesKeywords() []string
func (*GherkinDialect) FeatureKeywords ¶
func (g *GherkinDialect) FeatureKeywords() []string
func (*GherkinDialect) ScenarioKeywords ¶
func (g *GherkinDialect) ScenarioKeywords() []string
func (*GherkinDialect) ScenarioOutlineKeywords ¶
func (g *GherkinDialect) ScenarioOutlineKeywords() []string
func (*GherkinDialect) StepKeywords ¶
func (g *GherkinDialect) StepKeywords() []string
type GherkinDialectProvider ¶
type GherkinDialectProvider interface {
GetDialect(language string) *GherkinDialect
}
func GherkinDialectsBuildin ¶
func GherkinDialectsBuildin() GherkinDialectProvider
Builtin dialects for af (Afrikaans), am (Armenian), ar (Arabic), bg (Bulgarian), bm (Malay), bs (Bosnian), ca (Catalan), cs (Czech), cy-GB (Welsh), da (Danish), de (German), el (Greek), em (Emoji), en (English), en-Scouse (Scouse), en-au (Australian), en-lol (LOLCAT), en-old (Old English), en-pirate (Pirate), eo (Esperanto), es (Spanish), et (Estonian), fa (Persian), fi (Finnish), fr (French), ga (Irish), gj (Gujarati), gl (Galician), he (Hebrew), hi (Hindi), hr (Croatian), ht (Creole), hu (Hungarian), id (Indonesian), is (Icelandic), it (Italian), ja (Japanese), jv (Javanese), kn (Kannada), ko (Korean), lt (Lithuanian), lu (Luxemburgish), lv (Latvian), mn (Mongolian), nl (Dutch), no (Norwegian), pa (Panjabi), pl (Polish), pt (Portuguese), ro (Romanian), ru (Russian), sk (Slovak), sl (Slovenian), sr-Cyrl (Serbian), sr-Latn (Serbian (Latin)), sv (Swedish), ta (Tamil), th (Thai), tl (Telugu), tlh (Klingon), tr (Turkish), tt (Tatar), uk (Ukrainian), ur (Urdu), uz (Uzbek), vi (Vietnamese), zh-CN (Chinese simplified), zh-TW (Chinese traditional)
type Line ¶
func (*Line) StartsWith ¶
type Matcher ¶
type Matcher interface { MatchEOF(line *Line) (bool, *Token, error) MatchEmpty(line *Line) (bool, *Token, error) MatchComment(line *Line) (bool, *Token, error) MatchTagLine(line *Line) (bool, *Token, error) MatchFeatureLine(line *Line) (bool, *Token, error) MatchBackgroundLine(line *Line) (bool, *Token, error) MatchScenarioLine(line *Line) (bool, *Token, error) MatchScenarioOutlineLine(line *Line) (bool, *Token, error) MatchExamplesLine(line *Line) (bool, *Token, error) MatchStepLine(line *Line) (bool, *Token, error) MatchDocStringSeparator(line *Line) (bool, *Token, error) MatchTableRow(line *Line) (bool, *Token, error) MatchLanguage(line *Line) (bool, *Token, error) MatchOther(line *Line) (bool, *Token, error) Reset() }
func NewLanguageMatcher ¶
func NewLanguageMatcher(gdp GherkinDialectProvider, language string) Matcher
func NewMatcher ¶
func NewMatcher(gdp GherkinDialectProvider) Matcher
type RuleType ¶
type RuleType int
const ( RuleType_None RuleType = iota RuleType__EOF RuleType__Empty RuleType__Comment RuleType__TagLine RuleType__FeatureLine RuleType__BackgroundLine RuleType__ScenarioLine RuleType__ScenarioOutlineLine RuleType__ExamplesLine RuleType__StepLine RuleType__DocStringSeparator RuleType__TableRow RuleType__Language RuleType__Other RuleType_Feature RuleType_Feature_Header RuleType_Background RuleType_Scenario_Definition RuleType_Scenario RuleType_ScenarioOutline RuleType_Examples_Definition RuleType_Examples RuleType_Scenario_Step RuleType_ScenarioOutline_Step RuleType_Step RuleType_Step_Arg RuleType_DataTable RuleType_DocString RuleType_Tags RuleType_Feature_Description RuleType_Background_Description RuleType_Scenario_Description RuleType_ScenarioOutline_Description RuleType_Examples_Description RuleType_Description_Helper RuleType_Description )
type Scanner ¶
The scanner reads a gherkin doc (typically read from a .feature file) and creates a token for each line. The tokens are passed to the parser, which outputs an AST (Abstract Syntax Tree).
If the scanner sees a # language header, it will reconfigure itself dynamically to look for Gherkin keywords for the associated language. The keywords are defined in gherkin-languages.json.
func NewScanner ¶
type Scenario ¶
type Scenario struct { ScenarioDefinition Tags []*Tag `json:"tags"` }
type ScenarioDefinition ¶
type ScenarioOutline ¶
type ScenarioOutline struct { ScenarioDefinition Tags []*Tag `json:"tags"` Examples []*Examples `json:"examples,omitempty"` }
type Token ¶
type TokenType ¶
type TokenType int
const ( TokenType_None TokenType = iota TokenType_EOF TokenType_Empty TokenType_Comment TokenType_TagLine TokenType_FeatureLine TokenType_BackgroundLine TokenType_ScenarioLine TokenType_ScenarioOutlineLine TokenType_ExamplesLine TokenType_StepLine TokenType_DocStringSeparator TokenType_TableRow TokenType_Language TokenType_Other )