Class: YARD::Parser::OrderedParser

Inherits:
Object
  • Object
show all
Defined in:
lib/yard/parser/source_parser.rb

Overview

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 Also:

  • Processor#parse_remaining_files

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(global_state, files) ⇒ OrderedParser

Note:

OrderedParser sets itself as the ordered_parser key on global_state for later use in Handlers::Processor.

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

Parameters:

  • global_state (OpenStruct)

    a structure containing all global state during parsing

  • files (Array<String>)

    the list of files to parse



32
33
34
35
36
# File 'lib/yard/parser/source_parser.rb', line 32

def initialize(global_state, files)
  @global_state = global_state
  @files = files.dup
  @global_state.ordered_parser = self
end

Instance Attribute Details

#filesArray<String>

Returns the list of remaining files to parse.

Returns:

  • (Array<String>)

    the list of remaining files to parse



22
23
24
# File 'lib/yard/parser/source_parser.rb', line 22

def files
  @files
end

Instance Method Details

#parseObject

Parses the remainder of the #files list.

See Also:

  • Processor#parse_remaining_files


41
42
43
44
45
46
# File 'lib/yard/parser/source_parser.rb', line 41

def parse
  while file = files.shift
    log.debug("Processing #{file}...")
    SourceParser.new(SourceParser.parser_type, @global_state).parse(file)
  end
end