forked from GitHub/gf-core
Define custom isdigit version. The expression parser now uses the custom isspace and isdigit
This commit is contained in:
@@ -435,7 +435,7 @@ void PgfExprParser::token()
|
|||||||
token_pos = pos;
|
token_pos = pos;
|
||||||
token_value = NULL;
|
token_value = NULL;
|
||||||
|
|
||||||
while (isspace(ch)) {
|
while (pgf_utf8_is_space(ch)) {
|
||||||
token_pos = pos;
|
token_pos = pos;
|
||||||
if (!getc()) {
|
if (!getc()) {
|
||||||
token_tag = PGF_TOKEN_EOF;
|
token_tag = PGF_TOKEN_EOF;
|
||||||
@@ -481,7 +481,7 @@ void PgfExprParser::token()
|
|||||||
if (ch == '>') {
|
if (ch == '>') {
|
||||||
getc();
|
getc();
|
||||||
token_tag = PGF_TOKEN_RARROW;
|
token_tag = PGF_TOKEN_RARROW;
|
||||||
} else if (isdigit(ch)) {
|
} else if (pgf_utf8_is_digit(ch)) {
|
||||||
putc('-');
|
putc('-');
|
||||||
goto digit;
|
goto digit;
|
||||||
}
|
}
|
||||||
@@ -548,18 +548,18 @@ void PgfExprParser::token()
|
|||||||
token_tag = PGF_TOKEN_WILD;
|
token_tag = PGF_TOKEN_WILD;
|
||||||
else
|
else
|
||||||
token_tag = PGF_TOKEN_IDENT;
|
token_tag = PGF_TOKEN_IDENT;
|
||||||
} else if (isdigit(ch)) {
|
} else if (pgf_utf8_is_digit(ch)) {
|
||||||
digit:
|
digit:
|
||||||
do {
|
do {
|
||||||
putc(ch);
|
putc(ch);
|
||||||
if (!getc())
|
if (!getc())
|
||||||
break;
|
break;
|
||||||
} while (isdigit(ch));
|
} while (pgf_utf8_is_digit(ch));
|
||||||
|
|
||||||
if (ch == '.') {
|
if (ch == '.') {
|
||||||
putc(ch);
|
putc(ch);
|
||||||
if (getc()) {
|
if (getc()) {
|
||||||
while (isdigit(ch)) {
|
while (pgf_utf8_is_digit(ch)) {
|
||||||
putc(ch);
|
putc(ch);
|
||||||
if (!getc())
|
if (!getc())
|
||||||
break;
|
break;
|
||||||
@@ -577,7 +577,7 @@ digit:
|
|||||||
|
|
||||||
bool PgfExprParser::lookahead(int ch)
|
bool PgfExprParser::lookahead(int ch)
|
||||||
{
|
{
|
||||||
while (isspace(this->ch)) {
|
while (pgf_utf8_is_space(this->ch)) {
|
||||||
if (!getc())
|
if (!getc())
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -324,3 +324,9 @@ bool pgf_utf8_is_space(uint32_t c)
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PGF_INTERNAL
|
||||||
|
bool pgf_utf8_is_digit(uint32_t c)
|
||||||
|
{
|
||||||
|
return (c >= '0' && c <= '9');
|
||||||
|
}
|
||||||
|
|||||||
@@ -38,4 +38,7 @@ uint32_t pgf_utf8_to_upper(uint32_t c);
|
|||||||
PGF_INTERNAL_DECL
|
PGF_INTERNAL_DECL
|
||||||
bool pgf_utf8_is_space(uint32_t c);
|
bool pgf_utf8_is_space(uint32_t c);
|
||||||
|
|
||||||
|
PGF_INTERNAL
|
||||||
|
bool pgf_utf8_is_digit(uint32_t c);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user