class YARD::Parser::OrderedParser

Responsible for parsing a list of files in order. The {#parse} method of this class can be called from the {SourceParser#globals} globals state list to re-enter parsing for the remainder of files in the list recursively.

@see Processor#parse_remaining_files

Attributes

files[RW]

@return [Array<String>] the list of remaining files to parse

Public Class Methods

new(global_state, files) click to toggle source

Creates a new OrderedParser with the global state and a list of files to parse.

@note OrderedParser sets itself as the ordered_parser key on

global_state for later use in {Handlers::Processor}.

@param [OpenStruct] global_state a structure containing all global

state during parsing

@param [Array<String>] files the list of files to parse

# File lib/yard/parser/source_parser.rb, line 33
def initialize(global_state, files)
  @global_state = global_state
  @files = files.dup
  @global_state.ordered_parser = self
end

Public Instance Methods

parse() click to toggle source

Parses the remainder of the {#files} list.

@see Processor#parse_remaining_files

# File lib/yard/parser/source_parser.rb, line 42
def parse
  until files.empty?
    file = files.shift
    log.capture("Parsing #{file}") do
      SourceParser.new(SourceParser.parser_type, @global_state).parse(file)
    end
  end
end