tokens.cpp 612 B

1234567891011121314151617181920
  1. #include "lexer.h"
  2. namespace NSQLTranslation {
  3. IOutputStream& OutputTokens(IOutputStream& out, TParsedTokenList::const_iterator begin, TParsedTokenList::const_iterator end) {
  4. for (auto it = begin; it != end; ++it) {
  5. out << it->Content;
  6. }
  7. return out;
  8. }
  9. bool Tokenize(ILexer& lexer, const TString& query, const TString& queryName, TParsedTokenList& tokens, NYql::TIssues& issues, size_t maxErrors) {
  10. auto onNextToken = [&tokens](TParsedToken&& token) {
  11. tokens.push_back(std::move(token));
  12. };
  13. return lexer.Tokenize(query, queryName, onNextToken, issues, maxErrors);
  14. }
  15. }