final public CreateFunctionStatement FunctionSpecification() throws ParseException, ParseException { FunctionSignature signature; boolean ifNotExists = false; List<VarIdentifier> paramList = new ArrayList<VarIdentifier>(); String functionBody; VarIdentifier var = null; Expression functionBodyExpr; Token beginPos; Token endPos; FunctionName fctName = null; createNewScope(); jj_consume_token(FUNCTION); fctName = FunctionName(); ifNotExists = IfNotExists(); paramList = ParameterList(); jj_consume_token(LEFTBRACE); beginPos = token; functionBodyExpr = Expression(); jj_consume_token(RIGHTBRACE); endPos = token; functionBody = extractFragment(beginPos.beginLine, beginPos.beginColumn, endPos.beginLine, endPos.beginColumn); // TODO use fctName.library signature = new FunctionSignature(fctName.dataverse, fctName.function, paramList.size()); getCurrentScope().addFunctionDescriptor(signature, false); removeCurrentScope(); {if (true) return new CreateFunctionStatement(signature, paramList, functionBody, functionBodyExpr, ifNotExists);} throw new Error("Missing return statement in function"); }
final public CreateFunctionStatement FunctionSpecification() throws ParseException, ParseException { FunctionSignature signature; boolean ifNotExists = false; List<VarIdentifier> paramList = new ArrayList<VarIdentifier>(); String functionBody; VarIdentifier var = null; Expression functionBodyExpr; Token beginPos; Token endPos; FunctionName fctName = null; createNewScope(); jj_consume_token(FUNCTION); fctName = FunctionName(); ifNotExists = IfNotExists(); paramList = ParameterList(); jj_consume_token(LEFTBRACE); beginPos = token; functionBodyExpr = Expression(); jj_consume_token(RIGHTBRACE); endPos = token; functionBody = extractFragment(beginPos.beginLine, beginPos.beginColumn, endPos.beginLine, endPos.beginColumn); // TODO use fctName.library signature = new FunctionSignature(fctName.dataverse, fctName.function, paramList.size()); getCurrentScope().addFunctionDescriptor(signature, false); removeCurrentScope(); {if (true) return new CreateFunctionStatement(signature, paramList, functionBody, functionBodyExpr, ifNotExists);} throw new Error("Missing return statement in function"); }
removeCurrentScope(); defaultDataverse = currentDataverse; CreateFunctionStatement stmt = new CreateFunctionStatement(signature, paramList, functionBody, functionBodyExpr, ifNotExists); {if (true) return addSourceLocation(stmt, startStmtToken);} throw new Error("Missing return statement in function");