I'm in a method, named total_parsing
, and I create a local variable
istringstream stream(to_analize)
(where to_analize
is the string that I have to analyze).
When I reach the special char (
or [
I want to claim a method, reading_between_bracket
, that read the string from the open bracket to the closing bracket. After that I want that the method reading_between_bracket
give me the possibility to continue the reading in total parsing. I need a method for the reading of string in bracket because I want to claim it recursively every time I reach a bracket. The string is in the format of the example.
Example -( B + D -( ( G*F) -H )))
void total_parsing(string to_analize) {
istrinstream stream(to_analize);
do {
// DO OTHER OPERATION WITHOUT BRACKET
if (token == "(" || !token.find('(')) {
stream = reading_between_bracket(stream);
}
} while (stream >> token);
}
istringstream reading_between_bracket(istringstream stream) {
// DO THE OPERATION BETWEEN BRACKET
// RECURSIVE CALL OF THIS METHOD IF I REACH A BRACKET,RETURN THE STREAM
return stream(or a pointer that make possible to continue reading);
}
PS I have to use C++11 and I can utilize STL and sstream.
The code that is in description didn't work