class Racc::Sym
表示终结符和非终结符。
属性
assoc[RW]
expand[R]
hash[R]
heads[R]
缓存
ident[R]
locate[R]
precedence[RW]
serialized[W]
value[R]
公共类方法
new(value, dummyp) 点击切换源码
# File racc-1.8.1/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
once_writer(nm) 点击切换源码
# File racc-1.8.1/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
公共实例方法
dummy?() 点击切换源码
# File racc-1.8.1/lib/racc/grammar.rb, line 1104 def dummy? @dummyp end
nonterminal?() 点击切换源码
# File racc-1.8.1/lib/racc/grammar.rb, line 1112 def nonterminal? @nterm end
null=(n) 点击切换源码
# File racc-1.8.1/lib/racc/grammar.rb, line 1174 def null=(n) @null = n end
nullable?() 点击切换源码
# File racc-1.8.1/lib/racc/grammar.rb, line 1170 def nullable? @null end
rule() 点击切换源码
# File racc-1.8.1/lib/racc/grammar.rb, line 1153 def rule Rule.new(nil, [self], UserAction.empty) end
self_null?() 点击切换源码
# File racc-1.8.1/lib/racc/grammar.rb, line 1164 def self_null? @snull end
serialize() 点击切换源码
# File racc-1.8.1/lib/racc/grammar.rb, line 1134 def serialize @serialized end
should_terminal() 点击切换源码
# File racc-1.8.1/lib/racc/grammar.rb, line 1122 def should_terminal @should_terminal = true end
should_terminal?() 点击切换源码
# File racc-1.8.1/lib/racc/grammar.rb, line 1126 def should_terminal? @should_terminal end
string_symbol?() 点击切换源码
# File racc-1.8.1/lib/racc/grammar.rb, line 1130 def string_symbol? @string end
term=(t) 点击切换源码
# File racc-1.8.1/lib/racc/grammar.rb, line 1116 def term=(t) raise 'racc: fatal: term= called twice' unless @term.nil? @term = t @nterm = !t end
terminal?() 点击切换源码
# File racc-1.8.1/lib/racc/grammar.rb, line 1108 def terminal? @term end
useless=(f) 点击切换源码
# File racc-1.8.1/lib/racc/grammar.rb, line 1185 def useless=(f) @useless = f end
useless?() 点击切换源码
# File racc-1.8.1/lib/racc/grammar.rb, line 1181 def useless? @useless end
|(x) 点击切换源码
# File racc-1.8.1/lib/racc/grammar.rb, line 1149 def |(x) rule() | x.rule end