From 667d9c4a082552fb64c5ffe7b0bd6212c8a8b1b3 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Sun, 12 Apr 2015 18:47:29 +0200 Subject: Implement endAtWhitespace flag which tells TokenizedDataReader to stop reading data after the first whitespace character --- src/core/parser/utils/TokenizedData.hpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/core/parser/utils/TokenizedData.hpp') diff --git a/src/core/parser/utils/TokenizedData.hpp b/src/core/parser/utils/TokenizedData.hpp index 95af95e..83821d7 100644 --- a/src/core/parser/utils/TokenizedData.hpp +++ b/src/core/parser/utils/TokenizedData.hpp @@ -307,11 +307,15 @@ public: * enabled tokens. * @param mode is the whitespace mode that should be used when a text token * is returned. + * @param endAtWhitespace if true, only delivers data until the first + * whitespace character after a sequence of non-whitespace characters. Does + * not affect the delivery of non-data tokens. * @return true if the operation was successful and there is a next token, * false if there are no more tokens. */ bool read(Token &token, const TokenSet &tokens = TokenSet{}, - WhitespaceMode mode = WhitespaceMode::TRIM); + WhitespaceMode mode = WhitespaceMode::TRIM, + bool endAtWhitespace = false); /** * Stores the next token in the given token reference, returns true if the @@ -323,11 +327,15 @@ public: * enabled tokens. * @param mode is the whitespace mode that should be used when a text token * is returned. + * @param endAtWhitespace if true, only delivers data until the first + * whitespace character after a sequence of non-whitespace characters. Does + * not affect the delivery of non-data tokens. * @return true if the operation was successful and there is a next token, * false if there are no more tokens. */ bool peek(Token &token, const TokenSet &tokens = TokenSet{}, - WhitespaceMode mode = WhitespaceMode::TRIM); + WhitespaceMode mode = WhitespaceMode::TRIM, + bool endAtWhitespace = false); /** * Consumes the peeked tokens, the read cursor will now be at the position -- cgit v1.2.3