diff --git a/src/Nibbler.cpp b/src/Nibbler.cpp index 117d5b232..6dcf9557d 100644 --- a/src/Nibbler.cpp +++ b/src/Nibbler.cpp @@ -903,6 +903,9 @@ bool Nibbler::getDate (const std::string& format, time_t& t) } //////////////////////////////////////////////////////////////////////////////// +// Assumes that the options are sorted by decreasing length, so that if the +// options contain 'fourteen' and 'four', the stream is first matched against +// the longer entry. bool Nibbler::getOneOf ( const std::vector & options, std::string& found) @@ -922,6 +925,8 @@ bool Nibbler::getOneOf ( //////////////////////////////////////////////////////////////////////////////// // [|||].[. ...] +// +// TODO Obsolete bool Nibbler::getDOM (std::string& result) { std::string::size_type i = mCursor; @@ -933,9 +938,10 @@ bool Nibbler::getDOM (std::string& result) std::string right; int number; - if (getWord (left) && + // .[. ...] + if (getName (left) && skip ('.') && - getWord (right)) + getName (right)) { while (skip ('.') && getWord (right)) @@ -946,9 +952,11 @@ bool Nibbler::getDOM (std::string& result) } restore (); + + // .[. ...] if (getInt (number) && skip ('.') && - getWord (right)) + getName (right)) { while (skip ('.') && getWord (right)) @@ -959,9 +967,11 @@ bool Nibbler::getDOM (std::string& result) } restore (); + + // .[. ...] if (getUUID (left) && skip ('.') && - getWord (right)) + getName (right)) { while (skip ('.') && getWord (right)) @@ -972,7 +982,9 @@ bool Nibbler::getDOM (std::string& result) } restore (); - if (getWord (right)) + + // [. ...] + if (getName (right)) { while (skip ('.') && getWord (right)) @@ -982,6 +994,7 @@ bool Nibbler::getDOM (std::string& result) return true; } + restore (); } return false;