]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[4088] Moved yy to isc::eval namespace
authorTomek Mrugalski <tomasz@isc.org>
Wed, 28 Oct 2015 19:53:40 +0000 (20:53 +0100)
committerTomek Mrugalski <tomasz@isc.org>
Fri, 30 Oct 2015 13:20:11 +0000 (22:20 +0900)
src/lib/eval/eval_context.cc
src/lib/eval/eval_context.h
src/lib/eval/lexer.ll
src/lib/eval/parser.yy

index e034dab91834e0dcc7b0664e32e5a0594373f01a..b1482978423677a2521a1ec3a97d92228b700e6c 100644 (file)
@@ -19,7 +19,7 @@ EvalContext::parseFile(const std::string &filename)
 {
     file = filename;
     scan_begin();
-    yy::EvalParser parser (*this);
+    isc::eval::EvalParser parser (*this);
     parser.set_debug_level(trace_parsing);
     int res = parser.parse();
     scan_end();
@@ -42,7 +42,7 @@ EvalContext::parseString(const std::string& str)
 }
 
 void
-EvalContext::error (const yy::location& l, const std::string& m)
+EvalContext::error (const isc::eval::location& l, const std::string& m)
 {
   std::cerr << l << ": " << m << std::endl;
 }
index 9960d77f95bd72245e1f71f6590cff026f52cef7..33a370c7138c6d70cf84383ae19fd3f41c61bae3 100644 (file)
@@ -6,7 +6,7 @@
 
 // Tell Flex the lexer's prototype ...
 # define YY_DECL \
-  yy::EvalParser::symbol_type yylex (EvalContext& driver)
+    isc::eval::EvalParser::symbol_type yylex (EvalContext& driver)
 
 // ... and declare it for the parser's sake.
 YY_DECL;
@@ -41,7 +41,7 @@ public:
   bool trace_parsing;
 
   // Error handling.
-  void error (const yy::location& l, const std::string& m);
+  void error (const isc::eval::location& l, const std::string& m);
   void error (const std::string& m);
 };
 #endif // ! EVALCONTEXT_HH
index 386e16dfec4b414b8cae4101e4eed2f580d0b83c..568f188097b6997fc7ef723026d43aab2f5479c2 100644 (file)
@@ -14,7 +14,7 @@
 # define yywrap() 1
 
 // The location of the current token.
-static yy::location loc;
+static isc::eval::location loc;
 %}
 %option noyywrap nounput batch debug noinput
 id    [a-zA-Z][a-zA-Z_0-9]*
@@ -35,13 +35,13 @@ blank [ \t]
 
 {blank}+   loc.step ();
 [\n]+      loc.lines (yyleng); loc.step ();
-"-"      return yy::EvalParser::make_MINUS(loc);
-"+"      return yy::EvalParser::make_PLUS(loc);
-"*"      return yy::EvalParser::make_STAR(loc);
-"/"      return yy::EvalParser::make_SLASH(loc);
-"("      return yy::EvalParser::make_LPAREN(loc);
-")"      return yy::EvalParser::make_RPAREN(loc);
-":="     return yy::EvalParser::make_ASSIGN(loc);
+"-"      return isc::eval::EvalParser::make_MINUS(loc);
+"+"      return isc::eval::EvalParser::make_PLUS(loc);
+"*"      return isc::eval::EvalParser::make_STAR(loc);
+"/"      return isc::eval::EvalParser::make_SLASH(loc);
+"("      return isc::eval::EvalParser::make_LPAREN(loc);
+")"      return isc::eval::EvalParser::make_RPAREN(loc);
+":="     return isc::eval::EvalParser::make_ASSIGN(loc);
 
 
 {int}      {
@@ -49,12 +49,12 @@ blank [ \t]
   long n = strtol (yytext, NULL, 10);
   if (! (INT_MIN <= n && n <= INT_MAX && errno != ERANGE))
     driver.error (loc, "integer is out of range");
-  return yy::EvalParser::make_NUMBER(n, loc);
+  return isc::eval::EvalParser::make_NUMBER(n, loc);
 }
 
-{id}       return yy::EvalParser::make_IDENTIFIER(yytext, loc);
+{id}       return isc::eval::EvalParser::make_IDENTIFIER(yytext, loc);
 .          driver.error (loc, "invalid character");
-<<EOF>>    return yy::EvalParser::make_END(loc);
+<<EOF>>    return isc::eval::EvalParser::make_END(loc);
 %%
 
 void
index 88862a21b20804df4922ad4f8543bf277911c12c..46be4b745d3f43a87d7c7f53709fe77f7b1b62c3 100644 (file)
@@ -4,6 +4,7 @@
 %define parser_class_name {EvalParser}
 %define api.token.constructor
 %define api.value.type variant
+%define api.namespace {isc::eval}
 %define parse.assert
 %code requires
 {
@@ -24,7 +25,7 @@ class EvalContext;
 {
 # include "eval_context.h"
 }
-%define api.token.prefix {TOK_}
+%define api.token.prefix {TOKEN_}
 %token
   END  0  "end of file"
   ASSIGN  ":="
@@ -62,8 +63,8 @@ exp:
 | "number"      { std::swap ($$, $1); };
 %%
 void
-yy::EvalParser::error(const location_type& l,
-                      const std::string& m)
+isc::eval::EvalParser::error(const location_type& l,
+                             const std::string& m)
 {
   driver.error (l, m);
 }