class Racc::Sym
Stands terminal and nonterminal symbols.
Attributes
cache
Public Class Methods
Source
# File lib/racc/grammar.rb, line 1051 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 else raise ArgumentError, "unknown symbol value: #{value.class}" end @heads = [] @locate = [] @snull = nil @null = nil @expand = nil @useless = nil end
Source
# File lib/racc/grammar.rb, line 1086 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
Public Instance Methods
Source
# File lib/racc/grammar.rb, line 1153 def rule Rule.new(nil, [self], UserAction.empty) end
Source
# File lib/racc/grammar.rb, line 1122 def should_terminal @should_terminal = true end
Source
# File lib/racc/grammar.rb, line 1126 def should_terminal? @should_terminal end
Source
# File lib/racc/grammar.rb, line 1116 def term=(t) raise 'racc: fatal: term= called twice' unless @term.nil? @term = t @nterm = !t end