class KPeg::Operator
Attributes
action[RW]
Public Class Methods
new()
click to toggle source
# File lib/kpeg/grammar.rb, line 17 def initialize @action = nil @has_tags = false end
Public Instance Methods
inspect_type(tag, body)
click to toggle source
# File lib/kpeg/grammar.rb, line 45 def inspect_type(tag, body) "#<#{tag} #{body}>" end
prune_values(values)
click to toggle source
# File lib/kpeg/grammar.rb, line 40 def prune_values(values) return values unless @has_tags return values.values_at(*@tags) end
set_action(act)
click to toggle source
# File lib/kpeg/grammar.rb, line 24 def set_action(act) @action = act end
|(other)
click to toggle source
# File lib/kpeg/grammar.rb, line 49 def |(other) Choice.new(self, Grammar.resolve(other)) end