puppet 5.0.1-x64-mingw32 → 5.1.0-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puppet might be problematic. Click here for more details.

Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/lib/puppet/agent.rb +1 -0
  3. data/lib/puppet/defaults.rb +1 -1
  4. data/lib/puppet/functions.rb +6 -7
  5. data/lib/puppet/functions/all.rb +100 -0
  6. data/lib/puppet/functions/any.rb +105 -0
  7. data/lib/puppet/functions/defined.rb +3 -3
  8. data/lib/puppet/functions/new.rb +2 -1
  9. data/lib/puppet/functions/reduce.rb +31 -0
  10. data/lib/puppet/functions/tree_each.rb +200 -0
  11. data/lib/puppet/module.rb +30 -0
  12. data/lib/puppet/parser/functions/new.rb +67 -0
  13. data/lib/puppet/parser/functions/reduce.rb +31 -0
  14. data/lib/puppet/parser/relationship.rb +2 -2
  15. data/lib/puppet/parser/resource.rb +39 -10
  16. data/lib/puppet/parser/scope.rb +1 -1
  17. data/lib/puppet/pops/evaluator/access_operator.rb +11 -4
  18. data/lib/puppet/pops/evaluator/collector_transformer.rb +1 -1
  19. data/lib/puppet/pops/evaluator/evaluator_impl.rb +4 -4
  20. data/lib/puppet/pops/evaluator/relationship_operator.rb +1 -1
  21. data/lib/puppet/pops/evaluator/runtime3_converter.rb +3 -3
  22. data/lib/puppet/pops/evaluator/runtime3_resource_support.rb +1 -1
  23. data/lib/puppet/pops/loader/module_loaders.rb +1 -1
  24. data/lib/puppet/pops/loader/static_loader.rb +1 -2
  25. data/lib/puppet/pops/loaders.rb +1 -2
  26. data/lib/puppet/pops/lookup/context.rb +1 -1
  27. data/lib/puppet/pops/lookup/lookup_adapter.rb +2 -1
  28. data/lib/puppet/pops/model/ast.rb +440 -436
  29. data/lib/puppet/pops/model/factory.rb +140 -140
  30. data/lib/puppet/pops/pcore.rb +1 -2
  31. data/lib/puppet/pops/resource/param.rb +1 -1
  32. data/lib/puppet/pops/resource/resource_type_impl.rb +1 -1
  33. data/lib/puppet/pops/serialization/from_data_converter.rb +0 -12
  34. data/lib/puppet/pops/time/timestamp.rb +29 -17
  35. data/lib/puppet/pops/types/annotatable.rb +2 -2
  36. data/lib/puppet/pops/types/annotation.rb +8 -8
  37. data/lib/puppet/pops/types/class_loader.rb +3 -3
  38. data/lib/puppet/pops/types/implementation_registry.rb +1 -1
  39. data/lib/puppet/pops/types/iterable.rb +2 -2
  40. data/lib/puppet/pops/types/p_binary_type.rb +2 -2
  41. data/lib/puppet/pops/types/p_init_type.rb +238 -0
  42. data/lib/puppet/pops/types/p_meta_type.rb +14 -11
  43. data/lib/puppet/pops/types/p_object_type.rb +15 -15
  44. data/lib/puppet/pops/types/p_sem_ver_range_type.rb +2 -2
  45. data/lib/puppet/pops/types/p_sem_ver_type.rb +2 -2
  46. data/lib/puppet/pops/types/p_sensitive_type.rb +2 -2
  47. data/lib/puppet/pops/types/p_timespan_type.rb +6 -6
  48. data/lib/puppet/pops/types/p_timestamp_type.rb +6 -2
  49. data/lib/puppet/pops/types/p_type_set_type.rb +10 -9
  50. data/lib/puppet/pops/types/ruby_generator.rb +6 -5
  51. data/lib/puppet/pops/types/ruby_method.rb +2 -2
  52. data/lib/puppet/pops/types/string_converter.rb +1 -1
  53. data/lib/puppet/pops/types/tree_iterators.rb +250 -0
  54. data/lib/puppet/pops/types/type_calculator.rb +13 -13
  55. data/lib/puppet/pops/types/type_factory.rb +26 -7
  56. data/lib/puppet/pops/types/type_formatter.rb +9 -4
  57. data/lib/puppet/pops/types/type_parser.rb +8 -3
  58. data/lib/puppet/pops/types/type_set_reference.rb +2 -2
  59. data/lib/puppet/pops/types/types.rb +168 -109
  60. data/lib/puppet/provider/package/gem.rb +10 -9
  61. data/lib/puppet/provider/package/pip.rb +12 -3
  62. data/lib/puppet/provider/package/yum.rb +9 -1
  63. data/lib/puppet/resource/capability_finder.rb +30 -11
  64. data/lib/puppet/type/file.rb +21 -13
  65. data/lib/puppet/util/execution.rb +67 -14
  66. data/lib/puppet/util/suidmanager.rb +1 -0
  67. data/lib/puppet/version.rb +1 -1
  68. data/locales/puppet.pot +130 -66
  69. data/man/man5/puppet.conf.5 +1 -1
  70. data/spec/fixtures/unit/provider/package/yum/yum-check-update-simple.txt +1 -0
  71. data/spec/integration/parser/collection_spec.rb +40 -1
  72. data/spec/shared_contexts/types_setup.rb +41 -2
  73. data/spec/unit/agent_spec.rb +11 -0
  74. data/spec/unit/file_bucket/dipper_spec.rb +13 -4
  75. data/spec/unit/functions/all_spec.rb +97 -0
  76. data/spec/unit/functions/any_spec.rb +109 -0
  77. data/spec/unit/functions/hiera_spec.rb +5 -0
  78. data/spec/unit/functions/new_spec.rb +66 -0
  79. data/spec/unit/functions/tree_each_spec.rb +444 -0
  80. data/spec/unit/module_spec.rb +29 -0
  81. data/spec/unit/pops/serialization/serialization_spec.rb +2 -2
  82. data/spec/unit/pops/serialization/to_from_hr_spec.rb +2 -2
  83. data/spec/unit/pops/types/iterable_spec.rb +9 -9
  84. data/spec/unit/pops/types/p_init_type_spec.rb +285 -0
  85. data/spec/unit/pops/types/p_object_type_spec.rb +8 -8
  86. data/spec/unit/pops/types/p_sensitive_type_spec.rb +4 -0
  87. data/spec/unit/pops/types/p_timespan_type_spec.rb +14 -0
  88. data/spec/unit/pops/types/p_timestamp_type_spec.rb +19 -1
  89. data/spec/unit/pops/types/p_type_set_type_spec.rb +2 -2
  90. data/spec/unit/pops/types/ruby_generator_spec.rb +9 -22
  91. data/spec/unit/pops/types/string_converter_spec.rb +2 -2
  92. data/spec/unit/pops/types/type_acceptor_spec.rb +2 -2
  93. data/spec/unit/pops/types/type_calculator_spec.rb +43 -38
  94. data/spec/unit/pops/types/type_factory_spec.rb +6 -6
  95. data/spec/unit/pops/types/type_formatter_spec.rb +6 -6
  96. data/spec/unit/pops/types/types_spec.rb +16 -4
  97. data/spec/unit/provider/package/gem_spec.rb +6 -6
  98. data/spec/unit/provider/package/pip_spec.rb +44 -23
  99. data/spec/unit/provider/package/puppet_gem_spec.rb +1 -1
  100. data/spec/unit/provider/package/yum_spec.rb +8 -0
  101. data/spec/unit/resource/capability_finder_spec.rb +4 -5
  102. data/spec/unit/type/file_spec.rb +19 -14
  103. data/spec/unit/util/execution_spec.rb +216 -82
  104. data/tasks/generate_ast_model.rake +10 -2
  105. metadata +15 -2
@@ -40,27 +40,27 @@ class Factory
40
40
  attr_reader :model_class
41
41
 
42
42
  def [](key)
43
- @i12n[key]
43
+ @init_hash[key]
44
44
  end
45
45
 
46
46
  def []=(key, value)
47
- @i12n[key] = value
47
+ @init_hash[key] = value
48
48
  end
49
49
 
50
50
  def all_factories(&block)
51
51
  block.call(self)
52
- @i12n.each_value { |value| value.all_factories(&block) if value.instance_of?(Factory) }
52
+ @init_hash.each_value { |value| value.all_factories(&block) if value.instance_of?(Factory) }
53
53
  end
54
54
 
55
55
  def model
56
56
  if @current.nil?
57
57
  # Assign a default Locator if it's missing. Should only happen when the factory is used by other
58
58
  # means than from a parser (e.g. unit tests)
59
- unless @i12n.include?(KEY_LOCATOR)
60
- @i12n[KEY_LOCATOR] = Parser::Locator.locator('<no source>', 'no file')
59
+ unless @init_hash.include?(KEY_LOCATOR)
60
+ @init_hash[KEY_LOCATOR] = Parser::Locator.locator('<no source>', 'no file')
61
61
  unless @model_class <= Program
62
- @i12n[KEY_OFFSET] = 0
63
- @i12n[KEY_LENGTH] = 0
62
+ @init_hash[KEY_OFFSET] = 0
63
+ @init_hash[KEY_LENGTH] = 0
64
64
  end
65
65
  end
66
66
  @current = create_model
@@ -72,15 +72,15 @@ class Factory
72
72
  alias current model
73
73
 
74
74
  def create_model
75
- @i12n.each_pair { |key, elem| @i12n[key] = factory_to_model(elem) }
76
- model_class.from_asserted_hash(@i12n)
75
+ @init_hash.each_pair { |key, elem| @init_hash[key] = factory_to_model(elem) }
76
+ model_class.from_asserted_hash(@init_hash)
77
77
  end
78
78
 
79
79
  # Initialize a factory with a single object, or a class with arguments applied to build of
80
80
  # created instance
81
81
  #
82
82
  def initialize(o, *args)
83
- @i12n = {}
83
+ @init_hash = {}
84
84
  if o.instance_of?(Class)
85
85
  @model_class = o
86
86
  BUILD_VISITOR.visit_this_class(self, o, args)
@@ -97,94 +97,94 @@ class Factory
97
97
  # Building of Model classes
98
98
 
99
99
  def build_Application(o, n, ps, body)
100
- @i12n[KEY_NAME] = n
101
- @i12n[KEY_PARAMETERS] = ps
100
+ @init_hash[KEY_NAME] = n
101
+ @init_hash[KEY_PARAMETERS] = ps
102
102
  b = f_build_body(body)
103
- @i12n[KEY_BODY] = b unless b.nil?
103
+ @init_hash[KEY_BODY] = b unless b.nil?
104
104
  end
105
105
 
106
106
  def build_ArithmeticExpression(o, op, a, b)
107
- @i12n[KEY_OPERATOR] = op
107
+ @init_hash[KEY_OPERATOR] = op
108
108
  build_BinaryExpression(o, a, b)
109
109
  end
110
110
 
111
111
  def build_AssignmentExpression(o, op, a, b)
112
- @i12n[KEY_OPERATOR] = op
112
+ @init_hash[KEY_OPERATOR] = op
113
113
  build_BinaryExpression(o, a, b)
114
114
  end
115
115
 
116
116
  def build_AttributeOperation(o, name, op, value)
117
- @i12n[KEY_OPERATOR] = op
118
- @i12n['attribute_name'] = name.to_s # BOOLEAN is allowed in the grammar
119
- @i12n['value_expr'] = value
117
+ @init_hash[KEY_OPERATOR] = op
118
+ @init_hash['attribute_name'] = name.to_s # BOOLEAN is allowed in the grammar
119
+ @init_hash['value_expr'] = value
120
120
  end
121
121
 
122
122
  def build_AttributesOperation(o, value)
123
- @i12n[KEY_EXPR] = value
123
+ @init_hash[KEY_EXPR] = value
124
124
  end
125
125
 
126
126
  def build_AccessExpression(o, left, keys)
127
- @i12n[KEY_LEFT_EXPR] = left
128
- @i12n[KEY_KEYS] = keys
127
+ @init_hash[KEY_LEFT_EXPR] = left
128
+ @init_hash[KEY_KEYS] = keys
129
129
  end
130
130
 
131
131
  def build_BinaryExpression(o, left, right)
132
- @i12n[KEY_LEFT_EXPR] = left
133
- @i12n[KEY_RIGHT_EXPR] = right
132
+ @init_hash[KEY_LEFT_EXPR] = left
133
+ @init_hash[KEY_RIGHT_EXPR] = right
134
134
  end
135
135
 
136
136
  def build_BlockExpression(o, args)
137
- @i12n['statements'] = args
137
+ @init_hash['statements'] = args
138
138
  end
139
139
 
140
140
  def build_EppExpression(o, parameters_specified, body)
141
- @i12n['parameters_specified'] = parameters_specified
141
+ @init_hash['parameters_specified'] = parameters_specified
142
142
  b = f_build_body(body)
143
- @i12n[KEY_BODY] = b unless b.nil?
143
+ @init_hash[KEY_BODY] = b unless b.nil?
144
144
  end
145
145
 
146
146
  # @param rval_required [Boolean] if the call must produce a value
147
147
  def build_CallExpression(o, functor, rval_required, args)
148
- @i12n['functor_expr'] = functor
149
- @i12n['rval_required'] = rval_required
150
- @i12n['arguments'] = args
148
+ @init_hash['functor_expr'] = functor
149
+ @init_hash['rval_required'] = rval_required
150
+ @init_hash['arguments'] = args
151
151
  end
152
152
 
153
153
  def build_CallMethodExpression(o, functor, rval_required, lambda, args)
154
154
  build_CallExpression(o, functor, rval_required, args)
155
- @i12n['lambda'] = lambda
155
+ @init_hash['lambda'] = lambda
156
156
  end
157
157
 
158
158
  def build_CaseExpression(o, test, args)
159
- @i12n['test'] = test
160
- @i12n['options'] = args
159
+ @init_hash['test'] = test
160
+ @init_hash['options'] = args
161
161
  end
162
162
 
163
163
  def build_CaseOption(o, value_list, then_expr)
164
164
  value_list = [value_list] unless value_list.is_a?(Array)
165
- @i12n['values'] = value_list
165
+ @init_hash['values'] = value_list
166
166
  b = f_build_body(then_expr)
167
- @i12n['then_expr'] = b unless b.nil?
167
+ @init_hash['then_expr'] = b unless b.nil?
168
168
  end
169
169
 
170
170
  def build_CollectExpression(o, type_expr, query_expr, attribute_operations)
171
- @i12n['type_expr'] = type_expr
172
- @i12n['query'] = query_expr
173
- @i12n['operations'] = attribute_operations
171
+ @init_hash['type_expr'] = type_expr
172
+ @init_hash['query'] = query_expr
173
+ @init_hash['operations'] = attribute_operations
174
174
  end
175
175
 
176
176
  def build_ComparisonExpression(o, op, a, b)
177
- @i12n[KEY_OPERATOR] = op
177
+ @init_hash[KEY_OPERATOR] = op
178
178
  build_BinaryExpression(o, a, b)
179
179
  end
180
180
 
181
181
  def build_ConcatenatedString(o, args)
182
- @i12n['segments'] = args
182
+ @init_hash['segments'] = args
183
183
  end
184
184
 
185
185
  def build_HeredocExpression(o, name, expr)
186
- @i12n['syntax'] = name
187
- @i12n['text_expr'] = expr
186
+ @init_hash['syntax'] = name
187
+ @init_hash['text_expr'] = expr
188
188
  end
189
189
 
190
190
  # @param name [String] a valid classname
@@ -195,53 +195,53 @@ class Factory
195
195
  #
196
196
  def build_HostClassDefinition(o, name, parameters, parent_class_name, body)
197
197
  build_NamedDefinition(o, name, parameters, body)
198
- @i12n['parent_class'] = parent_class_name unless parent_class_name.nil?
198
+ @init_hash['parent_class'] = parent_class_name unless parent_class_name.nil?
199
199
  end
200
200
 
201
201
  def build_ResourceOverrideExpression(o, resources, attribute_operations)
202
- @i12n['resources'] = resources
203
- @i12n['operations'] = attribute_operations
202
+ @init_hash['resources'] = resources
203
+ @init_hash['operations'] = attribute_operations
204
204
  end
205
205
 
206
206
  def build_ReservedWord(o, name, future)
207
- @i12n['word'] = name
208
- @i12n['future'] = future
207
+ @init_hash['word'] = name
208
+ @init_hash['future'] = future
209
209
  end
210
210
 
211
211
  def build_KeyedEntry(o, k, v)
212
- @i12n['key'] = k
213
- @i12n[KEY_VALUE] = v
212
+ @init_hash['key'] = k
213
+ @init_hash[KEY_VALUE] = v
214
214
  end
215
215
 
216
216
  def build_LiteralHash(o, keyed_entries)
217
- @i12n['entries'] = keyed_entries
217
+ @init_hash['entries'] = keyed_entries
218
218
  end
219
219
 
220
220
  def build_LiteralList(o, values)
221
- @i12n['values'] = values
221
+ @init_hash['values'] = values
222
222
  end
223
223
 
224
224
  def build_LiteralFloat(o, val)
225
- @i12n[KEY_VALUE] = val
225
+ @init_hash[KEY_VALUE] = val
226
226
  end
227
227
 
228
228
  def build_LiteralInteger(o, val, radix)
229
- @i12n[KEY_VALUE] = val
230
- @i12n['radix'] = radix
229
+ @init_hash[KEY_VALUE] = val
230
+ @init_hash['radix'] = radix
231
231
  end
232
232
 
233
233
  def build_LiteralString(o, value)
234
- @i12n[KEY_VALUE] = val
234
+ @init_hash[KEY_VALUE] = val
235
235
  end
236
236
 
237
237
  def build_IfExpression(o, t, ift, els)
238
- @i12n['test'] = t
239
- @i12n['then_expr'] = ift
240
- @i12n['else_expr'] = els
238
+ @init_hash['test'] = t
239
+ @init_hash['then_expr'] = ift
240
+ @init_hash['else_expr'] = els
241
241
  end
242
242
 
243
243
  def build_MatchExpression(o, op, a, b)
244
- @i12n[KEY_OPERATOR] = op
244
+ @init_hash[KEY_OPERATOR] = op
245
245
  build_BinaryExpression(o, a, b)
246
246
  end
247
247
 
@@ -251,7 +251,7 @@ class Factory
251
251
 
252
252
  def infer_String(o)
253
253
  @model_class = LiteralString
254
- @i12n[KEY_VALUE] = o
254
+ @init_hash[KEY_VALUE] = o
255
255
  end
256
256
 
257
257
  def infer_NilClass(o)
@@ -260,28 +260,28 @@ class Factory
260
260
 
261
261
  def infer_TrueClass(o)
262
262
  @model_class = LiteralBoolean
263
- @i12n[KEY_VALUE] = o
263
+ @init_hash[KEY_VALUE] = o
264
264
  end
265
265
 
266
266
  def infer_FalseClass(o)
267
267
  @model_class = LiteralBoolean
268
- @i12n[KEY_VALUE] = o
268
+ @init_hash[KEY_VALUE] = o
269
269
  end
270
270
 
271
271
  def infer_Integer(o)
272
272
  @model_class = LiteralInteger
273
- @i12n[KEY_VALUE] = o
273
+ @init_hash[KEY_VALUE] = o
274
274
  end
275
275
 
276
276
  def infer_Float(o)
277
277
  @model_class = LiteralFloat
278
- @i12n[KEY_VALUE] = o
278
+ @init_hash[KEY_VALUE] = o
279
279
  end
280
280
 
281
281
  def infer_Regexp(o)
282
282
  @model_class = LiteralRegularExpression
283
- @i12n['pattern'] = o.inspect
284
- @i12n[KEY_VALUE] = o
283
+ @init_hash['pattern'] = o.inspect
284
+ @init_hash[KEY_VALUE] = o
285
285
  end
286
286
 
287
287
  # Creates a String literal, unless the symbol is one of the special :undef, or :default
@@ -301,7 +301,7 @@ class Factory
301
301
  # Creates a LiteralList instruction from an Array, where the entries are built.
302
302
  def infer_Array(o)
303
303
  @model_class = LiteralList
304
- @i12n['values'] = o.map { |e| Factory.infer(e) }
304
+ @init_hash['values'] = o.map { |e| Factory.infer(e) }
305
305
  end
306
306
 
307
307
  # Create a LiteralHash instruction from a hash, where keys and values are built
@@ -309,7 +309,7 @@ class Factory
309
309
  #
310
310
  def infer_Hash(o)
311
311
  @model_class = LiteralHash
312
- @i12n['entries'] = o.sort_by { |k,_| k.to_s }.map { |k, v| Factory.new(KeyedEntry, Factory.infer(k), Factory.infer(v)) }
312
+ @init_hash['entries'] = o.sort_by { |k,_| k.to_s }.map { |k, v| Factory.new(KeyedEntry, Factory.infer(k), Factory.infer(v)) }
313
313
  end
314
314
 
315
315
  def f_build_body(body)
@@ -326,82 +326,82 @@ class Factory
326
326
  end
327
327
 
328
328
  def build_LambdaExpression(o, parameters, body, return_type)
329
- @i12n[KEY_PARAMETERS] = parameters
329
+ @init_hash[KEY_PARAMETERS] = parameters
330
330
  b = f_build_body(body)
331
- @i12n[KEY_BODY] = b unless b.nil?
332
- @i12n['return_type'] = return_type unless return_type.nil?
331
+ @init_hash[KEY_BODY] = b unless b.nil?
332
+ @init_hash['return_type'] = return_type unless return_type.nil?
333
333
  end
334
334
 
335
335
  def build_NamedDefinition(o, name, parameters, body)
336
- @i12n[KEY_PARAMETERS] = parameters
336
+ @init_hash[KEY_PARAMETERS] = parameters
337
337
  b = f_build_body(body)
338
- @i12n[KEY_BODY] = b unless b.nil?
339
- @i12n[KEY_NAME] = name
338
+ @init_hash[KEY_BODY] = b unless b.nil?
339
+ @init_hash[KEY_NAME] = name
340
340
  end
341
341
 
342
342
  def build_FunctionDefinition(o, name, parameters, body, return_type)
343
- @i12n[KEY_PARAMETERS] = parameters
343
+ @init_hash[KEY_PARAMETERS] = parameters
344
344
  b = f_build_body(body)
345
- @i12n[KEY_BODY] = b unless b.nil?
346
- @i12n[KEY_NAME] = name
347
- @i12n['return_type'] = return_type unless return_type.nil?
345
+ @init_hash[KEY_BODY] = b unless b.nil?
346
+ @init_hash[KEY_NAME] = name
347
+ @init_hash['return_type'] = return_type unless return_type.nil?
348
348
  end
349
349
 
350
350
  def build_CapabilityMapping(o, kind, component, capability, mappings)
351
- @i12n['kind'] = kind
352
- @i12n['component'] = component
353
- @i12n['capability'] = capability
354
- @i12n['mappings'] = mappings
351
+ @init_hash['kind'] = kind
352
+ @init_hash['component'] = component
353
+ @init_hash['capability'] = capability
354
+ @init_hash['mappings'] = mappings
355
355
  end
356
356
 
357
357
  def build_NodeDefinition(o, hosts, parent, body)
358
- @i12n['host_matches'] = hosts
359
- @i12n['parent'] = parent unless parent.nil? # no nop here
358
+ @init_hash['host_matches'] = hosts
359
+ @init_hash['parent'] = parent unless parent.nil? # no nop here
360
360
  b = f_build_body(body)
361
- @i12n[KEY_BODY] = b unless b.nil?
361
+ @init_hash[KEY_BODY] = b unless b.nil?
362
362
  end
363
363
 
364
364
  def build_SiteDefinition(o, body)
365
365
  b = f_build_body(body)
366
- @i12n[KEY_BODY] = b unless b.nil?
366
+ @init_hash[KEY_BODY] = b unless b.nil?
367
367
  end
368
368
 
369
369
  def build_Parameter(o, name, expr)
370
- @i12n[KEY_NAME] = name
371
- @i12n[KEY_VALUE] = expr
370
+ @init_hash[KEY_NAME] = name
371
+ @init_hash[KEY_VALUE] = expr
372
372
  end
373
373
 
374
374
  def build_QualifiedReference(o, name)
375
- @i12n['cased_value'] = name.to_s
375
+ @init_hash['cased_value'] = name.to_s
376
376
  end
377
377
 
378
378
  def build_RelationshipExpression(o, op, a, b)
379
- @i12n[KEY_OPERATOR] = op
379
+ @init_hash[KEY_OPERATOR] = op
380
380
  build_BinaryExpression(o, a, b)
381
381
  end
382
382
 
383
383
  def build_ResourceExpression(o, type_name, bodies)
384
- @i12n['type_name'] = type_name
385
- @i12n['bodies'] = bodies
384
+ @init_hash['type_name'] = type_name
385
+ @init_hash['bodies'] = bodies
386
386
  end
387
387
 
388
388
  def build_RenderStringExpression(o, string)
389
- @i12n[KEY_VALUE] = string;
389
+ @init_hash[KEY_VALUE] = string;
390
390
  end
391
391
 
392
392
  def build_ResourceBody(o, title_expression, attribute_operations)
393
- @i12n['title'] = title_expression
394
- @i12n['operations'] = attribute_operations
393
+ @init_hash['title'] = title_expression
394
+ @init_hash['operations'] = attribute_operations
395
395
  end
396
396
 
397
397
  def build_ResourceDefaultsExpression(o, type_ref, attribute_operations)
398
- @i12n['type_ref'] = type_ref
399
- @i12n['operations'] = attribute_operations
398
+ @init_hash['type_ref'] = type_ref
399
+ @init_hash['operations'] = attribute_operations
400
400
  end
401
401
 
402
402
  def build_SelectorExpression(o, left, *selectors)
403
- @i12n[KEY_LEFT_EXPR] = left
404
- @i12n['selectors'] = selectors
403
+ @init_hash[KEY_LEFT_EXPR] = left
404
+ @init_hash['selectors'] = selectors
405
405
  end
406
406
 
407
407
  # Builds a SubLocatedExpression - this wraps the expression in a sublocation configured
@@ -410,56 +410,56 @@ class Factory
410
410
  # to what it describes.
411
411
  #
412
412
  def build_SubLocatedExpression(o, token, expression)
413
- @i12n[KEY_EXPR] = expression
414
- @i12n[KEY_OFFSET] = token.offset
415
- @i12n[KEY_LENGTH] = token.length
413
+ @init_hash[KEY_EXPR] = expression
414
+ @init_hash[KEY_OFFSET] = token.offset
415
+ @init_hash[KEY_LENGTH] = token.length
416
416
  locator = token.locator
417
- @i12n[KEY_LOCATOR] = locator
418
- @i12n['leading_line_count'] = locator.leading_line_count
419
- @i12n['leading_line_offset'] = locator.leading_line_offset
417
+ @init_hash[KEY_LOCATOR] = locator
418
+ @init_hash['leading_line_count'] = locator.leading_line_count
419
+ @init_hash['leading_line_offset'] = locator.leading_line_offset
420
420
  # Index is held in sublocator's parent locator - needed to be able to reconstruct
421
- @i12n['line_offsets'] = locator.locator.line_index
421
+ @init_hash['line_offsets'] = locator.locator.line_index
422
422
  end
423
423
 
424
424
  def build_SelectorEntry(o, matching, value)
425
- @i12n['matching_expr'] = matching
426
- @i12n['value_expr'] = value
425
+ @init_hash['matching_expr'] = matching
426
+ @init_hash['value_expr'] = value
427
427
  end
428
428
 
429
429
  def build_QueryExpression(o, expr)
430
- @i12n[KEY_EXPR] = expr unless Factory.nop?(expr)
430
+ @init_hash[KEY_EXPR] = expr unless Factory.nop?(expr)
431
431
  end
432
432
 
433
433
  def build_TypeAlias(o, name, type_expr)
434
- @i12n['type_expr'] = type_expr
435
- @i12n[KEY_NAME] = name
434
+ @init_hash['type_expr'] = type_expr
435
+ @init_hash[KEY_NAME] = name
436
436
  end
437
437
 
438
438
  def build_TypeMapping(o, lhs, rhs)
439
- @i12n['type_expr'] = lhs
440
- @i12n['mapping_expr'] = rhs
439
+ @init_hash['type_expr'] = lhs
440
+ @init_hash['mapping_expr'] = rhs
441
441
  end
442
442
 
443
443
  def build_TypeDefinition(o, name, parent, body)
444
444
  b = f_build_body(body)
445
- @i12n[KEY_BODY] = b unless b.nil?
446
- @i12n['parent'] = parent
447
- @i12n[KEY_NAME] = name
445
+ @init_hash[KEY_BODY] = b unless b.nil?
446
+ @init_hash['parent'] = parent
447
+ @init_hash[KEY_NAME] = name
448
448
  end
449
449
 
450
450
  def build_UnaryExpression(o, expr)
451
- @i12n[KEY_EXPR] = expr unless Factory.nop?(expr)
451
+ @init_hash[KEY_EXPR] = expr unless Factory.nop?(expr)
452
452
  end
453
453
 
454
454
  def build_Program(o, body, definitions, locator)
455
- @i12n[KEY_BODY] = body
455
+ @init_hash[KEY_BODY] = body
456
456
  # non containment
457
- @i12n['definitions'] = definitions
458
- @i12n[KEY_LOCATOR] = locator
457
+ @init_hash['definitions'] = definitions
458
+ @init_hash[KEY_LOCATOR] = locator
459
459
  end
460
460
 
461
461
  def build_QualifiedName(o, name)
462
- @i12n[KEY_VALUE] = name
462
+ @init_hash[KEY_VALUE] = name
463
463
  end
464
464
 
465
465
  def build_TokenValue(o)
@@ -559,12 +559,12 @@ class Factory
559
559
 
560
560
  # For CaseExpression, setting the default for an already build CaseExpression
561
561
  def default(r)
562
- @i12n['options'] << Factory.WHEN(Factory.infer(:default), r)
562
+ @init_hash['options'] << Factory.WHEN(Factory.infer(:default), r)
563
563
  self
564
564
  end
565
565
 
566
566
  def lambda=(lambda)
567
- @i12n['lambda'] = lambda
567
+ @init_hash['lambda'] = lambda
568
568
  self
569
569
  end
570
570
 
@@ -584,16 +584,16 @@ class Factory
584
584
  end
585
585
 
586
586
  def attributes(*args)
587
- @i12n['attributes'] = args
587
+ @init_hash['attributes'] = args
588
588
  self
589
589
  end
590
590
 
591
591
  def offset
592
- @i12n[KEY_OFFSET]
592
+ @init_hash[KEY_OFFSET]
593
593
  end
594
594
 
595
595
  def length
596
- @i12n[KEY_LENGTH]
596
+ @init_hash[KEY_LENGTH]
597
597
  end
598
598
 
599
599
  # Records the position (start -> end) and computes the resulting length.
@@ -601,9 +601,9 @@ class Factory
601
601
  def record_position(locator, start_locatable, end_locatable)
602
602
  # record information directly in the Positioned object
603
603
  start_offset = start_locatable.offset
604
- @i12n[KEY_LOCATOR] = locator
605
- @i12n[KEY_OFFSET] = start_offset
606
- @i12n[KEY_LENGTH] = end_locatable.nil? ? start_locatable.length : end_locatable.offset + end_locatable.length - start_offset
604
+ @init_hash[KEY_LOCATOR] = locator
605
+ @init_hash[KEY_OFFSET] = start_offset
606
+ @init_hash[KEY_LENGTH] = end_locatable.nil? ? start_locatable.length : end_locatable.offset + end_locatable.length - start_offset
607
607
  self
608
608
  end
609
609
 
@@ -697,12 +697,12 @@ class Factory
697
697
 
698
698
  # Mark parameter as capturing the rest of arguments
699
699
  def captures_rest
700
- @i12n['captures_rest'] = true
700
+ @init_hash['captures_rest'] = true
701
701
  end
702
702
 
703
703
  # Set Expression that should evaluate to the parameter's type
704
704
  def type_expr(o)
705
- @i12n['type_expr'] = o
705
+ @init_hash['type_expr'] = o
706
706
  end
707
707
 
708
708
  # Creates a QualifiedName representation of o, unless o already represents a QualifiedName in which
@@ -998,26 +998,26 @@ class Factory
998
998
  # other expressions requires variables to be preceded with $
999
999
  #
1000
1000
  def interpolate_AccessExpression(c)
1001
- lhs = @i12n[KEY_LEFT_EXPR]
1001
+ lhs = @init_hash[KEY_LEFT_EXPR]
1002
1002
  if is_interop_rewriteable?(lhs)
1003
- @i12n[KEY_LEFT_EXPR] = lhs.interpolate
1003
+ @init_hash[KEY_LEFT_EXPR] = lhs.interpolate
1004
1004
  end
1005
1005
  self
1006
1006
  end
1007
1007
 
1008
1008
  def interpolate_NamedAccessExpression(c)
1009
- lhs = @i12n[KEY_LEFT_EXPR]
1009
+ lhs = @init_hash[KEY_LEFT_EXPR]
1010
1010
  if is_interop_rewriteable?(lhs)
1011
- @i12n[KEY_LEFT_EXPR] = lhs.interpolate
1011
+ @init_hash[KEY_LEFT_EXPR] = lhs.interpolate
1012
1012
  end
1013
1013
  self
1014
1014
  end
1015
1015
 
1016
1016
  # Rewrite method calls on the form ${x.each ...} to ${$x.each}
1017
1017
  def interpolate_CallMethodExpression(c)
1018
- functor_expr = @i12n['functor_expr']
1018
+ functor_expr = @init_hash['functor_expr']
1019
1019
  if is_interop_rewriteable?(functor_expr)
1020
- @i12n['functor_expr'] = functor_expr.interpolate
1020
+ @init_hash['functor_expr'] = functor_expr.interpolate
1021
1021
  end
1022
1022
  self
1023
1023
  end
@@ -1064,10 +1064,10 @@ class Factory
1064
1064
 
1065
1065
  def contained_current(container)
1066
1066
  if @current.nil?
1067
- unless @i12n.include?(KEY_LOCATOR)
1068
- @i12n[KEY_LOCATOR] = container[KEY_LOCATOR]
1069
- @i12n[KEY_OFFSET] = container[KEY_OFFSET] || 0
1070
- @i12n[KEY_LENGTH] = 0
1067
+ unless @init_hash.include?(KEY_LOCATOR)
1068
+ @init_hash[KEY_LOCATOR] = container[KEY_LOCATOR]
1069
+ @init_hash[KEY_OFFSET] = container[KEY_OFFSET] || 0
1070
+ @init_hash[KEY_LENGTH] = 0
1071
1071
  end
1072
1072
  @current = create_model
1073
1073
  end