Module: L43Peg::Combinators::Boxed

Extended by:
Boxed
Included in:
Boxed
Defined in:
lib/l43_peg/combinators/boxed.rb

Instance Method Summary collapse

Instance Method Details

#boxed(parser, box, name: nil, &mapper) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/l43_peg/combinators/boxed.rb', line 6

def boxed(parser, box, name: nil, &mapper)
  name ||= "boxed(#parser.name})"
  Combinators.map(parser, name:) { |ast|
    ast = mapper.(ast) if mapper
    Mappers.box(box, ast)
  }
end