Exemple #1
0
        public static IProcess Interpret(string text)
        {
            unsafe
            {
                fixed(char *pText = text)
                {
                    var value = ReaderCaches.LockGetOrAdd(text, (text2) => {
                        fixed(char *pText2 = text2)
                        {
                            return(new CodeReader(pText2, 0, text2.Length));
                        }
                    });

                    var reader = new CodeReader(pText, 0, text.Length, value);

                    UnionProcess unionProcess = new UnionProcess();

                    while (CodeInterpreter.TryInterpret(reader, Priorities.None, out var process))
                    {
                        while (reader.SkipEnd())
                        {
                        }

                        unionProcess.AddProcess(process);

                        if (!reader.SkipBlank())
                        {
                            return(unionProcess);
                        }
                    }

                    throw new Exception("Uninterpreted code.");
                }
            }
        }
Exemple #2
0
        public static DbProviderFactory GetFactory(string providerName)
        {
            if (providerName == null)
            {
                throw new ArgumentNullException(nameof(providerName));
            }

            if (ProviderTypesCache.TryGetValue(providerName, out var value))
            {
                return(value);
            }

            return(ProviderTypesCache.LockGetOrAdd(providerName, name => SearchFactory(name)));
        }