Class
Attributes
Read & Write
No documentation available
Read
No documentation available
Read
No documentation available
Read & Write
No documentation available
Read
No documentation available
Read
No documentation available
Read & Write
No documentation available
Class Methods
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-3.2.0/lib/racc/grammar.rb, line 608
def initialize(target, syms, act)
@target = target
@symbols = syms
@action = act
@alternatives = []
@ident = nil
@hash = nil
@ptrs = nil
@precedence = nil
@specified_prec = nil
@null = nil
@useless = nil
end
No documentation available
Instance Methods
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-3.2.0/lib/racc/grammar.rb, line 687
def ==(other)
other.kind_of?(Rule) and @ident == other.ident
end
No documentation available
#
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-3.2.0/lib/racc/grammar.rb, line 691
def [](idx)
@symbols[idx]
end
No documentation available
#
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-3.2.0/lib/racc/grammar.rb, line 707
def accept?
if tok = @symbols[-1]
tok.anchor?
else
false
end
end
No documentation available
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-3.2.0/lib/racc/grammar.rb, line 715
def each(&block)
@symbols.each(&block)
end
No documentation available
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-3.2.0/lib/racc/grammar.rb, line 636
def each_rule(&block)
yield self
@alternatives.each(&block)
end
No documentation available
#
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-3.2.0/lib/racc/grammar.rb, line 699
def empty?
@symbols.empty?
end
No documentation available
#
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-3.2.0/lib/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
No documentation available
#
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-3.2.0/lib/racc/grammar.rb, line 683
def inspect
"#<Racc::Rule id=#{@ident} (#{@target})>"
end
No documentation available
#
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-3.2.0/lib/racc/grammar.rb, line 678
def null=(n) @null = n end
No documentation available
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-3.2.0/lib/racc/grammar.rb, line 677
def nullable?() @null end
No documentation available
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-3.2.0/lib/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
No documentation available
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-3.2.0/lib/racc/grammar.rb, line 656
def precedence
@specified_prec || @precedence
end
No documentation available
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-3.2.0/lib/racc/grammar.rb, line 660
def precedence=(sym)
@precedence ||= sym
end
No documentation available
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-3.2.0/lib/racc/grammar.rb, line 719
def replace(src, dest)
@target = dest
@symbols = @symbols.map {|s| s == src ? dest : s }
end
No documentation available
#
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-3.2.0/lib/racc/grammar.rb, line 632
def rule
self
end
No documentation available
#
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-3.2.0/lib/racc/grammar.rb, line 695
def size
@symbols.size
end
No documentation available
#
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-3.2.0/lib/racc/grammar.rb, line 703
def to_s
"#<rule#{@ident}>"
end
No documentation available
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-3.2.0/lib/racc/grammar.rb, line 681
def useless=(u) @useless = u end
No documentation available
#
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-3.2.0/lib/racc/grammar.rb, line 680
def useless?() @useless end
No documentation available
#
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-3.2.0/lib/racc/grammar.rb, line 627
def |(x)
@alternatives.push x.rule
self
end
No documentation available