+2003-12-14 Bruno Haible <bruno@clisp.org>
+
+ * x-c.c (phase1_pushback): Reduce size to 2.
+ (phase2_pushback): Reduce size to 1.
+ (phase3_pushback): Reduce size to 2.
+ (phase5_pushback): Reduce size to 1.
+ (phase6_pushback): Reduce size to 2.
+ * x-java.c (phase2_pushback): Reduce size to 1.
+ (phase3_pushback): Reduce size to 2.
+ (phase5_pushback): Reduce size to 3.
+ (phase6_pushback): Reduce size to 2.
+ * x-php.c (phase1_pushback): Reduce size to 2.
+ * x-python.c (max): New macro.
+ (phase1_pushback): Reduce size to UNINAME_MAX + 3.
+ (phase5_pushback): Reduce size to 1.
+ * x-sh.c (phase1_pushback): Reduce size to 1.
+ (phase2_pushback): Reduce size to 2.
+ * x-smalltalk.c (phase2_pushback): Reduce size to 1.
+ * x-tcl.c (phase1_pushback): Reduce size to 1.
+ (phase2_pushback): Reduce size to 2.
+
2003-12-12 Bruno Haible <bruno@clisp.org>
Assume automake-1.8.
return c;
}
+/* Supports only one pushback character. */
static void
phase1_ungetc (int c)
{
return c;
}
+/* Supports only one pushback character. */
static void
phase2_ungetc (int c)
{
}
-/* Only one pushback character supported, and not '\n'. */
+/* Supports only one pushback character, and not '\n'. */
static inline void
phase0_ungetc (int c)
{
}
-/* 1. line_number handling. Combine backslash-newline to nothing.
- Cope with potentially 2 characters of pushback, not just the one that
- ungetc can cope with. */
+/* 1. line_number handling. Combine backslash-newline to nothing. */
-/* Maximum used guaranteed to be < 4. */
-static unsigned char phase1_pushback[4];
+static unsigned char phase1_pushback[2];
static int phase1_pushback_length;
}
+/* Supports 2 characters of pushback. */
static void
phase1_ungetc (int c)
{
sane human beings vomit copiously at the mention of trigraphs, which
is why they are an option. */
-/* Maximum used guaranteed to be < 4. */
-static unsigned char phase2_pushback[4];
+static unsigned char phase2_pushback[1];
static int phase2_pushback_length;
}
+/* Supports only one pushback character. */
static void
phase2_ungetc (int c)
{
line. Basically, all you need to do is elide "\\\n" sequences from
the input. */
-/* Maximum used guaranteed to be < 4. */
-static unsigned char phase3_pushback[4];
+static unsigned char phase3_pushback[2];
static int phase3_pushback_length;
}
+/* Supports 2 characters of pushback. */
static void
phase3_ungetc (int c)
{
}
+/* Supports only one pushback character. */
static void
phase4_ungetc (int c)
{
/* 5. Parse each resulting logical line as preprocessing tokens and
white space. Preprocessing tokens and C tokens don't always match. */
-/* Maximum used guaranteed to be < 4. */
-static token_ty phase5_pushback[4];
+static token_ty phase5_pushback[1];
static int phase5_pushback_length;
}
+/* Supports only one pushback token. */
static void
phase5_unget (token_ty *tp)
{
we care about are the #line and #define directive. We throw all the
others away. */
-/* Maximum used guaranteed to be < 4. */
-static token_ty phase6_pushback[4];
+static token_ty phase6_pushback[2];
static int phase6_pushback_length;
}
+/* Supports 2 tokens of pushback. */
static void
phase6_unget (token_ty *tp)
{
}
}
+/* Supports 2 tokens of pushback. */
static inline void
phase8a_unget (token_ty *tp)
{
}
}
+/* Supports 2 tokens of pushback. */
static inline void
phase8b_unget (token_ty *tp)
{
*tp = tmp;
}
+/* Supports only one pushback token. */
static inline void
phase8c_unget (token_ty *tp)
{
return c;
}
+/* Supports any number of 'u' and up to 4 arbitrary characters of pushback. */
static void
phase1_ungetc (int c)
{
/* Fetch the next single-byte character or Unicode character from the file.
(Here, as in the Java Language Specification, when we say "Unicode
- character", we actually mean "UTF-16 encoding unit".)
- Cope with potentially 2 pushback characters. */
+ character", we actually mean "UTF-16 encoding unit".) */
/* Return value of phase 2, 3, 4 when EOF is reached. */
#define P2_EOF 0xffff
(RED (c) == 'x') is equivalent to (c == 'x' || c == UNICODE ('x')). */
#define RED(p2_result) ((p2_result) & 0xffff)
-/* Maximum used guaranteed to be < 2. */
-static int phase2_pushback[2];
+static int phase2_pushback[1];
static int phase2_pushback_length;
static int
return c;
}
+/* Supports only one pushback character. */
static void
phase2_ungetc (int c)
{
/* Fetch the next single-byte character or Unicode character from the file.
With line number handling.
- Convert line terminators to '\n' or UNICODE ('\n').
- Cope with potentially 2 pushback characters. */
+ Convert line terminators to '\n' or UNICODE ('\n'). */
-/* Maximum used guaranteed to be < 2. */
static int phase3_pushback[2];
static int phase3_pushback_length;
return c;
}
+/* Supports 2 characters of pushback. */
static void
phase3_ungetc (int c)
{
}
}
+/* Supports only one pushback character. */
static void
phase4_ungetc (int c)
{
/* Combine characters into tokens. Discard whitespace. */
-/* Maximum used guaranteed to be < 4. */
-static token_ty phase5_pushback[4];
+static token_ty phase5_pushback[3];
static int phase5_pushback_length;
static void
}
}
+/* Supports 3 tokens of pushback. */
static void
phase5_unget (token_ty *tp)
{
- the token after this expression is not '.' (because then the last
string could be part of a method call expression). */
-/* Maximum used guaranteed to be < 4. */
-static token_ty phase6_pushback[4];
+static token_ty phase6_pushback[2];
static int phase6_pushback_length;
static token_type_ty phase6_last;
phase6_last = tp->type;
}
+/* Supports 2 tokens of pushback. */
static void
phase6_unget (token_ty *tp)
{
phase6_get (tp);
}
+/* Supports 2 tokens of pushback. */
static void
x_java_unlex (token_ty *tp)
{
xgettext_record_flag ("gettext_noop:1:pass-perl-brace-format");
xgettext_record_flag ("printf:1:perl-format"); /* argument 1 or 2 ?? */
xgettext_record_flag ("sprintf:1:perl-format");
-#if 0
+#if 0
xgettext_record_flag ("__:1:pass-perl-format");
xgettext_record_flag ("__:1:pass-perl-brace-format");
xgettext_record_flag ("%__:1:pass-perl-format");
return linebuf[linepos++];
}
+/* Supports only one pushback character. */
static void
phase1_ungetc (int c)
{
return c;
}
+/* Supports only one pushback character. */
static void
phase2_ungetc (int c)
{
/* 1. line_number handling. */
-/* Maximum used guaranteed to be < 4. */
-static unsigned char phase1_pushback[4];
+static unsigned char phase1_pushback[2];
static int phase1_pushback_length;
static int
return c;
}
+/* Supports 2 characters of pushback. */
static void
phase1_ungetc (int c)
{
#include "gettext.h"
#define _(s) gettext(s)
+#define max(a,b) ((a) > (b) ? (a) : (b))
/* The Python syntax is defined in the Python Reference Manual
static FILE *fp;
-/* 1. line_number handling. Also allow a lookahead of 9 characters. */
+/* 1. line_number handling. Also allow a lookahead. */
-/* Maximum used guaranteed to be < UNINAME_MAX + 4. */
-static unsigned char phase1_pushback[UNINAME_MAX + 4];
+static unsigned char phase1_pushback[max (9, UNINAME_MAX + 3)];
static int phase1_pushback_length;
static int
return c;
}
+/* Supports max (9, UNINAME_MAX + 3) characters of pushback. */
static void
phase1_ungetc (int c)
{
}
}
+/* Supports only one pushback character. */
static void
phase2_ungetc (int c)
{
/* Number of pending open parentheses/braces/brackets. */
static int open_pbb;
-/* Maximum used guaranteed to be < 2. */
-static token_ty phase5_pushback[2];
+static token_ty phase5_pushback[1];
static int phase5_pushback_length;
static void
}
}
+/* Supports only one pushback token. */
static void
phase5_unget (token_ty *tp)
{
}
-/* Remove backslash followed by newline from the input stream.
- Cope with potentially 2 characters of pushback. */
+/* Remove backslash followed by newline from the input stream. */
-/* Maximum used guaranteed to be < 4. */
-static int phase1_pushback[4];
+static int phase1_pushback[1];
static int phase1_pushback_length;
static int
}
}
+/* Supports only one pushback character. */
static void
phase1_ungetc (int c)
{
#define OPENING_BACKQUOTE (2 * (UCHAR_MAX + 1) + '`')
#define CLOSING_BACKQUOTE (3 * (UCHAR_MAX + 1) + '`')
-/* Maximum used guaranteed to be < 4. */
-static int phase2_pushback[4];
+static int phase2_pushback[2];
static int phase2_pushback_length;
-/* Forward declaration of local functions. */
-static void phase2_ungetc (int c);
-
/* Return the next character, with backslashes removed.
The result is QUOTED(c) for some unsigned char c, if the next character
is escaped sufficiently often to make it a regular constituent character,
return (open_singlequote || open_doublequote ? QUOTED (c) : c);
}
+/* Supports 2 characters of pushback. */
static void
phase2_ungetc (int c)
{
return c;
}
+/* Supports only one pushback character. */
static void
phase1_ungetc (int c)
{
/* 2. Combine characters into tokens. Discard comments and whitespace. */
-/* Maximum used guaranteed to be < 2. */
-static token_ty phase2_pushback[2];
+static token_ty phase2_pushback[1];
static int phase2_pushback_length;
static void
}
}
+/* Supports only one pushback token. */
static void
phase2_unget (token_ty *tp)
{
/* Combine backslash followed by newline and additional whitespace to
- a single space. Cope with potentially 2 characters of pushback. */
+ a single space. */
/* An int that becomes a space when casted to 'unsigned char'. */
#define BS_NL (UCHAR_MAX + 1 + ' ')
-/* Maximum used guaranteed to be < 4. */
-static int phase1_pushback[4];
+static int phase1_pushback[1];
static int phase1_pushback_length;
static int
return BS_NL;
}
+/* Supports only one pushback character. */
static void
phase1_ungetc (int c)
{
/* An int that becomes a closing brace when casted to 'unsigned char'. */
#define CL_BRACE (UCHAR_MAX + 1 + '}')
-/* Maximum used guaranteed to be < 4. */
-static int phase2_pushback[4];
+static int phase2_pushback[2];
static int phase2_pushback_length;
/* Brace nesting depth inside the current character group. */
return c;
}
+/* Supports 2 characters of pushback. */
static void
phase2_ungetc (int c)
{
flag_context_ty outer_context);
/* Accumulate tokens into the given word.
- 'looking_for' denotes a parse terminator combination. */
+ 'looking_for' denotes a parse terminator combination.
+ Return the first character past the token. */
static int
accumulate_word (struct word *wp, enum terminator looking_for,
flag_context_ty context)
return c;
}
+/* Supports only one pushback character. */
static void
phase1_ungetc (int c)
{
return c;
}
+/* Supports only one pushback character. */
static void
phase2_ungetc (int c)
{