/[m4]/m4/m4/macro.c
ViewVC logotype

Diff of /m4/m4/macro.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.20 by akim, Sat Oct 13 08:56:48 2001 UTC revision 1.21 by akim, Fri Oct 19 09:43:51 2001 UTC
# Line 1  Line 1 
1  /* GNU m4 -- A simple macro processor  /* GNU m4 -- A simple macro processor
2     Copyright 1989, 90, 91, 92, 93, 94 Free Software Foundation, Inc.     Copyright 1989, 1990, 1991, 1992, 1993, 1994, 2001
3       Free Software Foundation, Inc.
4    
5     This program is free software; you can redistribute it and/or modify     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by     it under the terms of the GNU General Public License as published by
# Line 110  expand_argument (struct obstack *obs, m4 Line 111  expand_argument (struct obstack *obs, m4
111    m4_token_t t;    m4_token_t t;
112    m4_token td;    m4_token td;
113    char *text;    char *text;
114    int paren_level;    int paren_level = 0;
115      const char *current_file = m4_current_file;
116      int current_line = m4_current_line;
117    
118    TOKEN_TYPE (argp) = M4_TOKEN_VOID;    TOKEN_TYPE (argp) = M4_TOKEN_VOID;
119    
# Line 121  expand_argument (struct obstack *obs, m4 Line 124  expand_argument (struct obstack *obs, m4
124      }      }
125    while (t == M4_TOKEN_SPACE);    while (t == M4_TOKEN_SPACE);
126    
   paren_level = 0;  
   
127    while (1)    while (1)
128      {      {
   
129        switch (t)        switch (t)
130          {                       /* TOKSW */          {                       /* TOKSW */
131          case M4_TOKEN_SIMPLE:          case M4_TOKEN_SIMPLE:
132            text = TOKEN_TEXT (&td);            text = TOKEN_TEXT (&td);
133            if ((M4_IS_COMMA(*text) || M4_IS_CLOSE(*text)) && paren_level == 0)            if ((M4_IS_COMMA (*text) || M4_IS_CLOSE (*text)) && paren_level == 0)
134              {              {
135    
136                /* The argument MUST be finished, whether we want it or not.  */                /* The argument MUST be finished, whether we want it or not.  */
# Line 142  expand_argument (struct obstack *obs, m4 Line 142  expand_argument (struct obstack *obs, m4
142                    TOKEN_TYPE (argp) = M4_TOKEN_TEXT;                    TOKEN_TYPE (argp) = M4_TOKEN_TEXT;
143                    TOKEN_TEXT (argp) = text;                    TOKEN_TEXT (argp) = text;
144                  }                  }
145                return (boolean) (M4_IS_COMMA(*TOKEN_TEXT (&td)));                return (boolean) (M4_IS_COMMA (*TOKEN_TEXT (&td)));
146              }              }
147    
148            if (M4_IS_OPEN(*text))            if (M4_IS_OPEN (*text))
149              paren_level++;              paren_level++;
150            else if (M4_IS_CLOSE(*text))            else if (M4_IS_CLOSE (*text))
151              paren_level--;              paren_level--;
152            expand_token (obs, t, &td);            expand_token (obs, t, &td);
153            break;            break;
154    
155          case M4_TOKEN_EOF:          case M4_TOKEN_EOF:
156            M4ERROR ((EXIT_FAILURE, 0,            error_at_line (EXIT_FAILURE, 0, current_file, current_line,
157                      _("ERROR: EOF in argument list")));                           _("EOF in argument list"));
158            break;            break;
159    
160          case M4_TOKEN_WORD:          case M4_TOKEN_WORD:

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.21

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26