public IParseResult TryConvertToTokenStream(string pattern, out ITokenStream tokenStream) { var inputStream = new StringStream(pattern); var parseResult = TryConvertToTokenStream(inputStream, out tokenStream); if (!parseResult.IsSuccess) { return(new FailureParseResult(parseResult.Position, parseResult.ErrorType)); } tokenStream.Append(new EndOfStreamToken(pattern.Length)); return(parseResult); }