diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-05-31 23:24:40 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-05-31 23:24:40 +0100 |
commit | 70297cec8122c0a0a7957664b60129e6809d57b6 (patch) | |
tree | aa768cf8f752002b4d8ebd03cf8efa6cea23ba09 /project2/sql | |
parent | Parse .p2 config files with flex (diff) | |
download | project2-70297cec8122c0a0a7957664b60129e6809d57b6.tar.bz2 project2-70297cec8122c0a0a7957664b60129e6809d57b6.tar.xz project2-70297cec8122c0a0a7957664b60129e6809d57b6.zip |
Add some experience to the flex, prefixes
Diffstat (limited to 'project2/sql')
-rw-r--r-- | project2/sql/sql.ll | 10 | ||||
-rw-r--r-- | project2/sql/sqlFlexLexer.cpp | 4 | ||||
-rw-r--r-- | project2/sql/sqlFlexLexer.h | 4 |
3 files changed, 14 insertions, 4 deletions
diff --git a/project2/sql/sql.ll b/project2/sql/sql.ll index 604a53d..ab40642 100644 --- a/project2/sql/sql.ll +++ b/project2/sql/sql.ll @@ -1,13 +1,16 @@ %option batch %option c++ %option noyywrap +%option 8bit +%option stack +%option yylineno %option yyclass="sqlFlexLexer" +%option prefix="sqlBase" %{ #include <stdexcept> #include "sqlFlexLexer.h" -std::string comment; -std::string statement; +#pragma GCC diagnostic ignored "-Wsign-compare" %} space [ \t\n\r\f] @@ -115,3 +118,6 @@ p2mockscriptdir "$P2MOCKSCRIPTDIR" statement += YYText(); } +<*>[ \t\r\n\f] { +} + diff --git a/project2/sql/sqlFlexLexer.cpp b/project2/sql/sqlFlexLexer.cpp index cbf2416..eaacd50 100644 --- a/project2/sql/sqlFlexLexer.cpp +++ b/project2/sql/sqlFlexLexer.cpp @@ -1,3 +1,4 @@ +#define yyFlexLexer sqlBaseFlexLexer #include <FlexLexer.h> #include "sqlFlexLexer.h" #include <logger.h> @@ -10,8 +11,9 @@ sqlFlexLexer::sqlFlexLexer(const boost::filesystem::path & s, std::istream & f, } void -sqlFlexLexer::LexerOutput(const char *, int) +sqlFlexLexer::LexerError(const char * msg) { + throw std::runtime_error(msg); } void diff --git a/project2/sql/sqlFlexLexer.h b/project2/sql/sqlFlexLexer.h index fbaf799..55019e5 100644 --- a/project2/sql/sqlFlexLexer.h +++ b/project2/sql/sqlFlexLexer.h @@ -13,10 +13,12 @@ class sqlFlexLexer : public yyFlexLexer { std::string MockScriptDir() const; protected: - void LexerOutput(const char *, int) override; + void LexerError(const char *) override; private: DB::Connection * conn; const boost::filesystem::path script; + std::string comment; + std::string statement; }; |