Commit 32f10427 authored by Ilya Prokhorov's avatar Ilya Prokhorov

Debug printing and errors fixed

parent 0b6a0f10
......@@ -64,6 +64,8 @@ def transpale(line, className):
parsedArguments.append(argumentsMatch)
methodDeclarations.add(argumentsMatch)
print("parsedArguments:" + str(parsedArguments))
if className == "main":
prefix = "var "
else:
......@@ -74,7 +76,10 @@ def transpale(line, className):
if entityType == "protocol":
postfix = " {}"
return prefix + methodName + " = function("+ ", ".join(parsedArguments) +")" + postfix + "\n"
transpiledString = prefix + methodName + " = function("+ ", ".join(parsedArguments) +")" + postfix + "\n"
print("transpiledString: " + transpiledString)
return transpiledString
classVariableDeclarationMatch = re.match(r'(.*) (declare) ([a-zA-Z]*) .*', line, re.M|re.I)
if classVariableDeclarationMatch != None:
......@@ -116,7 +121,7 @@ def transpale(line, className):
parsedArguments = []
argumentsMatches = re.findall(r' : ([" a-zA-Z]*)', line, re.M|re.I)
argumentsMatches = re.findall(r' : ([" a-zA-Z0-9]*)', line, re.M|re.I)
for argumentsMatch in argumentsMatches:
print(argumentsMatch)
......@@ -128,7 +133,10 @@ def transpale(line, className):
if len(parsedArguments) < 1:
return line
return prefix + "("+ ", ".join(parsedArguments) +");\n"
transpiledString = prefix + "("+ ", ".join(parsedArguments) +");\n"
print("transpiled method call: " + transpiledString)
return transpiledString
formattedLine = line.replace("\t","")
formattedLine = formattedLine.replace("\n", "")
......@@ -175,8 +183,8 @@ def addScopeToDeclarations(line):
return line
elif variableCall not in methodDeclarations:
print("error for line: " + line + "; no declaration '" + variableCall + "' in class or method")
exit(1)
print("warning for line: " + line + "; no declaration '" + variableCall + "' in class or method")
#exit(1)
variableCallMatch = re.match(r'\t*([a-zA-Z]*)\[', line, re.M|re.I)
if variableCallMatch != None:
......@@ -315,7 +323,7 @@ def addScopeToDeclarations(line):
return line
for root, dirs, files in os.walk(sourceDirectory):
for root, dirs, files in os.walk(sourceDirectory, followlinks=True):
for file in files:
if file.endswith(".rise"):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment