Exemple #1
0
        public ParseTree ParseUsingCompiler(Lexer lexer, ParserState state)
        {
            StateForCompiler stateForCompiler = new StateForCompiler();

            stateForCompiler.BuildTextNodes     = state.BuildTextNodes;
            stateForCompiler.RecursionBehaviour = state.RecursionBehaviour;
            stateForCompiler.LeftRecursiveAlts  = state.LeftRecursiveAlts;
            stateForCompiler.Whitespace         = lexer.WhitespacePattern;

            PatternTrampoline trampoline = GetTrampoline(state.RuntimeState.Runtime, stateForCompiler);

            return(trampoline.Implementation(lexer, state));
        }
Exemple #2
0
 public PatternTrampoline GetTrampoline(Runtime runtime, StateForCompiler state)
 {
     PatternTrampoline trampoline;
     
     if (!trampolineMap.TryGetValue(state, out trampoline))
     {
         state = state.Copy();
         
         trampoline = new PatternTrampoline(this, runtime, state);
         trampolines.Add(trampoline);
         trampolineMap[state] = trampoline;
     }
     
     return trampoline;
 }
Exemple #3
0
        public PatternTrampoline GetTrampoline(Runtime runtime, StateForCompiler state)
        {
            PatternTrampoline trampoline;

            if (!trampolineMap.TryGetValue(state, out trampoline))
            {
                state = state.Copy();

                trampoline = new PatternTrampoline(this, runtime, state);
                trampolines.Add(trampoline);
                trampolineMap[state] = trampoline;
            }

            return(trampoline);
        }