Esempio n. 1
0
                public SyntaxTreeAutomataContext MountSyntaxTreeContext(ParserAutomata parserAutomata, LexemeSource <TToken> lexemeSource, ParserContext parserContext, Parser <TGrammar, TToken> parser)
                {
                    SyntaxTreeAutomataContext context;

                    lock (SyntaxTreeContextPool)
                        context = SyntaxTreeContextPool.Count > 0 ? SyntaxTreeContextPool.Pop() : new SyntaxTreeAutomataContext(this, parserAutomata);

                    context.Mount(lexemeSource, parserContext, parser);

                    return(context);
                }
Esempio n. 2
0
                public VisitorAutomataContext MountVisitorContext(Visitor visitor, ParserAutomata parserAutomata, LexemeSource <TToken> lexemeSource, ParserContext parserContext, Parser <TGrammar, TToken> parser)
                {
                    var pool = GetVisitorContextPool(visitor.GetType());

                    VisitorAutomataContext context;

                    lock (pool)
                        context = pool.Count > 0 ? pool.Pop() : new VisitorAutomataContext(visitor, this, parserAutomata);

                    context.Mount(lexemeSource, parserContext, parser);

                    return(context);
                }
Esempio n. 3
0
                public ProcessAutomataContext MountProcessContext(ParserAutomata parserAutomata, LexemeSource <TToken> lexemeSource, ParserContext parserContext, Parser <TGrammar, TToken> parser)
                {
                    ProcessAutomataContext context;

                    lock (ProcessContextPool)
                        context = ProcessContextPool.Count > 0 ? ProcessContextPool.Pop() : new ProcessAutomataContext(this, parserAutomata);

                    context.Mount(lexemeSource, parserContext, parser);

                    return(context);
                }