-void
-GetInt(JSONNode * node) {
- char intStr[16] = "";
- int intStrLen = 0;
-
- size_t * i = &node->data;
-
- int c;
- while ((c = GetChar()), (c != '\r') && (c != '\n')) {
- if ((c == 8 || c == 127) && intStrLen > 0) {
- intStrLen--;
- intStr[intStrLen] = '\0';
- *i /= 10;
- }
- else if (intStrLen < 16 - 1 && (c >= '0' && c <= '9')) {
- intStr[intStrLen++] = c;
- intStr[intStrLen] = '\0';
- *i *= 10;
- *i += c - '0';
- }
- }
-}
+typedef bool(*CharPredicateFunc)(char, int);
+
+bool predStr(char c, int i) { return c >= 'a' && c <= 'z'; }
+bool predInt(char c, int i) { return c >= '0' && c <= '9'; }