#!/usr/bin/ruby -Ke

# ===============================
# Ruby/Jpp Library
# Version 1.4
# 2006/09/14
# Keichiro Katayama
# ===============================

require "open3"    # Open3::popen3

require "tempfile" # Tempfile

# Patch Start -------------------
# warn(mesg) (ruby 1.8 feature)
if RUBY_VERSION < '1.8' then
  module Kernel
    def warn( mesg )
      $stderr.print mesg, "\n" unless $VERBOSE.nil?
    end
  end # end of Kernel
end
# -------------------------------

# -------------------------------
#require 'kakasi'
#class String
#  # Convert Narrow Character -> Wide Character
#  def to_wide
#    Kakasi::kakasi("-oeuc -aE -jE -gE -kK", self)
#  end
#end
# -------------------------------

module Jpp
  SEPARATER = '-----'
  
  # ===============================
  # Exception Classes
  # ===============================

  # Exception of Jpp
  class JppException < Exception
  end

  # ===============================
  # Pattern Parse Error
  # ===============================
  class PatternParseError < JppException
  end

  # Bracket Pair Mismatch     ex) [...} 
  class BracketPairMismatch < PatternParseError
  end

  # Close Bracket not found!  ex) (...
  class CloseBracketNotFound < PatternParseError
  end

  # Duplicated Movable        ex) $1^{...}..$1^{...}...
  class DuplicateMovable < PatternParseError
  end

  # Unkown pattern Item
  class UnkownPatternItem < PatternParseError
  end

  # ===============================
  # Morph Analyze Error
  # ===============================
  class MorphAnalyzeError < JppException
  end
  
  # ===============================
  # Pattern Morph Analyze Error
  # ===============================
  class PatternMorphAnalyzeError < JppException
  end
  
  class PatternItemMismatch < PatternMorphAnalyzeError
  end
  
  class AlreadyAssigned < PatternMorphAnalyzeError
  end  
  
  class NotFoundParentPattern < PatternMorphAnalyzeError
  end
  
  class CannotAssignAllPatternItems < PatternMorphAnalyzeError
  end

  # ===============================
  # Matching Error
  # ===============================
  class MatchingConfigurationError < JppException
  end

  class MatchingFailed < JppException
  end


end # class Jpp

# ========================


$:.push File.dirname( __FILE__ )

# ========================
# Load Using Libraries
# ========================
require "jpp/libbit"     # Bit Operate Library

# ========================
# Load Sub Libraries
# ========================
# Morph Analyze Library
require "jpp/morph"

# Matching Library
require "jpp/matching"

