Class: Racc::LocationPointer
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/racc/grammar.rb |
Overview
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.
Class Method Summary
- .new(rule, i, sym) ⇒ LocationPointer constructor
Instance Attribute Summary
Instance Method Summary
-
#==(ot)
Alias for #eql?.
- #before(len)
- #eql?(ot) ⇒ Boolean (also: #==)
-
#increment
Alias for #next.
-
#inspect
Alias for #to_s.
- #next (also: #increment)
- #reduce (also: #reduce?) readonly
- #to_s (also: #inspect)
- #ptr_bug! private
Constructor Details
.new(rule, i, sym) ⇒ LocationPointer
Instance Attribute Details
#dereference (readonly)
Alias for #symbol.
# File 'lib/racc/grammar.rb', line 826
alias dereference symbol
#hash (readonly)
Alias for #ident.
# File 'lib/racc/grammar.rb', line 829
alias hash ident
#head? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/racc/grammar.rb', line 846
def head? @index == 0 end
#ident (readonly) Also known as: #hash
[ GitHub ]# File 'lib/racc/grammar.rb', line 828
attr_reader :ident
#index (readonly)
[ GitHub ]# File 'lib/racc/grammar.rb', line 823
attr_reader :index
#reduce? (readonly)
Alias for #reduce.
# File 'lib/racc/grammar.rb', line 831
alias reduce? reduce
#rule (readonly)
[ GitHub ]# File 'lib/racc/grammar.rb', line 822
attr_reader :rule
#symbol (readonly) Also known as: #dereference
[ GitHub ]# File 'lib/racc/grammar.rb', line 824
attr_reader :symbol
Instance Method Details
#==(ot)
Alias for #eql?.
# File 'lib/racc/grammar.rb', line 844
alias == eql?
#before(len)
[ GitHub ]# File 'lib/racc/grammar.rb', line 856
def before(len) @rule.ptrs[@index - len] or ptr_bug! end
#eql?(ot) ⇒ Boolean
Also known as: #==
# File 'lib/racc/grammar.rb', line 840
def eql?(ot) @hash == ot.hash end
#increment
Alias for #next.
# File 'lib/racc/grammar.rb', line 854
alias increment next
#inspect
Alias for #to_s.
# File 'lib/racc/grammar.rb', line 838
alias inspect to_s
#next Also known as: #increment
[ GitHub ]# File 'lib/racc/grammar.rb', line 850
def next @rule.ptrs[@index + 1] or ptr_bug! end
#ptr_bug! (private)
[ GitHub ]# File 'lib/racc/grammar.rb', line 862
def ptr_bug! raise "racc: fatal: pointer not exist: self: #{to_s}" end
#reduce (readonly) Also known as: #reduce?
[ GitHub ]# File 'lib/racc/grammar.rb', line 830
attr_reader :reduce