| |
---|
| | |
---|
| | # Program Information |
---|
| | |
---|
| | PROGNAME = "tconfpy" |
---|
| | RCSID = "$Id: tconfpy.py,v 1.106 2004/03/12 08:32:35 tundra Exp $" |
---|
| | RCSID = "$Id: tconfpy.py,v 1.107 2004/03/12 09:10:02 tundra Exp $" |
---|
| | VERSION = RCSID.split()[2] |
---|
| | |
---|
| | # Copyright Information |
---|
| | |
---|
| |
---|
| | ########### |
---|
| | # Constants |
---|
| | ########### |
---|
| | |
---|
| | # General Constants |
---|
| | |
---|
| | MSGPOS = 10 # Where to start message output |
---|
| | |
---|
| | # Formatting Constants |
---|
| | |
---|
| | MSGPOS = 10 # Where to start message output |
---|
| | FILENUM = "[File: %s Line: %s]" # Display filename and linenum |
---|
| | PTR = " ---> " # Textual pointer for debug output |
---|
| | |
---|
| | # Reserved Symbols |
---|
| | |
---|
| | COMMENT = '#' # Comment introducer character |
---|
| |
---|
| | # Debug Messages |
---|
| | ########## |
---|
| | |
---|
| | dDEBUG = "DEBUG" |
---|
| | dLINEIGNORE = "%s Line %d Ignored/Not Included" |
---|
| | dNUMLINES = "Processing '%s' Resulted In %d Total Lines Parsed" |
---|
| | dPARSEDLINE = "%s Line %d Parses To: %s" |
---|
| | dLINEIGNORE = FILENUM + " Line Ignored/Not Included" + PTR + "%s\n" |
---|
| | dNUMLINES = "Processing File '%s' Resulted In %d Total Lines Parsed" |
---|
| | dPARSEDLINE = FILENUM + " %s" + PTR + "%s\n" |
---|
| | |
---|
| | ########### |
---|
| | # Error Messages |
---|
| | ########### |
---|
| | |
---|
| | eCONFOPEN = "Cannot Open The File '%s'" |
---|
| | eENDIFEXTRA = "%s Line %d: " + ENDIF + " Without Matching Condition" |
---|
| | eENDIFEXTRA = FILENUM + " " + ENDIF + " Without Matching Condition" |
---|
| | eERROR = "ERROR" |
---|
| | |
---|
| | |
---|
| | ########### |
---|
| |
---|
| | ########### |
---|
| | # Warning Messages |
---|
| | ########### |
---|
| | |
---|
| | wENDIFBAD = "%s Line %d: Text After " + ENDIF + " Ignored" |
---|
| | wENDIFBAD = FILENUM + " Text After " + ENDIF + " Ignored" |
---|
| | wWARNING = "WARNING" |
---|
| | |
---|
| | |
---|
| | #--------------------------- Code Begins Here ---------------------------------# |
---|
| |
---|
| | |
---|
| | def mkmsg(msg, msgtype=""): |
---|
| | |
---|
| | if msgtype: |
---|
| | msgtype += ":" |
---|
| | msgtype += ">" |
---|
| | |
---|
| | pad = " " * (MSGPOS - len(msgtype)) |
---|
| | |
---|
| | return "%s - %s%s%s" % (PROGINFO, msgtype, pad, msg) |
---|
| | return "%s %s%s%s" % (PROGINFO, msgtype, pad, msg) |
---|
| | |
---|
| | |
---|
| | # End of 'mkmsg()' |
---|
| | |
---|
| | |
---|
| |
---|
| | def ParseLine(line, cfgfile, linenum): |
---|
| | |
---|
| | global CondStack, MsgList, SymTable |
---|
| | |
---|
| | orig = line |
---|
| | line = ConditionLine(line) |
---|
| | |
---|
| | ########## |
---|
| | # Beginning Of Line Parser |
---|
| |
---|
| | |
---|
| | # If we are in a False conditional block, this line |
---|
| | # is ignored. |
---|
| | |
---|
| | print linenum, CondStack, line |
---|
| | if not CondStack[-1]: |
---|
| | if DEBUG: |
---|
| | DebugMsg(dLINEIGNORE %(cfgfile, linenum)) |
---|
| | DebugMsg(dLINEIGNORE %(cfgfile, linenum, orig)) |
---|
| | return |
---|
| | |
---|
| | # Process .include statements |
---|
| | |
---|
| |
---|
| | # End Of Line Parser |
---|
| | ########## |
---|
| | |
---|
| | if DEBUG: |
---|
| | DebugMsg(dPARSEDLINE %(cfgfile, linenum, line)) |
---|
| | DebugMsg(dPARSEDLINE %(cfgfile, linenum, orig, line)) |
---|
| | |
---|
| | # End of 'ParseLine' |
---|
| | |
---|
| | |