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.


23
24
25
26
# File 'lib/fig/parser.rb', line 23

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


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

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