Stands terminal and nonterminal symbols.
# File ruby-3.1.2/lib/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 ruby-3.1.2/lib/racc/grammar.rb, line 1031 def dummy? @dummyp end
# File ruby-3.1.2/lib/racc/grammar.rb, line 1039 def nonterminal? @nterm end
# File ruby-3.1.2/lib/racc/grammar.rb, line 1101 def null=(n) @null = n end
# File ruby-3.1.2/lib/racc/grammar.rb, line 1097 def nullable? @null end
# File ruby-3.1.2/lib/racc/grammar.rb, line 1080 def rule Rule.new(nil, [self], UserAction.empty) end
# File ruby-3.1.2/lib/racc/grammar.rb, line 1091 def self_null? @snull end
# File ruby-3.1.2/lib/racc/grammar.rb, line 1061 def serialize @serialized end
# File ruby-3.1.2/lib/racc/grammar.rb, line 1049 def should_terminal @should_terminal = true end
# File ruby-3.1.2/lib/racc/grammar.rb, line 1053 def should_terminal? @should_terminal end
# File ruby-3.1.2/lib/racc/grammar.rb, line 1057 def string_symbol? @string end
# File ruby-3.1.2/lib/racc/grammar.rb, line 1043 def term=(t) raise 'racc: fatal: term= called twice' unless @term.nil? @term = t @nterm = !t end
# File ruby-3.1.2/lib/racc/grammar.rb, line 1035 def terminal? @term end
# File ruby-3.1.2/lib/racc/grammar.rb, line 1070 def to_s @to_s.dup end
# File ruby-3.1.2/lib/racc/grammar.rb, line 1112 def useless=(f) @useless = f end