*/
private Function parseFunction() throws ESException
{
function.setNeedsScope();
ESId id = null;
if (lexer.peek() == Lexer.IDENTIFIER) {
lexer.next();
id = lexer.getId();
}
if (lexer.next() != '(')
throw expect("`('");
if (id != null) {
function.addVariable(block, id, null);
block.newVar(id).getVar().setType(Expr.TYPE_ES);
}
Block oldBlock = block;
Function oldFun = function;
function = parseClass.newFunction(oldFun, id, false);
oldFun.addFunction(function);
block = Block.create(this, function);
boolean isFirst = true;
while (lexer.peek() != ')') {
if (! isFirst && lexer.next() != ',')
throw expect("`,'");
isFirst = false;
if (lexer.next() != Lexer.IDENTIFIER)
throw expect(L.l("formal argument"));
ESId argId = lexer.getId();
Expr type = null;
if (lexer.peek() == ':') {
lexer.next();
type = parseType();