Object
# File racc/grammar.rb, line 687 def ==(other) other.kind_of?(Rule) and @ident == other.ident end
# File racc/grammar.rb, line 707 def accept? if tok = @symbols[-1] tok.anchor? else false end end
# File racc/grammar.rb, line 715 def each(&block) @symbols.each(&block) end
# File racc/grammar.rb, line 636 def each_rule(&block) yield self @alternatives.each(&block) end
# File racc/grammar.rb, line 646 def hash=(n) @hash = n ptrs = [] @symbols.each_with_index do |sym, idx| ptrs.push LocationPointer.new(self, idx, sym) end ptrs.push LocationPointer.new(self, @symbols.size, nil) @ptrs = ptrs end
# File racc/grammar.rb, line 683 def inspect "#<Racc::Rule id=#{@ident} (#{@target})>" end
# File racc/grammar.rb, line 664 def prec(sym, &block) @specified_prec = sym if block unless @action.empty? raise CompileError, 'both of rule action block and prec block given' end @action = UserAction.proc(block) end self end
# File racc/grammar.rb, line 656 def precedence @specified_prec || @precedence end
# File racc/grammar.rb, line 660 def precedence=(sym) @precedence ||= sym end
# File racc/grammar.rb, line 719 def replace(src, dest) @target = dest @symbols = @symbols.map {|s| s == src ? dest : s } end