int bufpos;
int last_was_backslash;
+#undef APPEND
+#define APPEND(c) \
+ do \
+ { \
+ if (bufpos >= bufmax) \
+ { \
+ bufmax = 2 * bufmax + 10; \
+ buffer = xrealloc (buffer, bufmax); \
+ } \
+ buffer[bufpos++] = c; \
+ } \
+ while (0)
+
if (phase3_pushback_length)
{
*tp = phase3_pushback[--phase3_pushback_length];
bufpos = 0;
for (;;)
{
- if (bufpos >= bufmax)
- {
- bufmax = 2 * bufmax + 10;
- buffer = xrealloc (buffer, bufmax);
- }
- buffer[bufpos++] = c;
+ APPEND (c);
c = phase2_getc ();
switch (c)
{
}
break;
}
- if (bufpos >= bufmax)
- {
- bufmax = 2 * bufmax + 10;
- buffer = xrealloc (buffer, bufmax);
- }
- buffer[bufpos] = 0;
+ APPEND (0);
if (strcmp (buffer, "return") == 0)
tp->type = last_token_type = token_type_return;
else
bufpos = 0;
for (;;)
{
- if (bufpos >= bufmax)
- {
- bufmax = 2 * bufmax + 10;
- buffer = xrealloc (buffer, bufmax);
- }
- buffer[bufpos++] = c;
+ APPEND (c);
c = phase2_getc ();
switch (c)
{
case 'e':
case 'E':
- if (bufpos >= bufmax)
- {
- bufmax = 2 * bufmax + 10;
- buffer = xrealloc (buffer, bufmax);
- }
- buffer[bufpos++] = c;
+ APPEND (c);
c = phase2_getc ();
if (c != '+' && c != '-')
{
}
break;
}
- if (bufpos >= bufmax)
- {
- bufmax = 2 * bufmax + 10;
- buffer = xrealloc (buffer, bufmax);
- }
- buffer[bufpos] = 0;
+ APPEND (0);
tp->type = last_token_type = token_type_number;
return;
}
phase1_ungetc (c2);
}
- if (bufpos >= bufmax)
- {
- bufmax = 2 * bufmax + 10;
- buffer = xrealloc (buffer, bufmax);
- }
- buffer[bufpos++] = c;
+ APPEND (c);
}
}
else
if (last_was_backslash)
{
last_was_backslash = false;
- if (bufpos >= bufmax)
- {
- bufmax = 2 * bufmax + 10;
- buffer = xrealloc (buffer, bufmax);
- }
- buffer[bufpos++] = c;
+ APPEND (c);
continue;
}
last_was_backslash = true;
/* FALLTHROUGH */
default:
- if (bufpos >= bufmax)
- {
- bufmax = 2 * bufmax + 10;
- buffer = xrealloc (buffer, bufmax);
- }
- buffer[bufpos++] = c;
+ APPEND (c);
continue;
case '\n':
break;
}
}
- if (bufpos >= bufmax)
- {
- bufmax = 2 * bufmax + 10;
- buffer = xrealloc (buffer, bufmax);
- }
- buffer[bufpos] = 0;
+ APPEND (0);
tp->type = last_token_type = template
? token_type_string_template : token_type_string_literal;
tp->string = xstrdup (buffer);
return;
}
}
+#undef APPEND
}
static void