Class: Speculations::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/speculations/parser.rb,
lib/speculations/parser/context.rb,
lib/speculations/parser/state/in.rb,
lib/speculations/parser/state/out.rb,
lib/speculations/parser/state/includes.rb,
lib/speculations/parser/state/candidate.rb,
lib/speculations/parser/state/context_maker.rb

Defined Under Namespace

Modules: State Classes: Context

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.parsersObject



9
10
11
12
13
14
15
16
# File 'lib/speculations/parser.rb', line 9

def self.parsers
  @__parsers__ ||= {
    candidate: State::Candidate,
    in: State::In,
    includes: State::Includes,
    out: State::Out
  }
end

Instance Method Details

#parse_from_file(file, debug: false) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/speculations/parser.rb', line 18

def parse_from_file(file, debug: false)
  @filename = file
  @input = File
    .new(file)
    .each_line(chomp: true)
    .lazy
  parse!(debug:)
end