summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2021-01-10 07:50:07 +0100
committerAkim Demaille <akim.demaille@gmail.com>2021-01-10 17:04:04 +0100
commit47612d987b6bee697a4e998f2e906bab8e8c2f9e (patch)
tree3bb4a1b3dcaccec2e20cf937dc6b98b75974778b /examples
parent3a98be5284a0f90f35c7920577879acc0b46b8ad (diff)
downloadbison-47612d987b6bee697a4e998f2e906bab8e8c2f9e.tar.gz
glr2.cc: example: style changes
* examples/c++/glr/c++-types.yy: We need C++ 11 (we use shared_ptr).
Diffstat (limited to 'examples')
-rw-r--r--examples/c++/glr/c++-types.yy13
1 files changed, 4 insertions, 9 deletions
diff --git a/examples/c++/glr/c++-types.yy b/examples/c++/glr/c++-types.yy
index 975ed71f..594b356e 100644
--- a/examples/c++/glr/c++-types.yy
+++ b/examples/c++/glr/c++-types.yy
@@ -26,7 +26,7 @@
%locations
%debug
-/* Nice error messages with details. */
+// Nice error messages with details.
%define parse.error detailed
%code requires
@@ -43,10 +43,6 @@
#include <fstream>
#include <cstring>
- #if __cplusplus < 201103L
- # define nullptr 0
- #endif
-
static Node
stmtMerge (const Node& x0, const Node& x1);
@@ -97,7 +93,7 @@ declarator
%%
std::istream* input = nullptr;
-/* A C error reporting function. */
+// An error reporting function.
void
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 colNum = 0;
- while (1)
+ while (true)
{
assert (!input->eof ());
- int c = input->get ();
- switch (c)
+ switch (int c = input->get ())
{
case EOF:
return 0;