public bool Next() { if (lineRemaining == null) { return(false); } Token token; var matched = tokenDictionary.Match(lineRemaining, out token); if (matched > 0) { Position += matched; if (token == StandardTokenType.Quotes) { LastResult = new LexerResult(token, lineRemaining.Substring(1, matched - 2)); } else { LastResult = new LexerResult(token, lineRemaining.Substring(0, matched)); } lineRemaining = lineRemaining.Substring(matched); if (lineRemaining.Length == 0) { nextLine(); } return(true); } throw new Exception(string.Format("Unable to match against any tokens at line {0} position {1} \"{2}\"", LineNumber, Position, lineRemaining)); }
public bool Next(out LexerResult result) { var boolResult = Next(); result = LastResult; return(boolResult); }