+2000-08-23 Bruno Haible <haible@clisp.cons.org>
+
+ * po-lex.c (ALERT_CHAR): New constant macro.
+ (control_sequence): Accept \a. Don't accept \X.
+
2000-08-23 Ulrich Drepper <drepper@redhat.com>
* po-lex.c (control_sequence): Unget character which ended \x..
#include "error.h"
#include "po-gram-gen2.h"
+#if HAVE_C_BACKSLASH_A
+# define ALERT_CHAR '\a'
+#else
+# define ALERT_CHAR '\7'
+#endif
+
static FILE *fp;
lex_pos_ty gram_pos;
case 'v':
return '\v';
+ case 'a':
+ return ALERT_CHAR;
+
case '\\':
case '"':
return c;
case '0': case '1': case '2': case '3':
case '4': case '5': case '6': case '7':
val = 0;
- for (max = 0; max < 3; ++max)
+ max = 0;
+ for (;;)
{
/* Warning: not portable, can't depend on '0'..'7' ordering. */
- val = val * 8 + c - '0';
+ val = val * 8 + (c - '0');
+ if (++max == 3)
+ break;
c = lex_getc ();
switch (c)
{
default:
break;
}
+ lex_ungetc (c);
break;
}
- lex_ungetc (c);
return val;
- case 'x': case 'X':
+ case 'x':
c = lex_getc ();
if (c == EOF || !isxdigit (c))
break;
default:
break;
}
+ lex_ungetc (c);
break;
}
- lex_ungetc (c);
return val;
+
+ /* FIXME: \u and \U are not handled. */
}
po_gram_error (_("invalid control sequence"));
return ' ';
}
buf[bufpos] = 0;
+ /* FIXME: Treatment of embedded \000 chars is incorrect. */
po_gram_lval.string = xstrdup (buf);
return STRING;