Module: Gherkin

Defined in:
lib/gherkin.rb,
lib/gherkin/token.rb,
lib/gherkin/errors.rb,
lib/gherkin/parser.rb,
lib/gherkin/dialect.rb,
lib/gherkin/ast_node.rb,
lib/gherkin/ast_builder.rb,
lib/gherkin/gherkin_line.rb,
lib/gherkin/token_matcher.rb,
lib/gherkin/token_scanner.rb,
lib/gherkin/pickles/compiler.rb,
lib/gherkin/token_formatter_builder.rb,
lib/gherkin/stream/parser_message_stream.rb,
lib/gherkin/stream/subprocess_message_stream.rb

Defined Under Namespace

Modules: Pickles, Stream Classes: AstBuilder, AstBuilderException, AstNode, CompositeParserException, Dialect, GherkinLine, NoSuchLanguageException, Parser, ParserContext, ParserError, ParserException, Token, TokenFormatterBuilder, TokenMatcher, TokenScanner, UnexpectedEOFException, UnexpectedTokenException

Constant Summary collapse

DEFAULT_OPTIONS =
{
  include_source: true,
  include_gherkin_document: true,
  include_pickles: true
}.freeze
RULE_TYPE =
[
  :None,
  :_EOF, # #EOF
  :_Empty, # #Empty
  :_Comment, # #Comment
  :_TagLine, # #TagLine
  :_FeatureLine, # #FeatureLine
  :_RuleLine, # #RuleLine
  :_BackgroundLine, # #BackgroundLine
  :_ScenarioLine, # #ScenarioLine
  :_ExamplesLine, # #ExamplesLine
  :_StepLine, # #StepLine
  :_DocStringSeparator, # #DocStringSeparator
  :_TableRow, # #TableRow
  :_Language, # #Language
  :_Other, # #Other
  :GherkinDocument, # GherkinDocument! := Feature?
  :Feature, # Feature! := FeatureHeader Background? ScenarioDefinition* Rule*
  :FeatureHeader, # FeatureHeader! := #Language? Tags? #FeatureLine DescriptionHelper
  :Rule, # Rule! := RuleHeader Background? ScenarioDefinition*
  :RuleHeader, # RuleHeader! := #RuleLine DescriptionHelper
  :Background, # Background! := #BackgroundLine DescriptionHelper Step*
  :ScenarioDefinition, # ScenarioDefinition! := Tags? Scenario
  :Scenario, # Scenario! := #ScenarioLine DescriptionHelper Step* ExamplesDefinition*
  :ExamplesDefinition, # ExamplesDefinition! [#Empty|#Comment|#TagLine->#ExamplesLine] := Tags? Examples
  :Examples, # Examples! := #ExamplesLine DescriptionHelper ExamplesTable?
  :ExamplesTable, # ExamplesTable! := #TableRow #TableRow*
  :Step, # Step! := #StepLine StepArg?
  :StepArg, # StepArg := (DataTable | DocString)
  :DataTable, # DataTable! := #TableRow+
  :DocString, # DocString! := #DocStringSeparator #Other* #DocStringSeparator
  :Tags, # Tags! := #TagLine+
  :DescriptionHelper, # DescriptionHelper := #Empty* Description? #Comment*
  :Description, # Description! := #Other+
]
DIALECT_FILE_PATH =
File.expand_path("gherkin-languages.json", File.dirname(__FILE__))
DIALECTS =
JSON.parse File.open(DIALECT_FILE_PATH, 'r:UTF-8').read

Class Method Summary collapse

Class Method Details

.from_paths(paths, options = {}) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/gherkin.rb', line 10

def self.from_paths(paths, options={})
  Stream::ParserMessageStream.new(
      paths,
      [],
      options
  ).messages
end

.from_source(uri, data, options = {}) ⇒ Object



26
27
28
# File 'lib/gherkin.rb', line 26

def self.from_source(uri, data, options={})
  from_sources([encode_source_message(uri, data)], options)
end

.from_sources(sources, options = {}) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/gherkin.rb', line 18

def self.from_sources(sources, options={})
  Stream::ParserMessageStream.new(
      [],
      sources,
      options
  ).messages
end