class KPeg::InvokeRule

Attributes

arguments[R]
rule_name[R]

Public Class Methods

new(name, args=nil) click to toggle source
Calls superclass method KPeg::Operator::new
# File lib/kpeg/grammar.rb, line 432
def initialize(name, args=nil)
  super()
  @rule_name = name
  @arguments = args
end

Public Instance Methods

==(obj) click to toggle source
Calls superclass method
# File lib/kpeg/grammar.rb, line 446
def ==(obj)
  case obj
  when InvokeRule
    @rule_name == obj.rule_name and @arguments == obj.arguments
  else
    super
  end
end
inspect() click to toggle source
# File lib/kpeg/grammar.rb, line 455
def inspect
  if @arguments
    body = "#{@rule_name} #{@arguments}"
  else
    body = @rule_name
  end
  inspect_type "invoke", body
end
match(x) click to toggle source
# File lib/kpeg/grammar.rb, line 440
def match(x)
  rule = x.grammar.find(@rule_name)
  raise "Unknown rule: '#{@rule_name}'" unless rule
  x.invoke rule
end