Sha256: 431d982fd0ef8a6f61092794b2a1eb8e199883a46ba4ca8ffdf72aadf3b29f9a

Contents?: true

Size: 987 Bytes

Versions: 27

Compression:

Stored size: 987 Bytes

Contents

module YARD::Parser::Cucumber

  class FeatureParser < YARD::Parser::Base

    def initialize(source, file = '(stdin)')

      @builder = Cucumber::Parser::CityBuilder.new(file)
      @tag_counts = {}
      @tag_formatter = Gherkin::Formatter::TagCountFormatter.new(@builder, @tag_counts)
      @parser = Gherkin::Parser::Parser.new(@tag_formatter, true, "root", false)

      @source = source
      @file = file

      @feature = nil
    end

    def parse
      begin
        @parser.parse(@source, @file, 0)
        @feature = @builder.ast
        return nil if @feature.nil? # Nothing matched
        @feature.language = @parser.i18n_language
      rescue Gherkin::Lexer::LexingError, Gherkin::Parser::ParseError => e
        e.message.insert(0, "#{@file}: ")
        raise e
      end

      self
    end

    def tokenize
      
    end


    def enumerator
      [@feature]
    end

  end


  YARD::Parser::SourceParser.register_parser_type :feature, FeatureParser, 'feature'

end

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
yard-cucumber-2.0.3 lib/yard/parser/cucumber/feature.rb
yard-cucumber-2.0.2 lib/yard/parser/cucumber/feature.rb
yard-cucumber-2.0.1 lib/yard/parser/cucumber/feature.rb
yard-cucumber-2.0.0 lib/yard/parser/cucumber/feature.rb
cucumber-in-the-yard-1.7.8 lib/yard/parser/cucumber/feature.rb
cucumber-in-the-yard-1.7.7 lib/yard/parser/cucumber/feature.rb
cucumber-in-the-yard-1.7.6 lib/yard/parser/cucumber/feature.rb
cucumber-in-the-yard-1.7.5 lib/yard/parser/cucumber/feature.rb
cucumber-in-the-yard-1.7.4 lib/yard/parser/cucumber/feature.rb
cucumber-in-the-yard-1.7.3 lib/yard/parser/cucumber/feature.rb
cucumber-in-the-yard-1.7.2 lib/yard/parser/cucumber/feature.rb
cucumber-in-the-yard-1.7.1 lib/yard/parser/cucumber/feature.rb
cucumber-in-the-yard-1.7.0 lib/yard/parser/cucumber/feature.rb
cucumber-in-the-yard-1.6.4 lib/yard/parser/cucumber/feature.rb
cucumber-in-the-yard-1.6.3 lib/yard/parser/cucumber/feature.rb
cucumber-in-the-yard-1.6.1 lib/yard/parser/cucumber/feature.rb
cucumber-in-the-yard-1.6.0 lib/yard/parser/cucumber/feature.rb
cucumber-in-the-yard-1.5.4 lib/yard/parser/cucumber/feature.rb
cucumber-in-the-yard-1.5.3 lib/yard/parser/cucumber/feature.rb
cucumber-in-the-yard-1.5.2 lib/yard/parser/cucumber/feature.rb