# File lib/treetop/compiler/node_classes/sequence.rb, line 53
53: def compile(index, builder, rule)
54: super
55: builder.module_declaration(module_name) do
56: elements_by_name = sequence_elements.inject({}){|h,e| (h[e.label_name.to_s] ||= []) << e; h}
57: sequence_elements.each_with_index do |element, index|
58: if element.label_name
59: repetitions = elements_by_name[element.label_name.to_s]
60: label_name = element.label_name + (repetitions.size > 1 ? (repetitions.index(element)+1).to_s : "")
61: builder.method_declaration(label_name) do
62: builder << "elements[#{index}]"
63: end
64: builder.newline unless index == sequence_elements.size - 1
65: end
66: end
67: end
68: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.