From dd91e04ca96ff2266ba3de7ead0d73ff40a760f4 Mon Sep 17 00:00:00 2001 From: helly Date: Sun, 16 Apr 2006 16:59:33 +0000 Subject: [PATCH] - Only emit YYMARKER if needed --- code.cc | 19 +++++++++++++++---- globals.h | 1 + main.cc | 1 + 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/code.cc b/code.cc index ec826ac8..f75830e3 100644 --- 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) { diff --git a/globals.h b/globals.h index 7ca83829..323d1c70 100644 --- 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 7a2c5a18..ddbe917d 100644 --- 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; -- 2.50.1