diff --git a/tconfpy.py b/tconfpy.py index 591cbd5..ea93ca4 100755 --- a/tconfpy.py +++ b/tconfpy.py @@ -6,7 +6,7 @@ # Program Information PROGNAME = "tconfpy" -RCSID = "$Id: tconfpy.py,v 1.172 2004/04/14 21:23:35 tundra Exp $" +RCSID = "$Id: tconfpy.py,v 1.173 2004/04/14 22:18:39 tundra Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -119,10 +119,6 @@ } -# Symbols Illegal As First Character Of Variable/Namespace Name - -IllegalStart = (ENVIRO) - # Symbols Illegal Anywhere In A Variable/Namespace Name IllegalChars = (DELIML, DELIMR, COMMENT) @@ -322,7 +318,6 @@ 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["eVALSMALL"] = FILENUM + "%s Is Smaller Than The Minimum Allowed, %s, For Variable '%s'" -Messages["eVARILLEGAL"] = FILENUM + "'%s' Is An Illegal Variable Name Here. Begins With '%s' Symbol" Messages["eVARNEW"] = FILENUM + "New Variable Creation Not Permitted" Messages["eVARREADONLY"] = FILENUM + "Variable '%s' Is Read-Only. Cannot Change Its Value" Messages["eVARREFNEST"] = FILENUM + "Nested Variable References Are Not Permitted" @@ -605,7 +600,7 @@ # Make sure symbol name is properly formed - ref_ok = ValidateSymbolName(sym, cfgfile, linenum) + ref_ok = ValidateSymbolName(sym, cfgfile, linenum, AllowEnviro=True) # If Preliminary tests found errors - quit now @@ -1142,8 +1137,7 @@ ErrorMsg("eNAMESPACENEW", (cfgfile, linenum, SymTable[NAMESPACE].Value)) update = False - # Make sure the new namespace does not start with - # an illegal character. + # Make sure the new namespace is properly formed elif not ValidateSymbolName(r, cfgfile, linenum, AllowEmpty=True): update = False # Validation function issues relevant error messages @@ -1174,12 +1168,9 @@ ns = SymTable[NAMESPACE].Value # Top level namespace variables don't need - # separator Also, make sure the variable name does - # not begin with an illegal character. If it - # does, do nothing, and we'll catch the error - # below. + # separator. - if ns and l[0] not in IllegalStart: + if ns: l = "%s%s%s" % (ns, NSSEP, l) d = VarDescriptor() @@ -1190,14 +1181,8 @@ if l not in SymTable: - # Make sure the variable name does not begin with - # an illegal character. - - if l[0] in IllegalStart: - ErrorMsg("eVARILLEGAL", (cfgfile, linenum, l, l[0])) - # Only do this if new variable creation allowed - elif ALLOWNEWVAR: + if ALLOWNEWVAR: d.Default = r d.Value = r SymTable[l] = d @@ -1341,7 +1326,7 @@ # Ensure Symbol Name Is Properly Formed ##### -def ValidateSymbolName(sym, cfgfile, linenum, AllowEmpty=False): +def ValidateSymbolName(sym, cfgfile, linenum, AllowEmpty=False, AllowEnviro=False): sym_ok = True @@ -1359,9 +1344,9 @@ sym_ok = False - # Check for illegal starting symbol + # Check for illegal ENVIRO introducer - if sym and sym[0] in IllegalStart: + if not AllowEnviro and sym and sym[0] == ENVIRO: ErrorMsg("eSYMBADSTART", (cfgfile, linenum, sym)) sym_ok = False