m4-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: 26-gary-syntax-table-vs-peek-input-bug.patch


From: Gary V. Vaughan
Subject: FYI: 26-gary-syntax-table-vs-peek-input-bug.patch
Date: Tue, 15 Jul 2003 10:29:55 +0100
User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.3) Gecko/20030312


--
  ())_. Gary V. Vaughan     gary@(oranda.demon.co.uk|gnu.org)
  ( '/  Research Scientist  http://www.oranda.demon.co.uk       ,_())____
  / )=  GNU Hacker          http://www.gnu.org/software/libtool  \'      `&
`(_~)_  Tech' Author        http://sources.redhat.com/autobook   =`---d__/
Index: ChangeLog
from  Gary V. Vaughan  <address@hidden>
        * m4/input.c (CHAR_EOF, CHAR_BUILTIN, CHAR_RETRY): These token
        values are returned as part of the internal interface, so they
        need to be moved...
        * m4/private.h: ...to here.
        * m4/macro.c (expand_token): Check for out of range
        m4_peek_input() results before looking up in the syntax table.
        (collect_arguments): Ditto.

Index: m4/input.c
===================================================================
RCS file: /cvsroot/m4/m4/m4/input.c,v
retrieving revision 1.30
diff -u -p -u -r1.30 input.c
--- m4/input.c 27 Jun 2003 14:00:25 -0000 1.30
+++ m4/input.c 15 Jul 2003 09:22:46 -0000
@@ -170,9 +170,6 @@ static input_block *next;
 /* Flag for next_char () to increment m4_current_line.  */
 static boolean start_of_input_line;
 
-#define CHAR_EOF       256     /* character return on EOF */
-#define CHAR_BUILTIN   257     /* character return for BUILTIN token */
-#define CHAR_RETRY     258     /* character return for end of input block */
 
 
 
Index: m4/m4private.h
===================================================================
RCS file: /cvsroot/m4/m4/m4/m4private.h,v
retrieving revision 1.27
diff -u -p -u -r1.27 m4private.h
--- m4/m4private.h 9 Jul 2003 12:32:41 -0000 1.27
+++ m4/m4private.h 15 Jul 2003 09:22:48 -0000
@@ -186,6 +186,10 @@ extern void        m4__symtab_remove_module_ref
 
 /* --- SYNTAX TABLE MANAGEMENT --- */
 
+#define CHAR_EOF       256     /* character return on EOF */
+#define CHAR_BUILTIN   257     /* character return for BUILTIN token */
+#define CHAR_RETRY     258     /* character return for end of input block */
+
 #define DEF_LQUOTE "`"
 #define DEF_RQUOTE "\'"
 #define DEF_BCOMM "#"
Index: m4/macro.c
===================================================================
RCS file: /cvsroot/m4/m4/m4/macro.c,v
retrieving revision 1.32
diff -u -p -u -r1.32 macro.c
--- m4/macro.c 9 Jul 2003 12:32:41 -0000 1.32
+++ m4/macro.c 15 Jul 2003 09:22:51 -0000
@@ -78,6 +78,7 @@ expand_token (m4 *context, struct obstac
     case M4_TOKEN_WORD:
       {
        char *textp = text;
+       int ch;
 
        if (M4_IS_ESCAPE (M4SYNTAX, *textp))
          ++textp;
@@ -87,7 +88,8 @@ expand_token (m4 *context, struct obstac
            || symbol->value->type == M4_SYMBOL_VOID
            || (symbol->value->type == M4_SYMBOL_FUNC
                && BIT_TEST (SYMBOL_FLAGS (symbol), VALUE_BLIND_ARGS_BIT)
-               && !M4_IS_OPEN (M4SYNTAX, m4_peek_input (context))))
+               && (ch = m4_peek_input (context)) < CHAR_EOF
+               && !M4_IS_OPEN (M4SYNTAX, ch)))
          {
            m4_shipout_text (context, obs, text, strlen (text));
          }
@@ -270,7 +272,7 @@ collect_arguments (m4 *context, const ch
   obstack_grow (argptr, (void *) &tokenp, sizeof (tokenp));
 
   ch = m4_peek_input (context);
-  if (M4_IS_OPEN (M4SYNTAX, ch))
+  if ((ch < CHAR_EOF) && M4_IS_OPEN (M4SYNTAX, ch))
     {
       m4__next_token (context, &token);                /* gobble parenthesis */
       do

reply via email to

[Prev in Thread] Current Thread [Next in Thread]