diff --git a/tconfpy.py b/tconfpy.py index ed53738..46b0762 100755 --- a/tconfpy.py +++ b/tconfpy.py @@ -6,7 +6,7 @@ # Program Information PROGNAME = "tconfpy" -RCSID = "$Id: tconfpy.py,v 1.184 2004/04/27 23:53:35 tundra Exp $" +RCSID = "$Id: tconfpy.py,v 1.185 2004/05/02 08:06:07 tundra Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -738,17 +738,15 @@ ##### # LITERAL and ENDLITERAL Processing + # # These get highest precedence because they block everything else. - # However, they are ignored within False conditional blocks. + # We keep track of them even in False conditional blocks. This is + # so that the text within a literal block does not cause the the + # parser to throw a syntax error. ##### if line.strip() in (LITERAL, ENDLITERAL): - if not CondStack[-1][1]: - if DEBUG: - DebugMsg("dLINEIGNORE", (cfgfile, linenum, orig, dNOTINCLUDE)) - return - if line.strip() == LITERAL: if INLITERAL: WarningMsg("wLITEXTRA", (cfgfile, linenum)) @@ -768,22 +766,42 @@ return - # We pass lines as-is, with optional variable replacement, in literal blocks + + ##### + # Process Content Of Literal Blocks + # + # We pass lines as-is, with optional variable replacement in + # literal blocks. But, only if we're inside a True conditional + # block. + ##### if INLITERAL: - if LITERALVARS: - line, ref_ok = DerefVar(line, cfgfile, linenum) + if CondStack[-1][1]: - LiteralLines.append(line) + if LITERALVARS: + line, ref_ok = DerefVar(line, cfgfile, linenum) - if DEBUG: - DebugMsg("dPARSEDLINE", (cfgfile, linenum, orig, line)) + LiteralLines.append(line) + + if DEBUG: + DebugMsg("dPARSEDLINE", (cfgfile, linenum, orig, line)) + + + # Conditional block was false, so just throw away the line, + # noting in debug output if requested. + + else: + if DEBUG: + DebugMsg("dLINEIGNORE", (cfgfile, linenum, orig, dNOTINCLUDE)) return - + ##### + # Process All Other Cases + ##### + line = ConditionLine(line) # Strip out comments and leading/trailing whitespace condstate = True # Results of conditional tests kept here