示例#1
0
 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);
       }
     }
   }
 }
示例#2
0
 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);
 }
示例#3
0
 private static void error(Function function) {
   throw new DinaException(
       "Функция '" + function.getSignature().toString() + "' является системной",
       DinaException.COMPILATION_ERROR);
 }