Pig: Converted to unicodeLatinDigit

This commit is contained in:
Paul Beckingham 2016-01-14 22:03:57 -05:00
parent 6a85ef9155
commit 9f12807526

View file

@ -136,7 +136,7 @@ bool Pig::getDigit (int& result)
{ {
int c = _text[_cursor]; int c = _text[_cursor];
if (c && if (c &&
Lexer::isDigit (c)) unicodeLatinDigit (c))
{ {
result = c - '0'; result = c - '0';
++_cursor; ++_cursor;
@ -149,9 +149,9 @@ bool Pig::getDigit (int& result)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool Pig::getDigit2 (int& result) bool Pig::getDigit2 (int& result)
{ {
if (Lexer::isDigit (_text[_cursor + 0])) if (unicodeLatinDigit (_text[_cursor + 0]))
{ {
if (Lexer::isDigit (_text[_cursor + 1])) if (unicodeLatinDigit (_text[_cursor + 1]))
{ {
result = strtoimax (_text.substr (_cursor, 2).c_str (), NULL, 10); result = strtoimax (_text.substr (_cursor, 2).c_str (), NULL, 10);
_cursor += 2; _cursor += 2;
@ -165,11 +165,11 @@ bool Pig::getDigit2 (int& result)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool Pig::getDigit3 (int& result) bool Pig::getDigit3 (int& result)
{ {
if (Lexer::isDigit (_text[_cursor + 0])) if (unicodeLatinDigit (_text[_cursor + 0]))
{ {
if (Lexer::isDigit (_text[_cursor + 1])) if (unicodeLatinDigit (_text[_cursor + 1]))
{ {
if (Lexer::isDigit (_text[_cursor + 2])) if (unicodeLatinDigit (_text[_cursor + 2]))
{ {
result = strtoimax (_text.substr (_cursor, 3).c_str (), NULL, 10); result = strtoimax (_text.substr (_cursor, 3).c_str (), NULL, 10);
_cursor += 3; _cursor += 3;
@ -184,13 +184,13 @@ bool Pig::getDigit3 (int& result)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool Pig::getDigit4 (int& result) bool Pig::getDigit4 (int& result)
{ {
if (Lexer::isDigit (_text[_cursor + 0])) if (unicodeLatinDigit (_text[_cursor + 0]))
{ {
if (Lexer::isDigit (_text[_cursor + 1])) if (unicodeLatinDigit (_text[_cursor + 1]))
{ {
if (Lexer::isDigit (_text[_cursor + 2])) if (unicodeLatinDigit (_text[_cursor + 2]))
{ {
if (Lexer::isDigit (_text[_cursor + 3])) if (unicodeLatinDigit (_text[_cursor + 3]))
{ {
result = strtoimax (_text.substr (_cursor, 4).c_str (), NULL, 10); result = strtoimax (_text.substr (_cursor, 4).c_str (), NULL, 10);
_cursor += 4; _cursor += 4;
@ -212,7 +212,7 @@ bool Pig::getDigits (int& result)
auto prev = _cursor; auto prev = _cursor;
while ((c = utf8_next_char (_text, _cursor))) while ((c = utf8_next_char (_text, _cursor)))
{ {
if (! Lexer::isDigit (c)) if (! unicodeLatinDigit (c))
{ {
_cursor = prev; _cursor = prev;
break; break;
@ -287,11 +287,11 @@ bool Pig::getNumber (std::string& result)
// digit+ // digit+
if (_text[i] && if (_text[i] &&
Lexer::isDigit (_text[i])) unicodeLatinDigit (_text[i]))
{ {
++i; ++i;
while (_text[i] && Lexer::isDigit (_text[i])) while (_text[i] && unicodeLatinDigit (_text[i]))
++i; ++i;
// ( . digit+ )? // ( . digit+ )?
@ -299,7 +299,7 @@ bool Pig::getNumber (std::string& result)
{ {
++i; ++i;
while (_text[i] && Lexer::isDigit (_text[i])) while (_text[i] && unicodeLatinDigit (_text[i]))
++i; ++i;
} }
@ -315,11 +315,11 @@ bool Pig::getNumber (std::string& result)
_text[i] == '-')) _text[i] == '-'))
++i; ++i;
if (_text[i] && Lexer::isDigit (_text[i])) if (_text[i] && unicodeLatinDigit (_text[i]))
{ {
++i; ++i;
while (_text[i] && Lexer::isDigit (_text[i])) while (_text[i] && unicodeLatinDigit (_text[i]))
++i; ++i;
result = _text.substr (_cursor, i - _cursor); result = _text.substr (_cursor, i - _cursor);