Class: Racc::Grammar::PrecedenceDefinitionEnv
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/racc/grammar.rb |
Class Method Summary
- .new(g) ⇒ PrecedenceDefinitionEnv constructor
Instance Attribute Summary
- #reverse readonly
Instance Method Summary
Constructor Details
.new(g) ⇒ PrecedenceDefinitionEnv
# File 'lib/racc/grammar.rb', line 361
def initialize(g) @grammar = g @prechigh_seen = false @preclow_seen = false @reverse = false end
Instance Attribute Details
#reverse (readonly)
[ GitHub ]# File 'lib/racc/grammar.rb', line 368
attr_reader :reverse
Instance Method Details
#higher
[ GitHub ]# File 'lib/racc/grammar.rb', line 370
def higher if @prechigh_seen raise CompileError, "prechigh used twice" end @prechigh_seen = true end
#left(*syms)
[ GitHub ]# File 'lib/racc/grammar.rb', line 387
def left(*syms) @grammar.declare_precedence :Left, syms.map {|s| @grammar.intern(s) } end
#lower
[ GitHub ]# File 'lib/racc/grammar.rb', line 377
def lower if @preclow_seen raise CompileError, "preclow used twice" end if @prechigh_seen @reverse = true end @preclow_seen = true end
#nonassoc(*syms)
[ GitHub ]# File 'lib/racc/grammar.rb', line 395
def nonassoc(*syms) @grammar.declare_precedence :Nonassoc, syms.map {|s| @grammar.intern(s)} end
#right(*syms)
[ GitHub ]# File 'lib/racc/grammar.rb', line 391
def right(*syms) @grammar.declare_precedence :Right, syms.map {|s| @grammar.intern(s) } end