]> granicus.if.org Git - re2c/commitdiff
- Split labels from code
authorhelly <helly@642ea486-5414-0410-9d7f-a0204ed87703>
Wed, 21 Feb 2007 21:19:24 +0000 (21:19 +0000)
committerhelly <helly@642ea486-5414-0410-9d7f-a0204ed87703>
Wed, 21 Feb 2007 21:19:24 +0000 (21:19 +0000)
re2c/code.cc

index eb424abcce271d5906df4be7164f0e2e2fa600f3..8bb0402b50e883744e5432bc5aaa44afc238bb13 100644 (file)
@@ -1697,13 +1697,18 @@ void Scanner::config(const Str& cfg, int num)
        }
 }
 
-static std::set<std::string> mapDefineKeys;
 static std::set<std::string> mapCodeKeys;
+static std::set<std::string> mapDefineKeys;
+static std::set<std::string> mapLabelKeys;
 
 void Scanner::config(const Str& cfg, const Str& val)
 {
        if (mapDefineKeys.empty())
        {
+               mapCodeKeys.insert("code:yyaccept");
+               mapCodeKeys.insert("code:yybm");
+               mapCodeKeys.insert("code:yych");
+               mapCodeKeys.insert("code:yytarget");
                mapDefineKeys.insert("define:YYCTXMARKER");
                mapDefineKeys.insert("define:YYCTYPE");
                mapDefineKeys.insert("define:YYCURSOR");
@@ -1713,12 +1718,8 @@ void Scanner::config(const Str& cfg, const Str& val)
                mapDefineKeys.insert("define:YYLIMIT");
                mapDefineKeys.insert("define:YYMARKER");
                mapDefineKeys.insert("define:YYSETSTATE");
-               mapCodeKeys.insert("code:yyFillLabel");
-               mapCodeKeys.insert("code:yyNext");
-               mapCodeKeys.insert("code:yyaccept");
-               mapCodeKeys.insert("code:yybm");
-               mapCodeKeys.insert("code:yych");
-               mapCodeKeys.insert("code:yytarget");
+               mapLabelKeys.insert("label:yyFillLabel");
+               mapLabelKeys.insert("label:yyNext");
        }
 
        std::string strVal;
@@ -1747,13 +1748,17 @@ void Scanner::config(const Str& cfg, const Str& val)
        {
                labelPrefix = strVal;
        }
+       else if (mapCodeKeys.find(cfg.to_string()) != mapCodeKeys.end())
+    {
+       mapCodeName[cfg.to_string().c_str() + sizeof("code:") - 1] = strVal;
+    }
        else if (mapDefineKeys.find(cfg.to_string()) != mapDefineKeys.end())
     {
        mapCodeName[cfg.to_string().c_str() + sizeof("define:") - 1] = strVal;
     }
-       else if (mapCodeKeys.find(cfg.to_string()) != mapCodeKeys.end())
+       else if (mapLabelKeys.find(cfg.to_string()) != mapLabelKeys.end())
     {
-       mapCodeName[cfg.to_string().c_str() + sizeof("code:") - 1] = strVal;
+       mapCodeName[cfg.to_string().c_str() + sizeof("label:") - 1] = strVal;
     }
        else
        {