|
@ -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[x] == 0) return R<T>(); |
|
|
if (*++in == 0) |
|
|
if (Jupiter::strpbrk<T>(whitespace, in[x]) != nullptr) |
|
|
return R<T>(); |
|
|
{ |
|
|
|
|
|
if (y != 1) |
|
|
if (pos == 0) |
|
|
{ |
|
|
{ |
|
|
y = 1; |
|
|
do |
|
|
i++; |
|
|
++in, ++pos; |
|
|
} |
|
|
while (*in != 0 && Jupiter::strpbrk<T>(whitespace, *in) == nullptr); |
|
|
|
|
|
|
|
|
|
|
|
in -= pos; |
|
|
|
|
|
return R<T>::substring(in, 0, pos); |
|
|
} |
|
|
} |
|
|
else |
|
|
|
|
|
|
|
|
loop_start: |
|
|
{ |
|
|
{ |
|
|
if (i >= pos) break; |
|
|
if (Jupiter::strpbrk<T>(whitespace, *in) != nullptr) |
|
|
y = 0; |
|
|
{ |
|
|
|
|
|
do |
|
|
|
|
|
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
|
|
|