public void checkFunctions() { Enumeration<Function> en = functions.elements(); while (en.hasMoreElements()) { Function function = (Function) en.nextElement(); if (function.isForward()) { if (!function.isCompleted()) { throw new DinaException( "Неопределенная функция '" + function.getSignature() + "'", DinaException.COMPILATION_ERROR); } } } }
public void addFunction(Function function) { String functionSignature = function.getSignatureLabel(); if (functions.getValue(functionSignature) != null) { throw new DinaException( "Функция '" + function.getSignature().toString() + "' уже существует", DinaException.COMPILATION_ERROR); } if (Function.getNativeFunctionsTable().getValue(functionSignature) != null) { error(function); } InternalFunctionContainer functionContainer = InternalFunctions.getFunctionContainer(function.getName()); if (functionContainer != null) { if (functionContainer.check(function.getArguments())) { error(function); } } functions.put(functionSignature, function); }
private static void error(Function function) { throw new DinaException( "Функция '" + function.getSignature().toString() + "' является системной", DinaException.COMPILATION_ERROR); }