use of php.runtime.exceptions.support.ErrorType in project jphp by jphp-compiler.
the class LangFunctions method trigger_error.
public static boolean trigger_error(Environment env, TraceInfo trace, String message, int type) {
ErrorType _type = ErrorType.valueOf(type);
if (_type == null)
return false;
env.error(trace, _type, message);
return true;
}
use of php.runtime.exceptions.support.ErrorType in project jphp by jphp-compiler.
the class CoreExtension method onRegister.
@Override
public void onRegister(CompileScope scope) {
registerFunctions(new LangFunctions());
registerConstants(new LangConstants());
registerConstants(new InfoConstants());
registerFunctions(new InfoFunctions());
registerConstants(new MathConstants());
registerFunctions(new MathFunctions());
registerFunctions(new StringFunctions());
registerConstants(new ArrayConstants());
registerFunctions(new ArrayFunctions());
registerConstants(new OutputConstants());
registerFunctions(new OutputFunctions());
// T_ERROR
for (ErrorType el : ErrorType.values()) constants.put(el.name(), new CompileConstant(el.name(), el.value));
registerJavaException(scope, WrapJavaExceptions.IllegalArgumentException.class, IllegalArgumentException.class);
registerJavaException(scope, WrapJavaExceptions.IllegalStateException.class, IllegalStateException.class);
registerJavaException(scope, WrapJavaExceptions.NumberFormatException.class, NumberFormatException.class);
registerJavaException(scope, WrapJavaExceptions.InterruptedException.class, InterruptedException.class);
registerClass(scope, CharUtils.class);
registerClass(scope, StrUtils.class);
registerClass(scope, BinUtils.class);
registerClass(scope, NumUtils.class);
registerClass(scope, ItemsUtils.class);
registerClass(scope, MirrorUtils.class);
registerClass(scope, FsUtils.class);
registerClass(scope, OldBinUtils.class);
registerClass(scope, OldItemsUtils.class);
registerClass(scope, OldNumUtils.class);
registerClass(scope, OldMirrorUtils.class);
registerClass(scope, SharedUtils.SharedMemory.class);
registerClass(scope, SharedUtils.SharedCollection.class);
registerClass(scope, SharedUtils.SharedValue.class);
registerClass(scope, SharedUtils.SharedStack.class);
registerClass(scope, SharedUtils.SharedQueue.class);
registerClass(scope, SharedUtils.SharedMap.class);
registerClass(scope, SharedUtils.class);
registerClass(scope, WrapPackageLoader.class);
registerClass(scope, WrapClassLoader.class);
registerClass(scope, WrapClassLoader.WrapLauncherClassLoader.class);
registerClass(scope, WrapLocale.class);
registerClass(scope, WrapScanner.class);
registerClass(scope, WrapFlow.class);
registerClass(scope, WrapConfiguration.class);
registerClass(scope, WrapRegex.class);
registerJavaExceptionForContext(scope, WrapRegex.RegexException.class, WrapRegex.class);
registerClass(scope, WrapTimeZone.class);
registerClass(scope, WrapTimeFormat.class);
registerClass(scope, WrapTime.class);
registerClass(scope, WrapInvoker.class);
registerClass(scope, WrapModule.class);
registerClass(scope, WrapPackage.class);
registerWrapperClass(scope, SourceMap.class, WrapSourceMap.class);
registerClass(scope, WrapEnvironment.class);
registerClass(scope, WrapEnvironmentVariables.class);
registerClass(scope, WrapThreadGroup.class);
registerClass(scope, WrapThread.class);
registerClass(scope, WrapSystem.class);
registerClass(scope, Reflector.class);
registerClass(scope, Reflection.class);
registerClass(scope, ReflectionException.class);
registerClass(scope, ReflectionExtension.class);
registerClass(scope, ReflectionFunctionAbstract.class);
registerClass(scope, ReflectionFunction.class);
registerClass(scope, ReflectionParameter.class);
registerClass(scope, ReflectionProperty.class);
registerClass(scope, ReflectionMethod.class);
registerClass(scope, ReflectionClass.class);
registerClass(scope, ReflectionObject.class);
registerClass(scope, WrapJavaExceptions.NotImplementedException.class);
// stream
registerJavaException(scope, WrapIOException.class, IOException.class);
registerClass(scope, FileObject.class);
registerClass(scope, Stream.class);
registerClass(scope, FileStream.class);
registerClass(scope, MiscStream.class);
registerClass(scope, MemoryMiscStream.class);
registerClass(scope, ResourceStream.class);
// net
registerClass(scope, WrapSocket.class);
registerClass(scope, WrapServerSocket.class);
registerJavaException(scope, WrapSocketException.class, SocketException.class);
registerClass(scope, WrapThreadPool.class);
registerClass(scope, WrapFuture.class);
registerJavaException(scope, WrapJavaExceptions.TimeoutException.class, TimeoutException.class);
registerClass(scope, WrapProcessor.class);
registerClass(scope, WrapProcessor.ProcessorException.class);
registerClass(scope, WrapProcess.class);
}
Aggregations