|
@ -1117,27 +1117,48 @@ template<typename T> template<template<typename> class R> R<T> Jupiter::Readable |
|
|
|
|
|
|
|
|
template<typename T> template<template<typename> class R> R<T> Jupiter::Readable_String<T>::getWord(const T *in, size_t pos, const T *whitespace) |
|
|
template<typename T> template<template<typename> class R> R<T> Jupiter::Readable_String<T>::getWord(const T *in, size_t pos, const T *whitespace) |
|
|
{ |
|
|
{ |
|
|
unsigned int x = 0; |
|
|
if (*in == 0) |
|
|
unsigned int y = 1; |
|
|
return R<T>(); |
|
|
for (unsigned int i = 0; i < pos || y == 1; x++) |
|
|
|
|
|
|
|
|
while (Jupiter::strpbrk<T>(whitespace, *in) != nullptr) |
|
|
|
|
|
if (*++in == 0) |
|
|
|
|
|
return R<T>(); |
|
|
|
|
|
|
|
|
|
|
|
if (pos == 0) |
|
|
{ |
|
|
{ |
|
|
if (in[x] == 0) return R<T>(); |
|
|
do |
|
|
if (Jupiter::strpbrk<T>(whitespace, in[x]) != nullptr) |
|
|
++in, ++pos; |
|
|
{ |
|
|
while (*in != 0 && Jupiter::strpbrk<T>(whitespace, *in) == nullptr); |
|
|
if (y != 1) |
|
|
|
|
|
{ |
|
|
in -= pos; |
|
|
y = 1; |
|
|
return R<T>::substring(in, 0, pos); |
|
|
i++; |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
loop_start: |
|
|
else |
|
|
{ |
|
|
|
|
|
if (Jupiter::strpbrk<T>(whitespace, *in) != nullptr) |
|
|
{ |
|
|
{ |
|
|
if (i >= pos) break; |
|
|
do |
|
|
y = 0; |
|
|
if (*++in == 0) |
|
|
|
|
|
return R<T>(); |
|
|
|
|
|
while (Jupiter::strpbrk<T>(whitespace, *in) != nullptr); |
|
|
|
|
|
|
|
|
|
|
|
if (--pos == 0) |
|
|
|
|
|
goto loop_end; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (++in == 0) |
|
|
|
|
|
return R<T>(); |
|
|
|
|
|
goto loop_start; |
|
|
} |
|
|
} |
|
|
for (y = x; in[y] != 0 && Jupiter::strpbrk<T>(whitespace, in[y]) == nullptr; y++); |
|
|
loop_end: |
|
|
return R<T>::substring(in, x, y - x); |
|
|
|
|
|
|
|
|
do |
|
|
|
|
|
++in, ++pos; |
|
|
|
|
|
while (*in != 0 && Jupiter::strpbrk<T>(whitespace, *in) == nullptr); |
|
|
|
|
|
|
|
|
|
|
|
in -= pos; |
|
|
|
|
|
return R<T>::substring(in, 0, pos); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// getToken
|
|
|
// getToken
|
|
|