THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/12/2012 at 18:16, xxxxxxxx wrote:
I have been programming for a little over two years, and have learned very quickly. I'm now trying to make a language called jade (.jd) and decided to start with macros. the syntax is:
MACRO: command replacement text
so lets say i had break but wanted to make it shorter
MACRO: break brk
the only problem is my code doesn't work right. can someone please explain?
heres my code
def replaceMacros(file) :
while file.readline() :
line = file.readline()
if line[0:6] == "MACRO:":
startCommand = line.find(" ")
endCommand = line.end(" ", startCommand + 1)
command = line[startCommand + 1 : endCommand]
print command
macro = line[endCommand + 1:]
print macro
*Note: I know macros are meant to replace what they stand for, but right now im just trying to make sure its reading in the correct values right. once it is ill have it put in a global (scope wise) dictionary called macroList. where macroList[macro] = command