[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] scan-gram.l: for flex-2.5.31: move unput call into body
From: |
Peter Muir |
Subject: |
[PATCH] scan-gram.l: for flex-2.5.31: move unput call into body |
Date: |
Wed, 16 Apr 2003 20:08:33 -0400 |
I was just checking out the latest bison
source and I couldn't get it to compile with
flex 2.5.31. I thought it might be something
with flex, but the debian maintainer for
flex says the behaviour of flex is correct
(and suggested to move the function inside
%{...%}).
Cheers
Index: src/scan-gram.l
===================================================================
RCS file: /cvsroot/bison/bison/src/scan-gram.l,v
retrieving revision 1.58
diff -u -r1.58 scan-gram.l
--- src/scan-gram.l 13 Mar 2003 07:07:17 -0000 1.58
+++ src/scan-gram.l 17 Apr 2003 00:03:37 -0000
@@ -147,6 +147,31 @@
/* Where containing comment or string or character literal started,
when applicable. */
boundary token_start IF_LINT (= scanner_cursor);
+
+/*------------------------------------------------------------------------.
+| Report an unexpected EOF in a token or comment starting at START. |
+| An end of file was encountered and the expected TOKEN_END was missing. |
+| After reporting the problem, pretend that TOKEN_END was found. |
+`------------------------------------------------------------------------*/
+
+static void
+unexpected_end_of_file (boundary start, char const *token_end)
+{
+ size_t i = strlen (token_end);
+
+ location loc;
+ loc.start = start;
+ loc.end = scanner_cursor;
+ complain_at (loc, _("missing `%s' at end of file"), token_end);
+
+ /* Adjust scanner cursor so that any later message does not count
+ the characters about to be inserted. */
+ scanner_cursor.column -= i;
+
+ while (i != 0)
+ unput (token_end[--i]);
+}
+
%}
@@ -967,30 +992,6 @@
scanner_cursor.column = 1;
}
-
-/*------------------------------------------------------------------------.
-| Report an unexpected EOF in a token or comment starting at START. |
-| An end of file was encountered and the expected TOKEN_END was missing. |
-| After reporting the problem, pretend that TOKEN_END was found. |
-`------------------------------------------------------------------------*/
-
-static void
-unexpected_end_of_file (boundary start, char const *token_end)
-{
- size_t i = strlen (token_end);
-
- location loc;
- loc.start = start;
- loc.end = scanner_cursor;
- complain_at (loc, _("missing `%s' at end of file"), token_end);
-
- /* Adjust scanner cursor so that any later message does not count
- the characters about to be inserted. */
- scanner_cursor.column -= i;
-
- while (i != 0)
- unput (token_end[--i]);
-}
/*-------------------------.
--
Peter Muir
- [PATCH] scan-gram.l: for flex-2.5.31: move unput call into body,
Peter Muir <=