5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/speculations/parser/state/candidate.rb', line 5
def parse line, lnb, node, ctxt, debug: false
case
when State.blank_line(line)
dbg_match("blank_line", lnb, debug:)
[:candidate, node, ctxt]
when match = State.context_match(line)
dbg_match("context", lnb, debug:)
_parse_context(match, lnb:, node:)
when match = State.maybe_include(line)
dbg_match("maybe_include", lnb, debug:)
[:candidate, node, :inc]
when match = State.maybe_example(line)
dbg_match("maybe_example", lnb, debug:)
[:candidate, node, match[:title]]
when match = State.ruby_code_block(line)
dbg_match("ruby_code_block", lnb, debug:)
_parse_ruby_code_block(match, ctxt:, lnb:, node:)
else
[:out, node]
end
end
|