Module: Fig::Grammar::V1

Includes:
Base, V1Base, Version, Treetop::Runtime
Included in:
V1Parser
Defined in:
lib/fig/grammar/v1.rb

Defined Under Namespace

Modules: Package0, Package1

Instance Method Summary collapse

Methods included from V1Base

#_nt_archive, #_nt_command, #_nt_command_line, #_nt_config, #_nt_config_name, #_nt_config_statement_with_ws, #_nt_descriptor_string, #_nt_environment_variable_name, #_nt_environment_variable_name_value, #_nt_include, #_nt_override, #_nt_package_statement, #_nt_package_statement_with_ws, #_nt_path, #_nt_quoted_or_bare_string, #_nt_resource, #_nt_retrieve, #_nt_set

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_config_statementObject



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/fig/grammar/v1.rb', line 110

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

  i0 = index
  r1 = _nt_override
  if r1
    r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
    r0 = r1
  else
    r2 = _nt_include
    if r2
      r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
      r0 = r2
    else
      r3 = _nt_command
      if r3
        r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
        r0 = r3
      else
        r4 = _nt_path
        if r4
          r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
          r0 = r4
        else
          r5 = _nt_set
          if r5
            r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
            r0 = r5
          else
            @index = i0
            r0 = nil
          end
        end
      end
    end
  end

  node_cache[:config_statement][start_index] = r0

  r0
end

#_nt_packageObject



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
107
108
# File 'lib/fig/grammar/v1.rb', line 56

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

  i0, s0 = index, []
  r1 = _nt_optional_ws_or_comment
  s0 << r1
  if r1
    r3 = _nt_grammar_version
    if r3
      r2 = r3
    else
      r2 = instantiate_node(SyntaxNode,input, index...index)
    end
    s0 << r2
    if r2
      s4, i4 = [], index
      loop do
        r5 = _nt_package_statement_with_ws
        if r5
          s4 << r5
        else
          break
        end
      end
      r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
      s0 << r4
      if r4
        r6 = _nt_optional_ws_or_comment
        s0 << r6
      end
    end
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(Package0)
    r0.extend(Package1)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:package][start_index] = r0

  r0
end

#rootObject



20
21
22
# File 'lib/fig/grammar/v1.rb', line 20

def root
  @root ||= :package
end