comparison python/c3/parser.py @ 167:0b5b2ee6b435

Added 2 unit tests
author Windel Bouwman
date Fri, 22 Mar 2013 17:40:13 +0100
parents da0087b82fbe
children ee0d30533dae
comparison
equal deleted inserted replaced
166:da0087b82fbe 167:0b5b2ee6b435
137 loc = self.Consume('=').loc 137 loc = self.Consume('=').loc
138 rval = self.parseExpression() 138 rval = self.parseExpression()
139 self.Consume(';') 139 self.Consume(';')
140 return self.sema.actOnAssignment(lval, rval, loc) 140 return self.sema.actOnAssignment(lval, rval, loc)
141 141
142 def parseProcedureCall(self, procedure): 142 def parseProcedureCall(self, func):
143 self.Consume('(') 143 self.Consume('(')
144 args = [] 144 args = []
145 if not self.hasConsumed(')'): 145 if not self.hasConsumed(')'):
146 args.append(self.parseExpression()) 146 args.append(self.parseExpression())
147 while self.hasConsumed(','): 147 while self.hasConsumed(','):
148 args.append(self.parseExpression()) 148 args.append(self.parseExpression())
149 self.Consume(')') 149 self.Consume(')')
150 return astnodes.ProcedureCall(procedure, args) 150 return self.sema.actOnFunctionCall(func, args, func.loc)
151 151
152 def parseIfStatement(self): 152 def parseIfStatement(self):
153 loc = self.Consume('if').loc 153 loc = self.Consume('if').loc
154 self.Consume('(') 154 self.Consume('(')
155 condition = self.parseExpression() 155 condition = self.parseExpression()