# Path: progSpec.py
# def cdlog(lvl, mesg):
#     global MaxLogLevelToShow
#     global lastLogMesgs
#     global highestLvl
#     highestLvl=lvl
#     resizeLogArray(lvl)
#     lastLogMesgs[lvl]=mesg
#     for i in range(highestLvl+1, len(lastLogMesgs)):
#         lastLogMesgs[i]=''
#     if(lvl<=MaxLogLevelToShow):
#         if(lvl==0): print('')
#         printAtLvl(lvl, mesg, '|    ')
# 
# def cdErr(mesg):
#     global lastLogMesgs
#     global highestLvl
#     highestLvl+=1
#     lastLogMesgs[highestLvl]="\n\nError: "+mesg
#     exit(1)
# 
# def logLvl():
#     return highestLvl+1


import re
import progSpec
from progSpec import cdlog, cdErr, logLvl
from pyparsing import *
        exit(1)
    return thisActionItem

def extractActSeq(funcName, childActSeq):
    actionList = childActSeq.actionList
    actSeq = []
    for actionItem in actionList:
        thisActionItem = extractActItem(funcName, actionItem)
        actSeq.append(thisActionItem)
    return actSeq

def extractFuncBody(funcName, funcBodyIn):
    '''Extract body of funcName (str) from funcBodyIn (parseResults)

    Returns two values: funcBodyOut for CodeDog defined body & funcTextVerbatim for verbatim text.
    If body is verbatim: funcBodyOut is an empty string, funcTextVerbatim is a string
    If body is CodeDog: funcBodyOut is a list of stuff, funcTextVerbatim is an empty string
    '''
    if funcBodyIn.rValueVerbatim:
        funcBodyOut = ""
        funcTextVerbatim = funcBodyIn.rValueVerbatim[1] # opening and closing verbatim symbols are indices 0 and 2
    elif funcBodyIn.actionSeq:
        funcBodyOut = extractActSeq(funcName, funcBodyIn.actionSeq)
        funcTextVerbatim = ""
    else:
        cdErr("problem in extractFuncBody: funcBodyIn has no rValueVerbatim or actionSeq")
        exit(1)
    return funcBodyOut, funcTextVerbatim

def extractFieldDefs(ProgSpec, className, stateType, fieldResults):

# Path: progSpec.py
# def cdlog(lvl, mesg):
#     global MaxLogLevelToShow
#     global lastLogMesgs
#     global highestLvl
#     highestLvl=lvl
#     resizeLogArray(lvl)
#     lastLogMesgs[lvl]=mesg
#     for i in range(highestLvl+1, len(lastLogMesgs)):
#         lastLogMesgs[i]=''
#     if(lvl<=MaxLogLevelToShow):
#         if(lvl==0): print('')
#         printAtLvl(lvl, mesg, '|    ')
# 
# def cdErr(mesg):
#     global lastLogMesgs
#     global highestLvl
#     highestLvl+=1
#     lastLogMesgs[highestLvl]="\n\nError: "+mesg
#     exit(1)
# 
# def logLvl():
#     return highestLvl+1


# Path: codeDogParser.py
import re
import progSpec
from progSpec import cdlog, cdErr, logLvl
from pyparsing import *

        exit(1)
    return thisActionItem

def extractActSeq(funcName, childActSeq):
    actionList = childActSeq.actionList
    actSeq = []
    for actionItem in actionList:
        thisActionItem = extractActItem(funcName, actionItem)
        actSeq.append(thisActionItem)
    return actSeq

def extractFuncBody(funcName, funcBodyIn):
    '''Extract body of funcName (str) from funcBodyIn (parseResults)

    Returns two values: funcBodyOut for CodeDog defined body & funcTextVerbatim for verbatim text.
    If body is verbatim: funcBodyOut is an empty string, funcTextVerbatim is a string
    If body is CodeDog: funcBodyOut is a list of stuff, funcTextVerbatim is an empty string
    '''
    if funcBodyIn.rValueVerbatim:
        funcBodyOut = ""
        funcTextVerbatim = funcBodyIn.rValueVerbatim[1] # opening and closing verbatim symbols are indices 0 and 2
    elif funcBodyIn.actionSeq:
        funcBodyOut = extractActSeq(funcName, funcBodyIn.actionSeq)
        funcTextVerbatim = ""
    else:
        cdErr("problem in extractFuncBody: funcBodyIn has no rValueVerbatim or actionSeq")
        exit(1)
    return funcBodyOut, funcTextVerbatim

def extractFieldDefs(ProgSpec, className, stateType, fieldResults):

    cdlog(logLvl(), "EXTRACTING {}".format(className))