# Path: hexlite/ast/shallowparser.py
# def message(s):
# def t_newline(t):
# def t_COMMENT(t):
# def t_error(t):
# def p_content_1(p):
# def p_content_2(p):
# def p_statement(p):
# def p_rule(p):
# def p_disjlist(p):
# def p_semicollist_1(p):
# def p_semicollist_2(p):
# def p_expandlist(p):
# def p_collist_1(p):
# def p_collist_2(p):
# def p_conjlist(p):
# def p_commalist_1(p):
# def p_commalist_2(p):
# def p_commalist_3(p):
# def p_elist_1(p):
# def p_elist_2(p):
# def p_eterm_1(p):
# def p_eterm_2(p):
# def p_eterm_3(p):
# def p_eterm_4(p):
# def p_error(p):
# def parseTerm(content):
# def parse(content):
# def testparse():
# def shallowprint(x,sepspace=' ', listspace=' ',unaryTupleFinalComma=False):
# def testprint():
# def main():
#   DEBUG=False
#   TESTSDIR='../tests/'
#   TESTSDIR='../tests/'


import hexlite.rewriter
import hexlite.auxiliary as aux
import logging, pprint
from hexlite.ast import shallowparser as shp


class ProgramRewriter(hexlite.rewriter.ProgramRewriter):
    def __init__(self, pcontext, shallowprogram, plugins, config):
        # rewrite shallowprogram:
        # * heads that are actions become auxiliary atoms AUXACTION(actionname,c(arguments),prio,cbp)
        # then init original rewriter
        newshallowprogram = self.__rewriteActionsToAuxiliaries(shallowprogram)
        hexlite.rewriter.ProgramRewriter.__init__(self, pcontext, newshallowprogram, plugins, config)

    def __rewriteActionsToAuxiliaries(self, acthexprogram):
        hexprogram = []
        for stm in acthexprogram:
            if __debug__:
                dbgstm = pprint.pformat(stm, width=1000)
                logging.debug('rATA stm='+dbgstm)

# Path: hexlite/ast/shallowparser.py
# def message(s):
# def t_newline(t):
# def t_COMMENT(t):
# def t_error(t):
# def p_content_1(p):
# def p_content_2(p):
# def p_statement(p):
# def p_rule(p):
# def p_disjlist(p):
# def p_semicollist_1(p):
# def p_semicollist_2(p):
# def p_expandlist(p):
# def p_collist_1(p):
# def p_collist_2(p):
# def p_conjlist(p):
# def p_commalist_1(p):
# def p_commalist_2(p):
# def p_commalist_3(p):
# def p_elist_1(p):
# def p_elist_2(p):
# def p_eterm_1(p):
# def p_eterm_2(p):
# def p_eterm_3(p):
# def p_eterm_4(p):
# def p_error(p):
# def parseTerm(content):
# def parse(content):
# def testparse():
# def shallowprint(x,sepspace=' ', listspace=' ',unaryTupleFinalComma=False):
# def testprint():
# def main():
#   DEBUG=False
#   TESTSDIR='../tests/'
#   TESTSDIR='../tests/'


# Path: acthex/rewriter.py
import hexlite.rewriter
import hexlite.auxiliary as aux
import logging, pprint
from hexlite.ast import shallowparser as shp



class ProgramRewriter(hexlite.rewriter.ProgramRewriter):
    def __init__(self, pcontext, shallowprogram, plugins, config):
        # rewrite shallowprogram:
        # * heads that are actions become auxiliary atoms AUXACTION(actionname,c(arguments),prio,cbp)
        # then init original rewriter
        newshallowprogram = self.__rewriteActionsToAuxiliaries(shallowprogram)
        hexlite.rewriter.ProgramRewriter.__init__(self, pcontext, newshallowprogram, plugins, config)

    def __rewriteActionsToAuxiliaries(self, acthexprogram):
        hexprogram = []
        for stm in acthexprogram:
            if __debug__:
                dbgstm = pprint.pformat(stm, width=1000)
                logging.debug('rATA stm='+dbgstm)

            assert(isinstance(stm,shp.alist))