Class: Fig::Parser

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

Overview

Parses .fig files (wrapping the Treetop-generated parser object) and deals with a few restrictions on them.

Instance Method Summary collapse

Constructor Details

#initialize(application_config, check_include_versions) ⇒ Parser

Returns a new instance of Parser.



21
22
23
24
# File 'lib/fig/parser.rb', line 21

def initialize(application_config, check_include_versions)
  @application_config     = application_config
  @check_include_versions = check_include_versions
end

Instance Method Details

#parse_package(unparsed_package) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'lib/fig/parser.rb', line 26

def parse_package(unparsed_package)
  version = get_grammar_version unparsed_package

  if version == 0
    return parse_v0 unparsed_package
  end

  return parse_v1_or_later version, unparsed_package
end