Corrected special character formatting.

This commit is contained in:
Maggie Mari 2012-08-14 18:28:17 -05:00
commit 538fd76b1f
6 changed files with 92 additions and 92 deletions

View file

@ -615,7 +615,7 @@ var/in, it looks like this:
# Expression class for var/in. class
VarExpressionNode(ExpressionNode):
def **init**\ (self, variables, body): self.variables = variables
def __init__(self, variables, body): self.variables = variables
self.body = body
def CodeGen(self): ...
@ -861,15 +861,15 @@ mutable variables and var/in support:
BinaryToken(object): pass class UnaryToken(object): pass class
VarToken(object): pass
class IdentifierToken(object): def **init**\ (self, name): self.name =
class IdentifierToken(object): def __init__(self, name): self.name =
name
class NumberToken(object): def **init**\ (self, value): self.value =
class NumberToken(object): def __init__(self, value): self.value =
value
class CharacterToken(object): def **init**\ (self, char): self.char =
char def **eq**\ (self, other): return isinstance(other, CharacterToken)
and self.char == other.char def **ne**\ (self, other): return not self
class CharacterToken(object): def __init__(self, char): self.char =
char def __eq__(self, other): return isinstance(other, CharacterToken)
and self.char == other.char def __ne__(self, other): return not self
== other
# Regular expressions that tokens and comments of our language.
@ -936,14 +936,14 @@ mutable variables and var/in support:
# Expression class for numeric literals like "1.0".
class NumberExpressionNode(ExpressionNode):
def **init**\ (self, value): self.value = value
def __init__(self, value): self.value = value
def CodeGen(self): return Constant.real(Type.double(), self.value)
# Expression class for referencing a variable, like "a".
class VariableExpressionNode(ExpressionNode):
def **init**\ (self, name): self.name = name
def __init__(self, name): self.name = name
def CodeGen(self): if self.name in g_named_values: return
g_llvm_builder.load(g_named_values[self.name], self.name) else:
@ -952,7 +952,7 @@ mutable variables and var/in support:
# Expression class for a binary operator.
class BinaryOperatorExpressionNode(ExpressionNode):
def **init**\ (self, operator, left, right): self.operator = operator
def __init__(self, operator, left, right): self.operator = operator
self.left = left self.right = right
def CodeGen(self): # A special case for '=' because we don't want to
@ -994,7 +994,7 @@ mutable variables and var/in support:
# Expression class for function calls.
class CallExpressionNode(ExpressionNode):
def **init**\ (self, callee, args): self.callee = callee self.args =
def __init__(self, callee, args): self.callee = callee self.args =
args
def CodeGen(self): # Look up the name in the global module table. callee
@ -1013,7 +1013,7 @@ mutable variables and var/in support:
# Expression class for if/then/else.
class IfExpressionNode(ExpressionNode):
def **init**\ (self, condition, then_branch, else_branch):
def __init__(self, condition, then_branch, else_branch):
self.condition = condition self.then_branch = then_branch
self.else_branch = else_branch
@ -1064,7 +1064,7 @@ mutable variables and var/in support:
# Expression class for for/in.
class ForExpressionNode(ExpressionNode):
def **init**\ (self, loop_variable, start, end, step, body):
def __init__(self, loop_variable, start, end, step, body):
self.loop_variable = loop_variable self.start = start self.end = end
self.step = step self.body = body
@ -1146,7 +1146,7 @@ mutable variables and var/in support:
# Expression class for a unary operator.
class UnaryExpressionNode(ExpressionNode):
def **init**\ (self, operator, operand): self.operator = operator
def __init__(self, operator, operand): self.operator = operator
self.operand = operand
def CodeGen(self): operand = self.operand.CodeGen() function =
@ -1156,7 +1156,7 @@ mutable variables and var/in support:
# Expression class for var/in.
class VarExpressionNode(ExpressionNode):
def **init**\ (self, variables, body): self.variables = variables
def __init__(self, variables, body): self.variables = variables
self.body = body
def CodeGen(self): old_bindings = {} function =
@ -1204,7 +1204,7 @@ mutable variables and var/in support:
# takes), as well as if it is an operator.
class PrototypeNode(object):
def **init**\ (self, name, args, is_operator=False, precedence=0):
def __init__(self, name, args, is_operator=False, precedence=0):
self.name = name self.args = args self.is_operator = is_operator
self.precedence = precedence
@ -1251,7 +1251,7 @@ mutable variables and var/in support:
# This class represents a function definition itself.
class FunctionNode(object):
def **init**\ (self, prototype, body): self.prototype = prototype
def __init__(self, prototype, body): self.prototype = prototype
self.body = body
def CodeGen(self): # Clear scope. g_named_values.clear()
@ -1297,7 +1297,7 @@ mutable variables and var/in support:
class Parser(object):
def **init**\ (self, tokens): self.tokens = tokens self.Next()
def __init__(self, tokens): self.tokens = tokens self.Next()
# Provide a simple token buffer. Parser.current is the current token the
# parser is looking at. Parser.Next() reads another token from the lexer
@ -1608,4 +1608,4 @@ mutable variables and var/in support:
# Print out all of the generated code. print '', g_llvm_module
if **name** == '**main**\ ': main()
if **name** == '__main__': main()