[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: undefining YYRHSLOC in the GLR parser
From: |
Frank Heckenbach |
Subject: |
Re: undefining YYRHSLOC in the GLR parser |
Date: |
Wed, 5 Jan 2005 01:35:06 +0100 |
User-agent: |
semail 20041018 |
Paul Eggert wrote:
> Frank Heckenbach <address@hidden> writes:
>
> > [ problem due to undefining YYRHSLOC ]
> >
> > I wrote a test for it (below), though I could test it only manually,
> > because I don't have autom4te installed, so I hope the test suite
> > format is ok.
>
> Can you please remind me about this after the next official release
> is out? We can integrate the test then.
So here it is again.
--- tests/glr-regression.at.orig Wed Jun 4 07:53:44 2003
+++ tests/glr-regression.at Sun Dec 12 11:11:45 2004
@@ -218,3 +218,49 @@
AT_CLEANUP
+
+## --------------------------------------- ##
+## Inability to use YYRHSLOC in a function ##
+## --------------------------------------- ##
+
+AT_SETUP([Inability to use YYRHSLOC in a function])
+
+AT_DATA_GRAMMAR([glr-regr3.y],
+[[/* Regression Test: Inability to use YYRHSLOC in a function */
+/* Reported by Frank Heckenbach */
+
+%{
+ int yylex (void);
+ void yyerror (char const *);
+
+ typedef struct
+ {
+ int last_line, last_column;
+ } YYLTYPE;
+ #define YYLTYPE_IS_DECLARED
+
+ union yyGLRStackItem;
+
+ static void locations (YYLTYPE *, const union yyGLRStackItem *, int);
+ #define YYLLOC_DEFAULT(DEST, SRC, N) locations (&DEST, SRC, N)
+%}
+
+%glr-parser
+%locations
+
+%%
+exp: 'a';
+%%
+
+static void
+locations (YYLTYPE *dest, const union yyGLRStackItem *src, int n)
+{
+ dest->last_line = YYRHSLOC (src, n).last_line;
+ dest->last_column = YYRHSLOC (src, n).last_column;
+}
+
+]])
+
+AT_CHECK([[bison -o glr-regr3.c glr-regr3.y]], 0, [], [])
+AT_COMPILE([glr-regr3])
+AT_CLEANUP
Frank
--
Frank Heckenbach, address@hidden
http://fjf.gnu.de/
GnuPG and PGP keys: http://fjf.gnu.de/plan (7977168E)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: undefining YYRHSLOC in the GLR parser,
Frank Heckenbach <=