]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[4088] string handling improved.
authorTomek Mrugalski <tomasz@isc.org>
Thu, 29 Oct 2015 00:13:14 +0000 (01:13 +0100)
committerTomek Mrugalski <tomasz@isc.org>
Fri, 30 Oct 2015 13:20:11 +0000 (22:20 +0900)
src/lib/eval/lexer.ll

index e79d2294159832b7d2fbc8cb96c066331f09130a..4c8870412094bb8fd69ded360224f6938e94fd5c 100644 (file)
@@ -19,6 +19,7 @@ static isc::eval::location loc;
 %option noyywrap nounput batch debug noinput
 int   [0-9]+
 blank [ \t]
+str [a-zA-Z_0-9]*
 
 %{
     // Code run each time a pattern is matched.
@@ -35,9 +36,13 @@ blank [ \t]
 {blank}+   loc.step();
 [\n]+      loc.lines(yyleng); loc.step();
 
-\'[a-zA-Z_0-9]*\' {
-    // This is a string, no need to do any conversions here.
-    return isc::eval::EvalParser::make_STRING(yytext, loc);
+\'{str}\' {
+    // This is a string. It contains the actual string and single quotes.
+    // We need to get those quotes out of the way.
+    std::string tmp(yytext+1);
+    tmp.resize(tmp.size() - 1);
+
+    return isc::eval::EvalParser::make_STRING(tmp, loc);
 }
 
 option\[{int}\] {