diff --git a/twander.py b/twander.py index f8c8016..be319c9 100755 --- a/twander.py +++ b/twander.py @@ -4,7 +4,7 @@ # For Updates See: http://www.tundraware.com/Software/twander PROGNAME = "twander" -RCSID = "$Id: twander.py,v 1.99 2002/12/12 16:49:44 tundra Exp $" +RCSID = "$Id: twander.py,v 1.100 2002/12/12 17:52:55 tundra Exp $" VERSION = RCSID.split()[2] @@ -419,6 +419,14 @@ fields = line.split() + # Make a copy of the fields guaranteed to have + # at least two fields for use in the variable + # declaration tests. + + dummy = fields[:] + dummy.append("") + + ##### # Blank Lines - Ignore ##### @@ -430,7 +438,25 @@ # Variable Definitions ##### - elif line.find(ASSIGN) > 0: + # A valid variable definition can + # be 1, 2, or 3 fields: + # + # x=y - 1 field + # x= y - 2 fields + # x =y + # x = y - 3 fields + # + # But this is not legit: + # + # =....... + # + # However, the assignment character + # must always been in the 1st or second + # field. If it is a 3rd field, it is not + # a variable definition, but a command definition. + # + + elif ((dummy[0].count(ASSIGN) > 0) or (dummy[1].count(ASSIGN) > 0)) and (line[0] != ASSIGN): assign = line.find(ASSIGN) name = line[:assign].strip() val=line[assign+1:].strip()