comparison ide/compiler/parser.py @ 6:1784af239df4

Added error list
author windel
date Fri, 07 Oct 2011 11:20:06 +0200
parents 818f80afa78b
children 2db4d2b362e6
comparison
equal deleted inserted replaced
5:818f80afa78b 6:1784af239df4
358 procedures.append(p) 358 procedures.append(p)
359 self.Consume(';') 359 self.Consume(';')
360 return procedures 360 return procedures
361 361
362 def parseProcedureDeclaration(self): 362 def parseProcedureDeclaration(self):
363 loc = self.getLocation()
363 self.Consume('procedure') 364 self.Consume('procedure')
364 i = self.parseIdentDef() 365 i = self.parseIdentDef()
365 procname = i.name 366 procname = i.name
366 proctyp = self.parseFormalParameters() 367 proctyp = self.parseFormalParameters()
367 procsymtable = SymbolTable(parent = self.cst) 368 procsymtable = SymbolTable(parent = self.cst)
403 endname = self.Consume('ID') 404 endname = self.Consume('ID')
404 if endname != procname: 405 if endname != procname:
405 self.Error('endname should match {0}'.format(name)) 406 self.Error('endname should match {0}'.format(name))
406 self.cst = procsymtable.parent # Switch back to parent symbol table 407 self.cst = procsymtable.parent # Switch back to parent symbol table
407 proc = Procedure(procname, proctyp, block, procsymtable, returnexpression) 408 proc = Procedure(procname, proctyp, block, procsymtable, returnexpression)
409 self.setLocation(proc, loc)
408 self.cst.addSymbol(proc) 410 self.cst.addSymbol(proc)
409 proc.public = i.ispublic 411 proc.public = i.ispublic
410 return proc 412 return proc
411 413
412 # Statements: 414 # Statements: