Object
Stands terminal and nonterminal symbols.
# File racc/grammar.rb, line 974
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
# File racc/grammar.rb, line 1080
def rule
Rule.new(nil, [self], UserAction.empty)
end
# File racc/grammar.rb, line 1049
def should_terminal
@should_terminal = true
end
# File racc/grammar.rb, line 1053
def should_terminal?
@should_terminal
end
# File racc/grammar.rb, line 1057
def string_symbol?
@string
end
# File racc/grammar.rb, line 1043
def term=(t)
raise 'racc: fatal: term= called twice' unless @term.nil?
@term = t
@nterm = !t
end
# File racc/grammar.rb, line 1070
def to_s
@to_s.dup
end