コード例 #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));
        }
コード例 #2
0
ファイル: Pattern.cs プロジェクト: KevinKelley/katahdin
 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;
 }
コード例 #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);
        }