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)); }
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; }
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); }