Method: EBNF::Rule#build

Defined in:
lib/ebnf/rule.rb

#build(expr, kind: nil, cleanup: nil, **options) ⇒ Object

Build a new rule creating a symbol and numbering from the current rule Symbol and number creation is handled by the top-most rule in such a chain.

Parameters:

  • expr (Array)
  • kind (Symbol) (defaults to: nil)

    (nil)

  • cleanup (Hash{Symbol => Symbol}) (defaults to: nil)

    (nil)

  • options (Hash{Symbol => Object})


184
185
186
187
188
189
190
191
192
# File 'lib/ebnf/rule.rb', line 184

def build(expr, kind: nil, cleanup: nil, **options)
  new_sym, new_id = @top_rule.send(:make_sym_id)
  self.class.new(new_sym, new_id, expr,
                 kind: kind,
                 ebnf: @ebnf,
                 top_rule: @top_rule,
                 cleanup: cleanup,
                 **options)
end