znmud-0.0.1/benchmark/
znmud-0.0.1/cmd/
znmud-0.0.1/cmd/emotes/
znmud-0.0.1/cmd/objects/
znmud-0.0.1/cmd/tiny/
znmud-0.0.1/doc/
znmud-0.0.1/farts/
znmud-0.0.1/lib/
znmud-0.0.1/lib/combat/
znmud-0.0.1/lib/core/bodytypes/
znmud-0.0.1/lib/engine/
znmud-0.0.1/lib/farts/
znmud-0.0.1/logs/
#
# DO NOT MODIFY!!!!
# This file is automatically generated by racc 1.4.4
# from racc grammer file "lib/utility/boolexp.y".
#

require 'racc/parser'



#
# file::    boolexp_parser.rb
# author::  Jon A. Lambert
# version:: 2.8.0
# date::    01/19/2006
#
# This source code copyright (C) 2005, 2006 by Jon A. Lambert
# All rights reserved.
#
# Released under the terms of the TeensyMUD Public License
# See LICENSE file for additional information.
#
$:.unshift "lib" if !$:.include? "lib"
$:.unshift "vendor" if !$:.include? "vendor"

if $0 == __FILE__
  Dir.chdir("../..")
  $:.unshift "../../lib"
  require 'pp'
end
require 'core/script'


class BoolExpParser < Racc::Parser

module_eval <<'..end lib/utility/boolexp.y modeval..ida4cfdfe934', 'lib/utility/boolexp.y', 58

  def initialize(obj)
    @obj = obj
  end

  def parse(str)
    @q = []
    until str.empty?
      case str
      when /\A\s+/
      when /\A[#]?(\d+)/
        @q.push [:NUMBER, $1.to_i]
      when /\A.|\n/o
        s = $&
        @q.push [s, s]
      end
      str = $'
    end
    @q.push [false, '$end']
    do_parse
  end

  def next_token
    @q.shift
  end

..end lib/utility/boolexp.y modeval..ida4cfdfe934

##### racc 1.4.4 generates ###

racc_reduce_table = [
 0, 0, :racc_error,
 3, 9, :_reduce_1,
 3, 9, :_reduce_2,
 3, 9, :_reduce_3,
 2, 9, :_reduce_4,
 1, 9, :_reduce_5 ]

racc_reduce_n = 6

racc_shift_n = 14

racc_action_table = [
     1,     1,    11,     2,     2,     3,     3,     1,     1,     5,
     2,     2,     3,     3,     7,     8,   nil,     8,     9,     8,
     9,   nil,    10 ]

racc_action_check = [
     0,     9,     7,     0,     9,     0,     9,     8,     2,     1,
     8,     2,     8,     2,     4,    13,   nil,     4,     4,     6,
     6,   nil,     6 ]

racc_action_pointer = [
    -2,     2,     6,   nil,    14,   nil,    16,     2,     5,    -1,
   nil,   nil,   nil,    12 ]

racc_action_default = [
    -6,    -6,    -6,    -5,    -6,    -4,    -6,    -6,    -6,    -6,
    -3,    14,    -1,    -2 ]

racc_goto_table = [
     4,   nil,     6,   nil,   nil,   nil,   nil,   nil,    12,    13 ]

racc_goto_check = [
     1,   nil,     1,   nil,   nil,   nil,   nil,   nil,     1,     1 ]

racc_goto_pointer = [
   nil,     0 ]

racc_goto_default = [
   nil,   nil ]

racc_token_table = {
 false => 0,
 Object.new => 1,
 "!" => 2,
 "&" => 3,
 "|" => 4,
 "(" => 5,
 ")" => 6,
 :NUMBER => 7 }

racc_use_result_var = true

racc_nt_base = 8

Racc_arg = [
 racc_action_table,
 racc_action_check,
 racc_action_default,
 racc_action_pointer,
 racc_goto_table,
 racc_goto_check,
 racc_goto_default,
 racc_goto_pointer,
 racc_nt_base,
 racc_reduce_table,
 racc_token_table,
 racc_shift_n,
 racc_reduce_n,
 racc_use_result_var ]

Racc_token_to_s_table = [
'$end',
'error',
'"!"',
'"&"',
'"|"',
'"("',
'")"',
'NUMBER',
'$start',
'exp']

Racc_debug_parser = false

##### racc system variables end #####

 # reduce 0 omitted

module_eval <<'.,.,', 'lib/utility/boolexp.y', 23
  def _reduce_1( val, _values, result )
 result &&= val[2]
   result
  end
.,.,

module_eval <<'.,.,', 'lib/utility/boolexp.y', 24
  def _reduce_2( val, _values, result )
 result ||= val[2]
   result
  end
.,.,

module_eval <<'.,.,', 'lib/utility/boolexp.y', 25
  def _reduce_3( val, _values, result )
 result = val[1]
   result
  end
.,.,

module_eval <<'.,.,', 'lib/utility/boolexp.y', 26
  def _reduce_4( val, _values, result )
 result = !@obj.contents.include?(val[1])
   result
  end
.,.,

module_eval <<'.,.,', 'lib/utility/boolexp.y', 27
  def _reduce_5( val, _values, result )
 result = @obj.contents.include?(val[0])
   result
  end
.,.,

 def _reduce_none( val, _values, result )
  result
 end

end   # class BoolExpParser



#
# BoolExp testing
#
if $0 == __FILE__
  class Obj
    attr_accessor :contents
  end

  actor = Obj.new
  actor.contents = [234]
  str ="((!#245)&#234)"

  begin
    x = BoolExpParser.new(actor).parse(str)
    pp str, actor.contents, x
    actor.contents = [234,245]
    x = BoolExpParser.new(actor).parse(str)
    pp str, actor.contents, x
    str ="((!#1)&#1)"
    x = BoolExpParser.new(actor).parse(str)
    pp str, actor.contents, x
    str ="234|1"
    x = BoolExpParser.new(actor).parse(str)
    pp str, actor.contents, x
    str ="xxxxxxxx"
    x = BoolExpParser.new(actor).parse(str)
    pp str, actor.contents, x

  rescue Racc::ParseError, Exception
    pp $!
    exit 
  end
end