diff options
-rw-r--r-- | odb/sql-lexer.cxx | 27 | ||||
-rw-r--r-- | odb/sql-lexer.hxx | 3 |
2 files changed, 23 insertions, 7 deletions
diff --git a/odb/sql-lexer.cxx b/odb/sql-lexer.cxx index a3d144d..b29138e 100644 --- a/odb/sql-lexer.cxx +++ b/odb/sql-lexer.cxx @@ -9,15 +9,28 @@ using namespace std; sql_lexer:: +sql_lexer () + : loc_ ("C"), buf_ (0, 0, 0) +{ +} + +sql_lexer:: sql_lexer (std::string const& sql) - : loc_ ("C"), - is_ (sql), - l_ (1), - c_(1), - eos_ (false), - buf_ (0, 0, 0), - unget_ (false) + : loc_ ("C"), buf_ (0, 0, 0) { + lex (sql); +} + +void sql_lexer:: +lex (std::string const& sql) +{ + is_.str (sql); + is_.clear (); + + l_ = c_ = 1; + buf_ = xchar (0, 0, 0); + eos_ = false; + unget_ = false; } sql_lexer::xchar sql_lexer:: diff --git a/odb/sql-lexer.hxx b/odb/sql-lexer.hxx index adeff37..bb1c56e 100644 --- a/odb/sql-lexer.hxx +++ b/odb/sql-lexer.hxx @@ -15,8 +15,11 @@ class sql_lexer { public: + sql_lexer (); sql_lexer (std::string const& sql); + void lex (std::string const& sql); + struct invalid_input { invalid_input (std::size_t l, std::size_t c, std::string const& m) |