From baacae49710f69057b57bc8c731ba14899cf303c Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Mon, 10 May 2010 10:27:23 +0200 Subject: [PATCH] doc: fix lalr1.cc documentation. * doc/bison.texinfo (C++ Scanner Interface): Fix yylex signature. (C++ Bison Interface): Fix lalr1.cc skeleton name. (C++ Parser Interface): Fix semantic_type and location_type names. Document yy::parser::token. Reported by Jerry Quinn. (cherry picked from commit 0100cd629d91e3e799b9feb7182965ff348ba61c) Conflicts: doc/bison.texinfo --- ChangeLog | 9 +++++++++ THANKS | 1 + doc/bison.texinfo | 18 +++++++++++++----- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index aa2efc01..966b0050 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2010-05-10 Akim Demaille + + doc: fix lalr1.cc documentation. + * doc/bison.texinfo (C++ Scanner Interface): Fix yylex signature. + (C++ Bison Interface): Fix lalr1.cc skeleton name. + (C++ Parser Interface): Fix semantic_type and location_type names. + Document yy::parser::token. + Reported by Jerry Quinn. + 2010-05-04 Akim Demaille lalr1.cc: don't generate location.hh when location_type is defined diff --git a/THANKS b/THANKS index 6efa2efa..ae79e63d 100644 --- a/THANKS +++ b/THANKS @@ -44,6 +44,7 @@ Guido Trentalancia trentalg@aston.ac.uk H. Merijn Brand h.m.brand@hccnet.nl Hans Aberg haberg@matematik.su.se Jan Nieuwenhuizen janneke@gnu.org +Jerry Quinn jlquinn@optonline.net Jesse Thilo jthilo@gnu.org Jim Kent jkent@arch.sel.sony.com Jim Meyering jim@meyering.net diff --git a/doc/bison.texinfo b/doc/bison.texinfo index b6665318..5b24dc06 100644 --- a/doc/bison.texinfo +++ b/doc/bison.texinfo @@ -8329,8 +8329,8 @@ int yyparse (void); @c - initial action The C++ deterministic parser is selected using the skeleton directive, -@samp{%skeleton "lalr1.c"}, or the synonymous command-line option -@option{--skeleton=lalr1.c}. +@samp{%skeleton "lalr1.cc"}, or the synonymous command-line option +@option{--skeleton=lalr1.cc}. @xref{Decl Summary}. When run, @command{bison} will create several entities in the @samp{yy} @@ -8479,11 +8479,19 @@ this class is detailed below. It can be extended using the it describes an additional member of the parser class, and an additional argument for its constructor. -@defcv {Type} {parser} {semantic_value_type} -@defcvx {Type} {parser} {location_value_type} +@defcv {Type} {parser} {semantic_type} +@defcvx {Type} {parser} {location_type} The types for semantics value and locations. @end defcv +@defcv {Type} {parser} {token} +A structure that contains (only) the definition of the tokens as the +@code{yytokentype} enumeration. To refer to the token @code{FOO}, the +scanner should use @code{yy::parser::token::FOO}. The scanner can use +@samp{typedef yy::parser::token token;} to ``import'' the token enumeration +(@pxref{Calc++ Scanner}). +@end defcv + @deftypemethod {parser} {} parser (@var{type1} @var{arg1}, ...) Build a new parser object. There are no arguments by default, unless @samp{%parse-param @{@var{type1} @var{arg1}@}} was used. @@ -8522,7 +8530,7 @@ The parser invokes the scanner by calling @code{yylex}. Contrary to C parsers, C++ parsers are always pure: there is no point in using the @code{%define api.pure} directive. Therefore the interface is as follows. -@deftypemethod {parser} {int} yylex (semantic_value_type& @var{yylval}, location_type& @var{yylloc}, @var{type1} @var{arg1}, ...) +@deftypemethod {parser} {int} yylex (semantic_type* @var{yylval}, location_type* @var{yylloc}, @var{type1} @var{arg1}, ...) Return the next token. Its type is the return value, its semantic value and location being @var{yylval} and @var{yylloc}. Invocations of @samp{%lex-param @{@var{type1} @var{arg1}@}} yield additional arguments. -- 2.47.2