Class
Stands terminal and nonterminal symbols.
Attributes
Read
No documentation available
Read
No documentation available
Read
No documentation available
Write
No documentation available
Read & Write
No documentation available
Read & Write
No documentation available
Read
cache
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 969
def initialize(value, dummyp)
@ident = nil
@value = value
@dummyp = dummyp
@term = nil
@nterm = nil
@should_terminal = false
@precedence = nil
case value
when Symbol
@to_s = value.to_s
@serialized = value.inspect
@string = false
when String
@to_s = value.inspect
@serialized = value.dump
@string = true
when false
@to_s = '$end'
@serialized = 'false'
@string = false
when ErrorSymbolValue
@to_s = 'error'
@serialized = 'Object.new'
@string = false
else
raise ArgumentError, "unknown symbol value: #{value.class}"
end
@heads = []
@locate = []
@snull = nil
@null = nil
@expand = nil
@useless = nil
end
No documentation available
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/grammar.rb, line 1008
def once_writer(nm)
nm = nm.id2name
module_eval(<<-EOS)
def #{nm}=(v)
raise 'racc: fatal: @#{nm} != nil' unless @#{nm}.nil?
@#{nm} = v
end
EOS
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 1026
def dummy?
@dummyp
end
No documentation available
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/grammar.rb, line 1034
def nonterminal?
@nterm
end
No documentation available
#
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/grammar.rb, line 1096
def null=(n)
@null = n
end
No documentation available
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/grammar.rb, line 1092
def nullable?
@null
end
No documentation available
#
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/grammar.rb, line 1075
def rule
Rule.new(nil, [self], UserAction.empty)
end
No documentation available
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/grammar.rb, line 1086
def self_null?
@snull
end
No documentation available
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/grammar.rb, line 1056
def serialize
@serialized
end
No documentation available
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/grammar.rb, line 1044
def should_terminal
@should_terminal = true
end
No documentation available
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/grammar.rb, line 1048
def should_terminal?
@should_terminal
end
No documentation available
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/grammar.rb, line 1052
def string_symbol?
@string
end
No documentation available
#
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/grammar.rb, line 1038
def term=(t)
raise 'racc: fatal: term= called twice' unless @term.nil?
@term = t
@nterm = !t
end
No documentation available
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/grammar.rb, line 1030
def terminal?
@term
end
No documentation available
#
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/grammar.rb, line 1065
def to_s
@to_s.dup
end
No documentation available
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/grammar.rb, line 1107
def useless=(f)
@useless = f
end
No documentation available
#
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/grammar.rb, line 1103
def useless?
@useless
end
No documentation available
#
lib/racc/grammar.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/grammar.rb, line 1071
def |(x)
rule() | x.rule
end
No documentation available