Module: Fig::Grammar::VersionIdentification

Includes:
Base, Version, Treetop::Runtime
Included in:
VersionIdentificationParser
Defined in:
lib/fig/grammar/version_identification.rb

Defined Under Namespace

Modules: Everything0, Everything1

Instance Method Summary collapse

Methods included from Version

#_nt_grammar_version

Methods included from Base

#_nt_comment, #_nt_optional_ws, #_nt_optional_ws_or_comment, #_nt_ws, #_nt_ws_or_comment

Instance Method Details

#_nt_everythingObject



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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/fig/grammar/version_identification.rb', line 43

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

  i0, s0 = index, []
  s1, i1 = [], index
  loop do
    r2 = _nt_ws_or_comment
    if r2
      s1 << r2
    else
      break
    end
  end
  r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
  s0 << r1
  if r1
    r4 = _nt_grammar_version
    if r4
      r3 = r4
    else
      r3 = instantiate_node(SyntaxNode,input, index...index)
    end
    s0 << r3
    if r3
      s5, i5 = [], index
      loop do
        if index < input_length
          r6 = true
          @index += 1
        else
          terminal_parse_failure("any character")
          r6 = nil
        end
        if r6
          s5 << r6
        else
          break
        end
      end
      r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
      s0 << r5
    end
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(Everything0)
    r0.extend(Everything1)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:everything][start_index] = r0

  r0
end

#rootObject



19
20
21
# File 'lib/fig/grammar/version_identification.rb', line 19

def root
  @root ||= :everything
end