public void OnWordHandled(WordToken word) { WordHandled(word); }
public void Explore(string str) { string[] tokens = str.Split(' '); int currentPosition = 0; for (int i = 0; i < tokens.Length; i++) { if (IsNumber(tokens[i])) { int number = int.Parse(tokens[i]); NumberToken numberToken = new NumberToken(number, currentPosition); OnNumberHandled(numberToken); } else { WordToken wordToken = new WordToken(tokens[i], currentPosition); OnWordHandled(wordToken); } currentPosition += tokens[i].Length + 1; } }