123456789_123456789_123456789_123456789_123456789_

Class: YARD::Parser::OrderedParser

Relationships & Source Files
Inherits: Object
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

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(global_state, files) ⇒ OrderedParser

Note:

OrderedParser sets itself as the ordered_parser key on global_state for later use in ::YARD::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

[ GitHub ]

  
# 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> (rw)

Returns:

  • (Array<String>)

    the list of remaining files to parse

[ GitHub ]

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

attr_accessor :files

Instance Method Details

#parse

Parses the remainder of the #files list.

See Also:

  • Processor#parse_remaining_files
[ GitHub ]

  
# File 'lib/yard/parser/source_parser.rb', line 41

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