From 42cb1981d59f32a477bf22841adf5dc6e9a812bf Mon Sep 17 00:00:00 2001 From: evomarc Date: Tue, 8 May 2001 03:49:35 +0000 Subject: [PATCH] In eoParser::readFrom, added a test to avoid reading non-parser sections as these generally contain many -xxx that generate a reading error when xxx is not a keyword. This allows to use State-savec files directly as parameter files --- eo/src/utils/eoParser.cpp | 99 +++++++++++++++++++++------------------ 1 file changed, 53 insertions(+), 46 deletions(-) diff --git a/eo/src/utils/eoParser.cpp b/eo/src/utils/eoParser.cpp index 3f19c75e..10a2bea4 100644 --- a/eo/src/utils/eoParser.cpp +++ b/eo/src/utils/eoParser.cpp @@ -142,61 +142,68 @@ void eoParser::updateParameters() const void eoParser::readFrom(istream& is) { string str; + // we must avoid processing \section{xxx} if xxx is NOT "Parser" + bool processing = true; while (is >> str) - { + { + if (str.find(string("\\section{"))==0) // found section begin + processing = (str.find(string("Parser"))= 3) - value = string(str.begin() + 3, str.end()); - } - else - { - value = string(str.begin() + 2, str.end()); - } - } + if (str.size() >= 2) + { + if (str[2] == '=') + { + if (str.size() >= 3) + value = string(str.begin() + 3, str.end()); + } + else + { + value = string(str.begin() + 2, str.end()); + } + } - shortNameMap[str[1]] = value; - } - } + shortNameMap[str[1]] = value; + } + } + } } updateParameters();