# Path: pyke/krb_compiler/scanner.py
# def t_continuation(t):
# def t_NL_TOK(t):
# def t_indent_sp(t):
# def t_checknl_nl(t):
# def t_checknl_other(t):
# def start_code(plan_name = None, multiline = False,
#                var_format = "(context['%s'])"):
# def mark(t):
# def t_code_string(t):
# def t_code_comment(t):
# def t_code_plan(t):
# def t_code_pattern_var(t):
# def t_code_continuation(t):
# def t_code_open(t):
# def t_code_close(t):
# def t_code_symbol(t):
# def t_code_space(t):
# def t_code_other(t):
# def t_code_NL_TOK(t):
# def t_tsqstring(t):
# def t_tdqstring(t):
# def t_sqstring(t):
# def t_dqstring(t):
# def t_ANONYMOUS_VAR_TOK(t):
# def t_PATTERN_VAR_TOK(t):
# def t_IDENTIFIER_TOK(t):
# def t_float(t):
# def t_hexint(t):
# def t_octalint(t):
# def t_int(t):
# def t_LB_TOK(t):
# def t_LC_TOK(t):
# def t_LP_TOK(t):
# def t_RB_TOK(t):
# def t_RC_TOK(t):
# def t_RP_TOK(t):
# def t_ANY_error(t):
# def count_indent(s, count_all=False):
# def unescape(s):
#     def __init__(self, input):
#     def __iter__(self): return self
#     def next(self):
# def tokenize(s):
# def tokenize_file(filename = 'TEST/scan_test'):
# def syntaxerror_params(pos = None, lineno = None):
# def init(this_module, debug_param, check_tables = False, kfb = False):
# class token_iterator(object):
# 
# Path: pyke/pattern.py
# class pattern(object):
#     def __ne__(self, b): return not (self == b)
# 
#     def simple_match_pattern(self, bindings, my_context, pattern_b, b_context):
#         return self.match_pattern(bindings, my_context, pattern_b, b_context)
# 
#     def lookup(self, context, allow_variable_in_ans = False):
#         return self
# 
# Path: pyke/contexts.py
# class simple_context(object):
# class bc_context(simple_context):
# class variable(pattern.pattern):
# class anonymous(variable):
#     def __init__(self):
#     def dump(self):
#     def bind(self, var_name, var_context, val, val_context = None):
#     def is_bound(self, var):
#     def lookup_data(self, var_name, allow_vars = False, final = None):
#     def lookup(self, var, allow_variable_in_ans = False):
#     def mark(self, save_all_undo = False):
#     def end_save_all_undo(self):
#     def undo_to_mark(self, mark, *var_names_to_undo):
#     def done(self):
#     def _unbind(self, var_name):
#     def __init__(self, rule):
#     def name(self): return self.rule.name
#     def __repr__(self):
#     def create_plan(self, final = None):
#     def __new__(cls, name):
#     def __init__(self, name):
#     def __repr__(self): return '$' + self.name
#     def lookup(self, my_context, allow_variable_in_ans = False):
#     def match_data(self, bindings, my_context, data):
#     def simple_match_pattern(self, bindings, my_context, pattern_b, b_context):
#     def match_pattern(self, bindings, my_context, pattern_b, b_context):
#     def as_data(self, my_context, allow_vars = False, final = None):
#     def is_data(self, my_context):
#     def __init__(self, name):
#     def lookup(self, my_context, allow_variable_in_ans = False):
#     def match_data(self, bindings, my_context, data):
#     def match_pattern(self, bindings, my_context, pattern_b, b_context):
#     def as_data(self, my_context, allow_vars = False, final = None):
#     def is_data(self, my_context):


import itertools
import warnings
import os, os.path
    import pprint
from pyke.krb_compiler.ply import yacc
from pyke.krb_compiler import scanner
from pyke import pattern, contexts

def p_python_rule_code(p):
    ''' python_rule_code : CODE_TOK
    '''
    p[0] = p[1]

def p_python_plan_code(p):
    ''' python_plan_code : CODE_TOK
    '''
    p[0] = p[1]

def p_python_extras_code(p):
    ''' python_extras_code : CODE_TOK
    '''
    p[0] = p[1][0]

def p_pattern_var(p):
    ''' variable : PATTERN_VAR_TOK
    '''
    global pattern_vars
    if goal_mode:
        pattern_vars.append(p[1])
        p[0] = contexts.variable(p[1])
    else:
        p[0] = "contexts.variable(%s)" % p[1]

def p_anonymous_var(p):
    ''' variable : ANONYMOUS_VAR_TOK
    '''
    if goal_mode:

# Path: pyke/krb_compiler/scanner.py
# def t_continuation(t):
# def t_NL_TOK(t):
# def t_indent_sp(t):
# def t_checknl_nl(t):
# def t_checknl_other(t):
# def start_code(plan_name = None, multiline = False,
#                var_format = "(context['%s'])"):
# def mark(t):
# def t_code_string(t):
# def t_code_comment(t):
# def t_code_plan(t):
# def t_code_pattern_var(t):
# def t_code_continuation(t):
# def t_code_open(t):
# def t_code_close(t):
# def t_code_symbol(t):
# def t_code_space(t):
# def t_code_other(t):
# def t_code_NL_TOK(t):
# def t_tsqstring(t):
# def t_tdqstring(t):
# def t_sqstring(t):
# def t_dqstring(t):
# def t_ANONYMOUS_VAR_TOK(t):
# def t_PATTERN_VAR_TOK(t):
# def t_IDENTIFIER_TOK(t):
# def t_float(t):
# def t_hexint(t):
# def t_octalint(t):
# def t_int(t):
# def t_LB_TOK(t):
# def t_LC_TOK(t):
# def t_LP_TOK(t):
# def t_RB_TOK(t):
# def t_RC_TOK(t):
# def t_RP_TOK(t):
# def t_ANY_error(t):
# def count_indent(s, count_all=False):
# def unescape(s):
#     def __init__(self, input):
#     def __iter__(self): return self
#     def next(self):
# def tokenize(s):
# def tokenize_file(filename = 'TEST/scan_test'):
# def syntaxerror_params(pos = None, lineno = None):
# def init(this_module, debug_param, check_tables = False, kfb = False):
# class token_iterator(object):
# 
# Path: pyke/pattern.py
# class pattern(object):
#     def __ne__(self, b): return not (self == b)
# 
#     def simple_match_pattern(self, bindings, my_context, pattern_b, b_context):
#         return self.match_pattern(bindings, my_context, pattern_b, b_context)
# 
#     def lookup(self, context, allow_variable_in_ans = False):
#         return self
# 
# Path: pyke/contexts.py
# class simple_context(object):
# class bc_context(simple_context):
# class variable(pattern.pattern):
# class anonymous(variable):
#     def __init__(self):
#     def dump(self):
#     def bind(self, var_name, var_context, val, val_context = None):
#     def is_bound(self, var):
#     def lookup_data(self, var_name, allow_vars = False, final = None):
#     def lookup(self, var, allow_variable_in_ans = False):
#     def mark(self, save_all_undo = False):
#     def end_save_all_undo(self):
#     def undo_to_mark(self, mark, *var_names_to_undo):
#     def done(self):
#     def _unbind(self, var_name):
#     def __init__(self, rule):
#     def name(self): return self.rule.name
#     def __repr__(self):
#     def create_plan(self, final = None):
#     def __new__(cls, name):
#     def __init__(self, name):
#     def __repr__(self): return '$' + self.name
#     def lookup(self, my_context, allow_variable_in_ans = False):
#     def match_data(self, bindings, my_context, data):
#     def simple_match_pattern(self, bindings, my_context, pattern_b, b_context):
#     def match_pattern(self, bindings, my_context, pattern_b, b_context):
#     def as_data(self, my_context, allow_vars = False, final = None):
#     def is_data(self, my_context):
#     def __init__(self, name):
#     def lookup(self, my_context, allow_variable_in_ans = False):
#     def match_data(self, bindings, my_context, data):
#     def match_pattern(self, bindings, my_context, pattern_b, b_context):
#     def as_data(self, my_context, allow_vars = False, final = None):
#     def is_data(self, my_context):


# Path: pyke/krb_compiler/krbparser.py
import itertools
import warnings
import os, os.path
    import pprint
from pyke.krb_compiler.ply import yacc
from pyke.krb_compiler import scanner
from pyke import pattern, contexts


def p_python_rule_code(p):
    ''' python_rule_code : CODE_TOK
    '''
    p[0] = p[1]

def p_python_plan_code(p):
    ''' python_plan_code : CODE_TOK
    '''
    p[0] = p[1]

def p_python_extras_code(p):
    ''' python_extras_code : CODE_TOK
    '''
    p[0] = p[1][0]

def p_pattern_var(p):
    ''' variable : PATTERN_VAR_TOK
    '''
    global pattern_vars
    if goal_mode:
        pattern_vars.append(p[1])
        p[0] = contexts.variable(p[1])
    else:
        p[0] = "contexts.variable(%s)" % p[1]

def p_anonymous_var(p):
    ''' variable : ANONYMOUS_VAR_TOK
    '''
    if goal_mode:

        p[0] = contexts.anonymous(p[1])