* data/bison.c++: s/b4_item_number_max/b4_rhs_number_max/.

Adding #line.
Remove the duplicate `typedefs'.
(RhsNumberType): Fix the declaration and various other typos.
Use __ofile__.
* data/bison.simple: Use __ofile__.
* src/scan-skel.l: Handle __ofile__.
This commit is contained in:
Akim Demaille
2002-04-08 12:31:15 +00:00
parent 62a3e4f0c5
commit 06446ccf94
4 changed files with 27 additions and 9 deletions

View File

@@ -1,3 +1,13 @@
2002-04-08 Akim Demaille <akim@epita.fr>
* data/bison.c++: s/b4_item_number_max/b4_rhs_number_max/.
Adding #line.
Remove the duplicate `typedefs'.
(RhsNumberType): Fix the declaration and various other typos.
Use __ofile__.
* data/bison.simple: Use __ofile__.
* src/scan-skel.l: Handle __ofile__.
2002-04-08 Akim Demaille <akim@epita.fr> 2002-04-08 Akim Demaille <akim@epita.fr>
* src/gram.h (item_number_t): New, the type of item numbers in * src/gram.h (item_number_t): New, the type of item numbers in

View File

@@ -137,6 +137,7 @@ yystype;
# define YYSTYPE yystype # define YYSTYPE yystype
#endif #endif
#line __oline__ "__ofile__"
#ifndef YYLLOC_DEFAULT #ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N) \ # define YYLLOC_DEFAULT(Current, Rhs, N) \
Current.last_line = Rhs[[N]].last_line; \ Current.last_line = Rhs[[N]].last_line; \
@@ -167,8 +168,8 @@ namespace yy
template < > template < >
struct Traits< b4_name > struct Traits< b4_name >
{ {
typedef typedef b4_uint_type(b4_token_number_max) TokenNumberType; typedef b4_uint_type(b4_token_number_max) TokenNumberType;
typedef typedef b4_sint_type(b4_item_number_max) RhsNumberType; typedef b4_sint_type(b4_rhs_number_max) RhsNumberType;
typedef int StateType; typedef int StateType;
typedef yystype SemanticType; typedef yystype SemanticType;
typedef b4_ltype LocationType; typedef b4_ltype LocationType;
@@ -182,7 +183,7 @@ namespace yy
public: public:
typedef Traits< b4_name >::TokenNumberType TokenNumberType; typedef Traits< b4_name >::TokenNumberType TokenNumberType;
typedef Traits< b4_name >::RhsNumberType TokenNumberType; typedef Traits< b4_name >::RhsNumberType RhsNumberType;
typedef Traits< b4_name >::StateType StateType; typedef Traits< b4_name >::StateType StateType;
typedef Traits< b4_name >::SemanticType SemanticType; typedef Traits< b4_name >::SemanticType SemanticType;
typedef Traits< b4_name >::LocationType LocationType; typedef Traits< b4_name >::LocationType LocationType;
@@ -236,7 +237,7 @@ namespace yy
/* More tables, for debugging. */ /* More tables, for debugging. */
#if YYDEBUG #if YYDEBUG
static const short rhs_[[]]; static const RhsNumberType rhs_[[]];
static const short prhs_[[]]; static const short prhs_[[]];
static const short rline_[[]]; static const short rline_[[]];
#endif #endif
@@ -459,6 +460,9 @@ yy::b4_name::parse ()
} }
} }
/* Line __line__ of __file__. */
#line __oline__ "__ofile__"
state_stack_.pop (len_); state_stack_.pop (len_);
semantic_stack_.pop (len_); semantic_stack_.pop (len_);
location_stack_.pop (len_); location_stack_.pop (len_);
@@ -686,7 +690,7 @@ const yy::b4_name::name_[[]] =
#if YYDEBUG #if YYDEBUG
/* YYRHS -- A `-1'-separated list of the rules' RHS. */ /* YYRHS -- A `-1'-separated list of the rules' RHS. */
const RhsNumberType const yy::b4_name::RhsNumberType
yy::b4_name::rhs_[[]] = yy::b4_name::rhs_[[]] =
{ {
b4_rhs b4_rhs
@@ -709,7 +713,7 @@ yy::b4_name::rline_[[]] =
#endif #endif
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
TokenNumberType yy::b4_name::TokenNumberType
yy::b4_name::translate_ (int token) yy::b4_name::translate_ (int token)
{ {
static static

View File

@@ -149,7 +149,7 @@ typedef struct yyltype
#endif #endif
/* Line __line__ of __file__. */ /* Line __line__ of __file__. */
#line __oline__ #line __oline__ "__ofile__"
/* All symbols defined below should begin with yy or YY, to avoid /* All symbols defined below should begin with yy or YY, to avoid
infringing on user name space. This should be done even for local infringing on user name space. This should be done even for local
@@ -936,7 +936,7 @@ yyreduce:
} }
/* Line __line__ of __file__. */ /* Line __line__ of __file__. */
#line __oline__ #line __oline__ "__ofile__"
[ yyvsp -= yylen; [ yyvsp -= yylen;
yyssp -= yylen; yyssp -= yylen;

View File

@@ -26,16 +26,20 @@
#include "files.h" #include "files.h"
int skel_lex PARAMS ((void)); int skel_lex PARAMS ((void));
static int yylineno = 1; static int yylineno = 1;
static char *yyoutname = NULL;
%} %}
%% %%
/* This is an approximation, but we don't need more. */ /* This is an approximation, but we don't need more. */
^"#output \""[^\"]+\"\n { ^"#output \""[^\"]+\"\n {
yytext[yyleng - 2] = '\0'; yytext[yyleng - 2] = '\0';
skel_out = xfopen (yytext + strlen ("#output \""), "w"); XFREE (yyoutname);
yyoutname = xstrdup (yytext + strlen ("#output \""));
yyout = xfopen (yyoutname, "w");
yylineno = 1; yylineno = 1;
} }
"__oline__" fprintf (yyout, "%d", yylineno); "__oline__" fprintf (yyout, "%d", yylineno);
"__ofile__" fprintf (yyout, "%s", yyoutname);
[^_\n]+ ECHO; [^_\n]+ ECHO;
\n+ yylineno += yyleng; ECHO; \n+ yylineno += yyleng; ECHO;
. ECHO; . ECHO;