@@ -75,9 +75,9 @@ inline bool IsDigit(Char Symbol) noexcept
7575
7676// / Skips all characters until the end of the line.
7777
78- // / \param[inout] Pos - starting position.
79- // / \param[in] End - end of the input string.
80- // / \param[in] GoToNextLine - whether to go to the next line.
78+ // / \param[in] Start - starting position.
79+ // / \param[in] End - end of the input string.
80+ // / \param[in] GoToNextLine - whether to go to the next line.
8181// /
8282// / \return If GoToNextLine is true, the position following the
8383// / new line character at the end of the string.
@@ -124,9 +124,9 @@ DEFINE_FLAG_ENUM_OPERATORS(SKIP_COMMENT_FLAGS)
124124
125125// / Skips single-line and multi-line comments starting from the given position.
126126
127- // / \param[inout ] Start - starting position.
128- // / \param[in] End - end of the input string.
129- // / \param[in] Flags - flags controlling what kind of comments to skip.
127+ // / \param[in ] Start - starting position.
128+ // / \param[in] End - end of the input string.
129+ // / \param[in] Flags - flags controlling what kind of comments to skip.
130130// /
131131// / \return if the comment is found, the position immediately following
132132// / the end of the comment; starting position otherwise.
@@ -211,9 +211,9 @@ InteratorType SkipComment(const InteratorType& Start, const InteratorType& End,
211211
212212// / Skips all delimiters starting from the given position.
213213
214- // / \param[inout] Pos - starting position.
215- // / \param[in] End - end of the input string.
216- // / \param[in] Delimiters - optional string containing custom delimiters.
214+ // / \param[in] Start - starting position.
215+ // / \param[in] End - end of the input string.
216+ // / \param[in] Delimiters - optional string containing custom delimiters.
217217// /
218218// / \return position of the first non-delimiter character.
219219template <typename InteratorType>
@@ -236,10 +236,10 @@ InteratorType SkipDelimiters(const InteratorType& Start, const InteratorType& En
236236
237237// / Skips all comments and all delimiters starting from the given position.
238238
239- // / \param[inout] Pos - starting position.
240- // / \param[in] End - end of the input string.
241- // / \param[in] Delimiters - optional string containing custom delimiters.
242- // / \param[in] CommentFlags - optional flags controlling what kind of comments to skip.
239+ // / \param[in] Start - starting position.
240+ // / \param[in] End - end of the input string.
241+ // / \param[in] Delimiters - optional string containing custom delimiters.
242+ // / \param[in] CommentFlags - optional flags controlling what kind of comments to skip.
243243// /
244244// / \return true position of the first non-comment non-delimiter character.
245245// /
@@ -270,8 +270,8 @@ IteratorType SkipDelimitersAndComments(const IteratorType& Start,
270270
271271// / Skips one identifier starting from the given position.
272272
273- // / \param[inout] Pos - starting position.
274- // / \param[in] End - end of the input string.
273+ // / \param[in] Start - starting position.
274+ // / \param[in] End - end of the input string.
275275// /
276276// / \return position immediately following the last character of identifier.
277277template <typename IteratorType>
@@ -295,8 +295,8 @@ IteratorType SkipIdentifier(const IteratorType& Start, const IteratorType& End)
295295
296296// / Skips a floating point number starting from the given position.
297297
298- // / \param[inout] Pos - starting position.
299- // / \param[in] End - end of the input string.
298+ // / \param[in] Start - starting position.
299+ // / \param[in] End - end of the input string.
300300// /
301301// / \return position immediately following the last character of the number.
302302template <typename IteratorType>
@@ -385,6 +385,38 @@ IteratorType SkipFloatNumber(const IteratorType& Start, const IteratorType& End)
385385 return Pos;
386386}
387387
388+ // / Parses an integer starting from the given position.
389+ // /
390+ // / \param[in] Start - starting position.
391+ // / \param[in] End - end of the input string
392+ // / \param[out] Value - parsed integer value.
393+ // / \return position immediately following the last character of the number.
394+ template <typename IteratorType, typename ValueType>
395+ IteratorType ParseInteger (const IteratorType& Start, const IteratorType& End, ValueType& Value) noexcept
396+ {
397+ auto Pos = Start;
398+ if (Pos == End)
399+ return Pos;
400+
401+ const bool IsNegative = *Pos == ' -' ;
402+ if (*Pos == ' +' || *Pos == ' -' )
403+ ++Pos;
404+
405+ if (Pos == End || !IsNum (*Pos))
406+ return Start;
407+
408+ Value = 0 ;
409+ while (Pos != End && IsNum (*Pos))
410+ {
411+ Value = Value * 10 + (*Pos - ' 0' );
412+ ++Pos;
413+ }
414+
415+ if (IsNegative)
416+ Value = -Value;
417+
418+ return Pos;
419+ }
388420
389421// / Splits string into chunks separated by comments and delimiters.
390422// /
0 commit comments