Commit 604e39f2 authored by snuverink_j's avatar snuverink_j
Browse files

parse correctly with leading spaces; adapt test to test on it

parent 0e70dfa7
......@@ -25,9 +25,9 @@ else {
}
obj1: OBJECTIVE, EXPR="KS*KS";
o2: OBJECTIVE, EXPR="sumErrSq("resources/measurement_test.dat", "rms_x", "statfile")";
ob3: OBJECTIVE, EXPR="fromFile("resources/from_file.dat", "var")";
d1: DVAR, VARIABLE="KS", LOWERBOUND="0.0", UPPERBOUND="0.5";
o2: OBJECTIVE, EXPR="sumErrSq("resources/measurement_test.dat", "rms_x", "statfile")";
ob3: OBJECTIVE, EXPR="fromFile("resources/from_file.dat", "var")";
d1: DVAR, VARIABLE="KS", LOWERBOUND="0.0", UPPERBOUND="0.5";
c1: CONSTRAINT, EXPR="KS < 1.0";
objs: OBJECTIVES = (obj1, o2, ob3);
......
......@@ -2,7 +2,7 @@
#include <iostream>
#include <sstream>
#include <boost/algorithm/string.hpp>
#include "boost/algorithm/string.hpp"
#include "boost/tuple/tuple.hpp"
#include "boost/foreach.hpp"
......@@ -151,15 +151,20 @@ std::string CommentAnnotatedInputFileParser::getAttribute(
// "name = value" attribute style
if(attribute.compare("name") == 0) {
// get string on left side of colon
StringList_t res;
boost::split(res, str, boost::is_any_of(":"),
boost::token_compress_on);
std::string ret = res[0];
// remove comment symbols at the beginning of the line
if(comment_symbol_ == "")
if(comment_symbol_ == "") {
// trim left space
boost::trim_left(ret);
return ret;
}
// get string on right side of comment
boost::split(res, ret, boost::is_any_of(comment_symbol_),
boost::token_compress_on);
return res[1];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment