Added Variable Reference regular expression and matching object.
1 parent eb1215a commit 34929ff3e849830e3ec3ffc1eb9044b47e0197e0
@tundra tundra authored on 12 Mar 2004
Showing 1 changed file
View
38
tconfpy.py
 
# 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
 
# Imports #
#----------------------------------------------------------#
 
import os.path
import re
 
 
#----------------------------------------------------------#
# Aliases & Redefinitions #
MSGPOS = 10 # Where to start message output
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
 
# Table of reserved symbols used by parser. User is able
# 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)
 
 
###########
# Literals