class Racc::Grammar::PrecedenceDefinitionEnv - RDoc Documentation

# class Racc::Grammar::PrecedenceDefinitionEnv

### Attributes

reverse[R]

### Public Class Methods

new(g) click to toggle source

    # File lib/racc/grammar.rb, line 366
    def initialize(g)
      @grammar = g
      @prechigh_seen = false
      @preclow_seen = false
      @reverse = false
    end

### Public Instance Methods

higher() click to toggle source

    # File lib/racc/grammar.rb, line 375
    def higher
      if @prechigh_seen
        raise CompileError, "prechigh used twice"
      end
      @prechigh_seen = true
    end

left(*syms) click to toggle source

    # File lib/racc/grammar.rb, line 392
    def left(*syms)
      @grammar.declare_precedence :Left, syms.map {|s| @grammar.intern(s) }
    end

lower() click to toggle source

    # File lib/racc/grammar.rb, line 382
    def lower
      if @preclow_seen
        raise CompileError, "preclow used twice"
      end
      if @prechigh_seen
        @reverse = true
      end
      @preclow_seen = true
    end

nonassoc(*syms) click to toggle source

    # File lib/racc/grammar.rb, line 400
    def nonassoc(*syms)
      @grammar.declare_precedence :Nonassoc, syms.map {|s| @grammar.intern(s)}
    end

right(*syms) click to toggle source

    # File lib/racc/grammar.rb, line 396
    def right(*syms)
      @grammar.declare_precedence :Right, syms.map {|s| @grammar.intern(s) }
    end