void SkipDelimiters() { while (position < text.Length && Delimiters.IndexOf(text[position]) != -1) { ++position; } }
int GetWordLength() { var endPosition = position; while (endPosition < text.Length && Delimiters.IndexOf(text[endPosition]) == -1) { ++endPosition; } return(endPosition - position); }
public void AddLexemLog(Tuple <State, string> value) { int position = 0; switch (value.Item1) { case (State.Identifier): { position = Identifiers.IndexOf(value.Item2); if (position == -1) { Identifiers.Add(value.Item2); position = Identifiers.IndexOf(value.Item2); } break; } case (State.Keyword): { position = Keywords.IndexOf(value.Item2); if (position == -1) { Keywords.Add(value.Item2); position = Keywords.IndexOf(value.Item2); } break; } case (State.DecimalNumber): { position = DecimalNumbers.IndexOf(value.Item2); if (position == -1) { DecimalNumbers.Add(value.Item2); position = DecimalNumbers.IndexOf(value.Item2); } break; } case (State.Delimiter): { position = Delimiters.IndexOf(value.Item2); if (position == -1) { Delimiters.Add(value.Item2); position = Delimiters.IndexOf(value.Item2); } break; } case (State.DoubleDelimiter): { position = Delimiters.IndexOf(value.Item2); if (position == -1) { Delimiters.Add(value.Item2); position = Delimiters.IndexOf(value.Item2); } break; } case (State.String): { position = Strings.IndexOf(value.Item2); if (position == -1) { Strings.Add(value.Item2); position = Strings.IndexOf(value.Item2); } break; } default: { Console.WriteLine($"{value} Not found"); break; } } var entry = new DecompositionTableEntry { Table = value.Item1, Lexem = value.Item2, Position = position }; CommonSymbolTable.Add(entry); }