Sha256: 43d81a8d9a6e2354ef5fb0cb3483075b1e528c6ca2993bf0e6694ef34f64f9d1

Contents?: true

Size: 713 Bytes

Versions: 5

Compression:

Stored size: 713 Bytes

Contents

module RipperRubyParser
  module SexpHandlers
    # Sexp handlers for argument lists
    module Arguments
      def process_args_add_block(exp)
        _, regular, block = exp.shift 3
        args = process(regular)
        args << s(:block_pass, process(block)) if block
        s(:arglist, *args.sexp_body)
      end

      def process_args_add_star(exp)
        generic_add_star exp
      end

      def process_arg_paren(exp)
        _, args = exp.shift 2
        args = s() if args.nil?
        args.unshift :arglist unless args.first.is_a? Symbol
        process(args)
      end

      def process_rest_param(exp)
        _, ident = exp.shift 2
        s(:splat, process(ident))
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ripper_ruby_parser-1.4.2 lib/ripper_ruby_parser/sexp_handlers/arguments.rb
ripper_ruby_parser-1.4.1 lib/ripper_ruby_parser/sexp_handlers/arguments.rb
ripper_ruby_parser-1.4.0 lib/ripper_ruby_parser/sexp_handlers/arguments.rb
ripper_ruby_parser-1.3.0 lib/ripper_ruby_parser/sexp_handlers/arguments.rb
ripper_ruby_parser-1.2.0 lib/ripper_ruby_parser/sexp_handlers/arguments.rb