Module: Hemingway::Footnote

Includes:
Treetop::Runtime
Included in:
FootnoteParser, Latex
Defined in:
lib/hemingway/footnote/footnote.rb

Defined Under Namespace

Modules: Footnote0

Instance Method Summary collapse

Instance Method Details

#_nt_footnoteObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/hemingway/footnote/footnote.rb', line 21

def _nt_footnote
  start_index = index
  if node_cache[:footnote].has_key?(index)
    cached = node_cache[:footnote][index]
    if cached
      cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
      @index = cached.interval.end
    end
    return cached
  end

  i0, s0 = index, []
  if has_terminal?("\\footnote{", false, index)
    r1 = instantiate_node(SyntaxNode,input, index...(index + 10))
    @index += 10
  else
    terminal_parse_failure("\\footnote{")
    r1 = nil
  end
  s0 << r1
  if r1
    s2, i2 = [], index
    loop do
      r3 = _nt_content
      if r3
        s2 << r3
      else
        break
      end
    end
    r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
    s0 << r2
    if r2
      if has_terminal?("}", false, index)
        r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
        @index += 1
      else
        terminal_parse_failure("}")
        r4 = nil
      end
      s0 << r4
    end
  end
  if s0.last
    r0 = instantiate_node(FootnoteNode,input, i0...index, s0)
    r0.extend(Footnote0)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:footnote][start_index] = r0

  r0
end

#rootObject



10
11
12
# File 'lib/hemingway/footnote/footnote.rb', line 10

def root
  @root ||= :footnote
end