mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-16 15:53:03 +00:00
glr2.cc: example: style changes
* examples/c++/glr/c++-types.yy: We need C++ 11 (we use shared_ptr).
This commit is contained in:
@@ -26,7 +26,7 @@
|
|||||||
%locations
|
%locations
|
||||||
%debug
|
%debug
|
||||||
|
|
||||||
/* Nice error messages with details. */
|
// Nice error messages with details.
|
||||||
%define parse.error detailed
|
%define parse.error detailed
|
||||||
|
|
||||||
%code requires
|
%code requires
|
||||||
@@ -43,10 +43,6 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#if __cplusplus < 201103L
|
|
||||||
# define nullptr 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static Node
|
static Node
|
||||||
stmtMerge (const Node& x0, const Node& x1);
|
stmtMerge (const Node& x0, const Node& x1);
|
||||||
|
|
||||||
@@ -97,7 +93,7 @@ declarator
|
|||||||
%%
|
%%
|
||||||
std::istream* input = nullptr;
|
std::istream* input = nullptr;
|
||||||
|
|
||||||
/* A C error reporting function. */
|
// An error reporting function.
|
||||||
void
|
void
|
||||||
yy::parser::error (const location_type& l, const std::string& m)
|
yy::parser::error (const location_type& l, const std::string& m)
|
||||||
{
|
{
|
||||||
@@ -110,11 +106,10 @@ yylex (yy::parser::value_type* lvalp, yy::parser::location_type* llocp)
|
|||||||
static int lineNum = 1;
|
static int lineNum = 1;
|
||||||
static int colNum = 0;
|
static int colNum = 0;
|
||||||
|
|
||||||
while (1)
|
while (true)
|
||||||
{
|
{
|
||||||
assert (!input->eof ());
|
assert (!input->eof ());
|
||||||
int c = input->get ();
|
switch (int c = input->get ())
|
||||||
switch (c)
|
|
||||||
{
|
{
|
||||||
case EOF:
|
case EOF:
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user