private bool TryGetLexem(out Lexem lexem) { StringBuilder sb = new StringBuilder(); char symbol; while (position < source.Length) { symbol = source[position]; sb.Append(symbol); if (specials.ContainsKey(symbol)) { position += (sb.Length == 0) ? 1 : 0; lexem = new Lexem(sb.ToString(), position); return true; } position += 1; } lexem = null; return false; }
private bool TryGetSpecial(out Lexem lexem) { throw new NotImplementedException(); }
public bool GetNextLexem(out Lexem lexem) { return TryGetSpecial(out lexem) || TryGetLexem(out lexem); }