]> granicus.if.org Git - re2c/commitdiff
- Only emit YYMARKER if needed
authorhelly <helly@642ea486-5414-0410-9d7f-a0204ed87703>
Sun, 16 Apr 2006 16:59:33 +0000 (16:59 +0000)
committerhelly <helly@642ea486-5414-0410-9d7f-a0204ed87703>
Sun, 16 Apr 2006 16:59:33 +0000 (16:59 +0000)
code.cc
globals.h
main.cc

diff --git a/code.cc b/code.cc
index ec826ac826e6902f41e9937808fd7c77c7587557..f75830e3cff8662c8bcbb61db241bfef28f43df6 100644 (file)
--- a/code.cc
+++ b/code.cc
@@ -396,11 +396,11 @@ void Initial::emit(std::ostream &o, uint ind, bool &readCh) const
        }
        if (state->link)
        {
-               need(o, ind, state->depth, readCh, setMarker);
+               need(o, ind, state->depth, readCh, setMarker && bUseYYMarker);
        }
        else
        {
-               if (setMarker)
+               if (setMarker && bUseYYMarker)
                {
                        o << indent(ind) << "YYMARKER = YYCURSOR;\n";
                }
@@ -417,12 +417,22 @@ void Save::emit(std::ostream &o, uint ind, bool &readCh) const
 
        if (state->link)
        {
-               o << indent(ind) << "YYMARKER = ++YYCURSOR;\n";
+               if (bUseYYMarker)
+               {
+                       o << indent(ind) << "YYMARKER = ++YYCURSOR;\n";
+               }
                need(o, ind, state->depth, readCh, false);
        }
        else
        {
-               o << indent(ind) << "yych = *(YYMARKER = ++YYCURSOR);\n";
+               if (bUseYYMarker)
+               {
+                       o << indent(ind) << "yych = *(YYMARKER = ++YYCURSOR);\n";
+               }
+               else
+               {
+                       o << indent(ind) << "yych = *++YYCURSOR;\n";
+               }
                readCh = false;
        }
 }
@@ -464,6 +474,7 @@ void Accept::emit(std::ostream &o, uint ind, bool &readCh) const
                        if (first)
                        {
                                first = false;
+                               bUseYYMarker = true;
                                o << indent(ind) << "YYCURSOR = YYMARKER;\n";
                                if (bUsedYYAccept && cases > 1)
                                {
index 7ca838298aa7f2788b5744f81dff02d14158f6bf..323d1c7055a305dcbac80ec16f5f65e4d424f0c0 100644 (file)
--- a/globals.h
+++ b/globals.h
@@ -36,6 +36,7 @@ extern bool bUseStateAbort;
 extern bool bUseStateNext;
 extern bool bWroteGetState;
 extern bool bUseYYFill;
+extern bool bUseYYMarker;
 
 extern uint asc2ebc[256];
 extern uint ebc2asc[256];
diff --git a/main.cc b/main.cc
index 7a2c5a1836586b4791d4a466a8e7af3360e206cd..ddbe917d6b1979afc972e80a0f51ce2cbe076c03 100644 (file)
--- a/main.cc
+++ b/main.cc
@@ -33,6 +33,7 @@ bool bUsedYYAccept = false;
 bool bUseStartLabel= false;
 bool bUseStateNext = false;
 bool bUseYYFill    = true;
+bool bUseYYMarker  = false;
 
 std::string startLabelName;
 uint maxFill = 1;