Module: Speculations::Parser::State::Out

Extended by:
Out
Includes:
ContextMaker
Included in:
Out
Defined in:
lib/speculations/parser/state/out.rb

Instance Method Summary collapse

Instance Method Details

#parse(line, lnb, node, _ctxt, debug: false) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/speculations/parser/state/out.rb', line 8

def parse line, lnb, node, _ctxt, debug: false
  # debug__(msg: "out #{lnb}: #{line}", debug:)
  case
  when match = State.context_match(line)
    dbg_match("context", lnb, debug:)
    make_new_context(lnb: lnb, node: node, match: match)
  when match = State.maybe_example(line)
    dbg_match("maybe_example", lnb, debug:)
    [:candidate, node, match[:title]]
  when match = State.maybe_include(line)
    dbg_match("maybe_include", lnb, debug:)
    [:candidate, node, :inc]
  else
    [:out, node]
  end
end