diff --git a/tconfpy.py b/tconfpy.py index b43ce9c..c7e6ae8 100755 --- a/tconfpy.py +++ b/tconfpy.py @@ -6,7 +6,7 @@ # Program Information PROGNAME = "tconfpy" -RCSID = "$Id: tconfpy.py,v 1.148 2004/03/27 00:56:25 tundra Exp $" +RCSID = "$Id: tconfpy.py,v 1.149 2004/03/27 01:24:34 tundra Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -132,7 +132,7 @@ LiteralLines = [] # Place to store and return unprocessed lines -CondStack = [True,] # Conditional stack +CondStack = [["", True,]] # Conditional stack TotalLines = 0 # Total number of lines parsed @@ -254,7 +254,7 @@ Messages["eTYPEBAD"] = FILENUM + "Type Mismatch. '%s' Must Be Assigned Values Of Type %s Only" Messages["eVALLARGE"] = FILENUM + "%s Is Larger Than The Maximum Allowed, %s, For Variable '%s'" Messages["eVARNAMESPC"] = FILENUM + "Variable Names May Not Contain Whitespace" -Messages["eVARNONAME"] = FILENUM + "Variable Name Evaluates To Null String. Not Permitted" +Messages["eVARNONAME"] = FILENUM + "Variable Name Evaluates To Null String. Not Permitted" Messages["eVALSMALL"] = FILENUM + "%s Is Smaller Than The Minimum Allowed, %s, For Variable '%s'" Messages["eVARREADONLY"] = FILENUM + "Variable '%s' Is Read-Only. Cannot Change Its Value" Messages["eVARUNDEF"] = FILENUM + "Attempt To Reference Undefined Variable '%s'" @@ -375,7 +375,7 @@ WarnMsgs = [] LiteralLines = [] - CondStack = [True,] # Always has one entry as a sentinel + CondStack = [["", True],] # Always has one entry as a sentinel TotalLines = 0 # Add any passed symbols to the SymbolTable @@ -599,7 +599,7 @@ if line.strip() in (LITERAL, ENDLITERAL): - if not CondStack[-1]: + if not CondStack[-1][1]: if DEBUG: DebugMsg("dLINEIGNORE", (cfgfile, linenum, orig, dNOTINCLUDE)) return @@ -670,7 +670,7 @@ # Error, if there are more .endifs than conditionals if not CondStack: ErrorMsg("eENDIFEXTRA", (cfgfile, linenum)) - CondStack.append(False) # Restore sentinel & inhibit further parsing + CondStack.append(["", False]) # Restore sentinel & inhibit further parsing if DEBUG: DebugMsg("dPARSEDLINE", (cfgfile, linenum, orig, line)) @@ -686,7 +686,7 @@ line[0] == DELIML and line[-1] == DELIMR and\ line.count(DELIML) == line.count(DELIMR) == 1): - if not CondStack[-1]: + if not CondStack[-1][1]: if DEBUG: DebugMsg("dLINEIGNORE", (cfgfile, linenum, orig, dNOTINCLUDE)) return @@ -713,7 +713,7 @@ elif FIRSTTOK == INCLUDE: - if not CondStack[-1]: + if not CondStack[-1][1]: if DEBUG: DebugMsg("dLINEIGNORE", (cfgfile, linenum, orig, dNOTINCLUDE)) return @@ -866,8 +866,8 @@ # Set parser state based on a successful conditional test # But it has to be ANDed with the state of the enclosing block - enclosing = CondStack[-1] - CondStack.append(condstate and enclosing) + enclosing = CondStack[-1][1] + CondStack.append([IF, condstate and enclosing]) # Now reflect this in the parsed line line = sTRUE @@ -890,7 +890,7 @@ elif EQUAL in line: - if not CondStack[-1]: + if not CondStack[-1][1]: if DEBUG: DebugMsg("dLINEIGNORE", (cfgfile, linenum, orig, dNOTINCLUDE)) return @@ -1022,7 +1022,8 @@ # value is one of the ones enumerated in LegalVals. # # For strings, LegalVals is presumed to contain a list - # of regular expressions. The test is to compile each + # of regular expressions. The test is to compile + each # regex and see if any match the new value. if update and lv: