Class
A set of rule and position in it’s RHS. Note that the number of pointers is more than rule’s RHS array, because pointer points right edge of the final symbol when reducing.
Attributes
Read
No documentation available
Read
No documentation available
Read
No documentation available
Read
No documentation available
Read
No documentation available
Read
No documentation available
Read
No documentation available
Read
No documentation available
Class Methods
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/grammar.rb, line 809
def initialize(rule, i, sym)
@rule = rule
@index = i
@symbol = sym
@ident = @rule.hash + i
@reduce = sym.nil?
end
No documentation available
Instance Methods
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/grammar.rb, line 851
def before(len)
@rule.ptrs[@index - len] or ptr_bug!
end
No documentation available
#
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/grammar.rb, line 835
def eql?(ot)
@hash == ot.hash
end
No documentation available
#
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/grammar.rb, line 841
def head?
@index == 0
end
No documentation available
#
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/grammar.rb, line 845
def next
@rule.ptrs[@index + 1] or ptr_bug!
end
No documentation available
#
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/grammar.rb, line 857
def ptr_bug!
raise "racc: fatal: pointer not exist: self: #{to_s}"
end
No documentation available
#
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/grammar.rb, line 828
def to_s
sprintf('(%d,%d %s)',
@rule.ident, @index, (reduce?() ? '#' : @symbol.to_s))
end
No documentation available