Sha256: 9c1bc32bf18f647f40231d504c1cd66abff0aa1d5070cb13b1383824edda80c2
Contents?: true
Size: 816 Bytes
Versions: 5
Compression:
Stored size: 816 Bytes
Contents
module Treetop module Compiler class DeclarationSequence < Runtime::SyntaxNode def compile(builder) unless rules.empty? builder.method_declaration("root") do builder.assign 'result', rules.first.method_name builder.if__ 'index == input.size' do builder << 'return result' end builder.else_ do builder << 'return ParseFailure.new(input, index, result.nested_failures)' end end builder.newline end declarations.each do |declaration| declaration.compile(builder) builder.newline end end def rules declarations.select { |declaration| declaration.instance_of?(ParsingRule) } end end end end
Version data entries
5 entries across 5 versions & 1 rubygems