diff --git a/tconfpy.py b/tconfpy.py index 55d2bec..2910ac4 100755 --- a/tconfpy.py +++ b/tconfpy.py @@ -6,7 +6,7 @@ # Program Information PROGNAME = "tconfpy" -RCSID = "$Id: tconfpy.py,v 1.108 2004/03/12 09:22:19 tundra Exp $" +RCSID = "$Id: tconfpy.py,v 1.109 2004/03/12 10:14:02 tundra Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -41,6 +41,7 @@ #----------------------------------------------------------# import os.path +import re #----------------------------------------------------------# @@ -65,12 +66,13 @@ FILENUM = "[File: %s Line: %s]" # Display filename and linenum PTR = " ---> " # Textual pointer for debug output + # Reserved Symbols -COMMENT = '#' # Comment introducer character -DELIML = '[' # Left delimiter for vbl reference -DELIMR = ']' # Right delimiter for vbl reference -DOLLAR = '$' # Used to note enviro vbl +COMMENT = r'#' # Comment introducer character +DELIML = r'[' # Left delimiter for vbl reference +DELIMR = r']' # Right delimiter for vbl reference +DOLLAR = r'$' # Used to note enviro vbl # Control and conditional symbols @@ -83,15 +85,19 @@ # to include this in the right side of a variable definition # via [reserved sym]. -Reserved = {"DELIML" : DELIML, - "DELIMR" : DELIMR, - "DOLLAR" : DOLLAR, - "HASH" : COMMENT, - "INCLUDE" : INCLUDE, - "ENDIF" : ENDIF, - "IF" : IF - } +Reserved = {"DELIML" : DELIML, + "DELIMR" : DELIMR, + "DOLLAR" : DOLLAR, + "HASH" : COMMENT, + "INCLUDE" : INCLUDE, + "ENDIF" : ENDIF, + "IF" : IF + } +# Regular Expressions + +reVARREF = r"\%s.+?\%s" % (DELIML, DELIMR) # Variable reference +VARREF = re.compile(reVARREF) ###########