public FiniteAutomation(Func <char, SymbolType> symbolClassifier) { _links = new Dictionary <KeyState, Action <FiniteState, SymbolType> >(); DefaultAction = (state, token) => { }; State = new FiniteState(); SymbolClassifier = symbolClassifier; NecessaryAction = (state, ch) => { state.UserState.Append(ch); }; }
static void GlobalLink(FiniteState state, SymbolType token) { if (token == SymbolType.Slash) { state.Begin(KeyState.GlobalSlash); } if (token == SymbolType.Dog) { state.Begin(KeyState.GlobalDog); } if (token == SymbolType.DoubledQuoter) { state.Begin(KeyState.String); } if (token == SymbolType.SingleQuoter) { state.Begin(KeyState.Char); } }