[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Changes to m4/src/Attic/input.c,v [branch-1_4]
From: |
Eric Blake |
Subject: |
Changes to m4/src/Attic/input.c,v [branch-1_4] |
Date: |
Fri, 25 May 2007 17:27:39 +0000 |
CVSROOT: /sources/m4
Module name: m4
Branch: branch-1_4
Changes by: Eric Blake <ericb> 07/05/25 17:27:37
Index: src/input.c
===================================================================
RCS file: /sources/m4/m4/src/Attic/input.c,v
retrieving revision 1.1.1.1.2.34
retrieving revision 1.1.1.1.2.35
diff -u -b -r1.1.1.1.2.34 -r1.1.1.1.2.35
--- src/input.c 5 Feb 2007 13:43:36 -0000 1.1.1.1.2.34
+++ src/input.c 25 May 2007 17:27:37 -0000 1.1.1.1.2.35
@@ -808,22 +808,23 @@
#endif /* ENABLE_CHANGEWORD */
-/*-------------------------------------------------------------------------.
-| Parse and return a single token from the input stream. A token can |
-| either be TOKEN_EOF, if the input_stack is empty; it can be TOKEN_STRING |
-| for a quoted string; TOKEN_WORD for something that is a potential macro |
-| name; and TOKEN_SIMPLE for any single character that is not a part of
|
-| any of the previous types. |
+/*--------------------------------------------------------------------.
+| Parse and return a single token from the input stream. A token |
+| can either be TOKEN_EOF, if the input_stack is empty; it can be |
+| TOKEN_STRING for a quoted string; TOKEN_WORD for something that is |
+| a potential macro name; and TOKEN_SIMPLE for any single character |
+| that is not a part of any of the previous types. If LINE is not |
+| NULL, set *LINE to the line where the token starts. |
| |
-| Next_token () return the token type, and passes back a pointer to the
|
-| token data through TD. The token text is collected on the obstack |
-| token_stack, which never contains more than one token text at a time.
|
-| The storage pointed to by the fields in TD is therefore subject to |
-| change the next time next_token () is called.
|
-`-------------------------------------------------------------------------*/
+| Next_token () return the token type, and passes back a pointer to |
+| the token data through TD. The token text is collected on the |
+| obstack token_stack, which never contains more than one token text |
+| at a time. The storage pointed to by the fields in TD is |
+| therefore subject to change the next time next_token () is called. |
+`--------------------------------------------------------------------*/
token_type
-next_token (token_data *td)
+next_token (token_data *td, int *line)
{
int ch;
int quote_level;
@@ -833,9 +834,11 @@
char *orig_text = NULL;
#endif
const char *file;
- int line;
+ int dummy;
obstack_free (&token_stack, token_bottom);
+ if (!line)
+ line = &dummy;
/* Can't consume character until after CHAR_MACRO is handled. */
ch = peek_input ();
@@ -860,7 +863,7 @@
next_char (); /* Consume character we already peeked at. */
file = current_file;
- line = current_line;
+ *line = current_line;
if (MATCH (ch, bcomm.string, true))
{
obstack_grow (&token_stack, bcomm.string, bcomm.length);
@@ -872,7 +875,7 @@
else
/* current_file changed to "" if we see CHAR_EOF, use the
previous value we stored earlier. */
- M4ERROR_AT_LINE ((EXIT_FAILURE, 0, file, line,
+ M4ERROR_AT_LINE ((EXIT_FAILURE, 0, file, *line,
"ERROR: end of file in comment"));
type = TOKEN_STRING;
@@ -955,7 +958,7 @@
if (ch == CHAR_EOF)
/* current_file changed to "" if we see CHAR_EOF, use
the previous value we stored earlier. */
- M4ERROR_AT_LINE ((EXIT_FAILURE, 0, file, line,
+ M4ERROR_AT_LINE ((EXIT_FAILURE, 0, file, *line,
"ERROR: end of file in string"));
if (MATCH (ch, rquote.string, true))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Changes to m4/src/Attic/input.c,v [branch-1_4],
Eric Blake <=