Stands terminal and nonterminal symbols.
cache
# File lib/racc/grammar.rb, line 1028 def dummy? @dummyp end
# File lib/racc/grammar.rb, line 1036 def nonterminal? @nterm end
# File lib/racc/grammar.rb, line 1098 def null=(n) @null = n end
# File lib/racc/grammar.rb, line 1094 def nullable? @null end
# File lib/racc/grammar.rb, line 1077 def rule Rule.new(nil, [self], UserAction.empty) end
# File lib/racc/grammar.rb, line 1088 def self_null? @snull end
# File lib/racc/grammar.rb, line 1058 def serialize @serialized end
# File lib/racc/grammar.rb, line 1046 def should_terminal @should_terminal = true end
# File lib/racc/grammar.rb, line 1050 def should_terminal? @should_terminal end
# File lib/racc/grammar.rb, line 1054 def string_symbol? @string end
# File lib/racc/grammar.rb, line 1040 def term=(t) raise 'racc: fatal: term= called twice' unless @term.nil? @term = t @nterm = !t end
# File lib/racc/grammar.rb, line 1032 def terminal? @term end
# File lib/racc/grammar.rb, line 1067 def to_s @to_s.dup end
# File lib/racc/grammar.rb, line 1109 def useless=(f) @useless = f end
# File lib/racc/grammar.rb, line 1105 def useless? @useless end
# File lib/racc/grammar.rb, line 1073 def |(x) rule() | x.rule end
# File lib/racc/grammar.rb, line 971 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 lib/racc/grammar.rb, line 1010 def once_writer(nm) nm = nm.id2name module_eval(" def #{nm}=(v) raise 'racc: fatal: @#{nm} != nil' unless @#{nm}.nil? @#{nm} = v end ") end