Merge remote-tracking branch 'origin/master' into windows
[scilab.git] / scilab / modules / ast / src / cpp / parse / flex / scanscilab.ll
index f8ee549..b2fbb32 100644 (file)
@@ -365,19 +365,8 @@ assign                     "="
 <BEGINID>
 {
     {id}                        {
-        wchar_t *pwText = to_wide_string(yytext);
-        if (yytext != NULL && pwText == NULL)
-        {
-           std::string str = "Can\'t convert \'";
-           str += yytext;
-           str += "\' to UTF-8";
-           BEGIN(INITIAL);
-           yyerror(str);
-           return scan_throw(FLEX_ERROR);
-        }
-        yylval.str = new std::wstring(pwText);
-       FREE(pwText);
-       types::InternalType * pIT = symbol::Context::getInstance()->get(symbol::Symbol(*yylval.str));
+        yylval.str = new std::string(yytext);
+       types::InternalType * pIT = symbol::Context::getInstance()->get(symbol::Symbol(*yylval.str));
         if (pIT && pIT->isCallable())
         {
             BEGIN(SHELLMODE);
@@ -622,18 +611,7 @@ assign                     "="
 
 
 <INITIAL,MATRIX>{id}                   {
-    wchar_t *pwText = to_wide_string(yytext);
-    if (yytext != NULL && pwText == NULL)
-    {
-       std::string str = "Can\'t convert \'";
-       str += yytext;
-       str += "\' to UTF-8";
-       BEGIN(INITIAL);
-       yyerror(str);
-       return scan_throw(FLEX_ERROR);
-    }
-    yylval.str = new std::wstring(pwText);
-    FREE(pwText);
+    yylval.str = new std::string(yytext);
 #ifdef TOKENDEV
   std::cout << "--> [DEBUG] ID : " << yytext << std::endl;
 #endif
@@ -643,7 +621,7 @@ assign                      "="
 
 
 <INITIAL,MATRIX,SHELLMODE,BEGINID>{startblockcomment}  {
-  yylval.comment = new std::wstring();
+  yylval.comment = new std::string();
   comment_level = 1;
   ParserSingleInstance::pushControlStatus(Parser::WithinBlockComment);
   yy_push_state(REGIONCOMMENT);
@@ -1012,7 +990,7 @@ assign                     "="
   }
 
   {startblockcomment}                  {
-    yylval.comment = new std::wstring();
+    yylval.comment = new std::string();
     comment_level = 1;
     ParserSingleInstance::pushControlStatus(Parser::WithinBlockComment);
     yy_push_state(REGIONCOMMENT);
@@ -1070,23 +1048,8 @@ assign                   "="
     */
     if (last_token != DOTS)
     {
-        //std::cerr << "pstBuffer = {" << *pstBuffer << "}" << std::endl;
-        //std::cerr << "pstBuffer->c_str() = {" << pstBuffer->c_str() << "}" << std::endl;
-        wchar_t *pwstBuffer = to_wide_string(pstBuffer.c_str());
-        //std::wcerr << L"pwstBuffer = W{" << pwstBuffer << L"}" << std::endl;
-        if (pstBuffer.c_str() != NULL && pwstBuffer == NULL)
-        {
-           pstBuffer.clear();
-           std::string str = "Can\'t convert \'";
-           str += pstBuffer.c_str();
-           str += "\' to UTF-8";
-           BEGIN(INITIAL);
-           yyerror(str);
-           return scan_throw(FLEX_ERROR);
-        }
-        yylval.comment = new std::wstring(pwstBuffer);
-       pstBuffer.clear();
-        FREE (pwstBuffer);
+        yylval.comment = new std::string(pstBuffer);
+        pstBuffer.clear();
         return scan_throw(COMMENT);
     }
     else
@@ -1097,20 +1060,8 @@ assign                   "="
 
   <<EOF>>      {
     yy_pop_state();
-    wchar_t *pwstBuffer = to_wide_string(pstBuffer.c_str());
-    if (pstBuffer.c_str() != NULL && pwstBuffer == NULL)
-    {
-       pstBuffer.clear();
-       std::string str = "Can\'t convert \'";
-       str += pstBuffer.c_str();
-       str += "\' to UTF-8";
-       BEGIN(INITIAL);
-       yyerror(str);
-       return scan_throw(FLEX_ERROR);
-    }
-    yylval.comment = new std::wstring(pwstBuffer);
+    yylval.comment = new std::string(pstBuffer);
     pstBuffer.clear();
-    FREE (pwstBuffer);
     return scan_throw(COMMENT);
   }
 
@@ -1142,14 +1093,12 @@ assign                  "="
     yylloc.last_line += 1;
     yylloc.last_column = 1;
     scan_step();
-    *yylval.comment += L"\n//";
+    *yylval.comment += "\n//";
   }
 
   {char_in_comment}                            |
   .                                             {
-      wchar_t *pwText = to_wide_string(yytext);
-      *yylval.comment += std::wstring(pwText);
-      FREE(pwText);
+      *yylval.comment += std::string(yytext);
   }
 
  <<EOF>>                                       {
@@ -1181,20 +1130,8 @@ assign                   "="
   {quote}                                      {
     yy_pop_state();
     //scan_step();
-    wchar_t *pwstBuffer = to_wide_string(pstBuffer.c_str());
-    if (pstBuffer.c_str() != NULL && pwstBuffer == NULL)
-    {
-       pstBuffer.clear();
-       std::string str = "Can\'t convert \'";
-        str += pstBuffer.c_str();
-        str += "\' to UTF-8";
-       BEGIN(INITIAL);
-       yyerror(str);
-       return scan_throw(FLEX_ERROR);
-    }
-    yylval.str = new std::wstring(pwstBuffer);
+    yylval.str = new std::string(pstBuffer);
     pstBuffer.clear();
-    FREE(pwstBuffer);
     yylloc.first_column = str_opener_column;
     return scan_throw(STR);
   }
@@ -1252,20 +1189,8 @@ assign                   "="
   {dquote}                      {
     yy_pop_state();
     //scan_step();
-    wchar_t *pwstBuffer = to_wide_string(pstBuffer.c_str());
-    if (pstBuffer.c_str() != NULL && pwstBuffer == NULL)
-    {
-       pstBuffer.clear();
-        std::string str = "Can\'t convert \'";
-        str += pstBuffer.c_str();
-        str += "\' to UTF-8";
-       BEGIN(INITIAL);
-       yyerror(str);
-       return scan_throw(FLEX_ERROR);
-    }
-    yylval.str = new std::wstring(pwstBuffer);
+    yylval.str = new std::string(pstBuffer);
     pstBuffer.clear();
-    FREE(pwstBuffer);
     yylloc.first_column = str_opener_column;
     return scan_throw(STR);
   }
@@ -1335,9 +1260,7 @@ assign                    "="
     {assign} {
         if (last_token == STR || last_token == SPACES)
         {
-           wchar_t *pwText = to_wide_string(yytext);
-            yylval.str = new std::wstring(pwText);
-           FREE(pwText);
+            yylval.str = new std::string(yytext);
             return scan_throw(STR);
         }
         else
@@ -1350,9 +1273,7 @@ assign                    "="
     {lparen} {
         if (last_token == STR || last_token == SPACES)
         {
-           wchar_t *pwText = to_wide_string(yytext);
-            yylval.str = new std::wstring(pwText);
-           FREE(pwText);
+            yylval.str = new std::string(yytext);
             return scan_throw(STR);
         }
         else
@@ -1365,9 +1286,7 @@ assign                    "="
     {lowerthan} {
         if (last_token == STR || last_token == SPACES)
         {
-           wchar_t *pwText = to_wide_string(yytext);
-            yylval.str = new std::wstring(pwText);
-           FREE(pwText);
+            yylval.str = new std::string(yytext);
             return scan_throw(STR);
         }
         else
@@ -1380,9 +1299,7 @@ assign                    "="
     {greaterthan} {
         if (last_token == STR || last_token == SPACES)
         {
-           wchar_t *pwText = to_wide_string(yytext);
-            yylval.str = new std::wstring(pwText);
-           FREE(pwText);
+            yylval.str = new std::string(yytext);
             return scan_throw(STR);
         }
         else
@@ -1395,9 +1312,7 @@ assign                    "="
     {boolnot} {
         if (last_token == STR || last_token == SPACES)
         {
-           wchar_t *pwText = to_wide_string(yytext);
-            yylval.str = new std::wstring(pwText);
-           FREE(pwText);
+            yylval.str = new std::string(yytext);
             return scan_throw(STR);
         }
         else
@@ -1409,9 +1324,7 @@ assign                    "="
 
 
     [^ \t\v\f\r\n,;'"]+               {
-       wchar_t *pwText = to_wide_string(yytext);
-        yylval.str = new std::wstring(pwText);
-       FREE(pwText);
+        yylval.str = new std::string(yytext);
         return scan_throw(STR);
     }