[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 07/11] glr2.cc: example: style changes
From: |
Akim Demaille |
Subject: |
[PATCH 07/11] glr2.cc: example: style changes |
Date: |
Sun, 10 Jan 2021 17:59:06 +0100 |
* examples/c++/glr/c++-types.yy: We need C++ 11 (we use shared_ptr).
---
examples/c++/glr/c++-types.yy | 13 ++++---------
1 file 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;
--
2.30.0
- [PATCH 00/11] glr2.cc: add support for token constructors, Akim Demaille, 2021/01/10
- [PATCH 01/11] tests: fix definition for parser class name, Akim Demaille, 2021/01/10
- [PATCH 02/11] glr: tests: formatting changes, Akim Demaille, 2021/01/10
- [PATCH 03/11] glr: tests: more macros, Akim Demaille, 2021/01/10
- [PATCH 04/11] glr: examples: fix locations, Akim Demaille, 2021/01/10
- [PATCH 05/11] glr2.cc: fix memory leak, Akim Demaille, 2021/01/10
- [PATCH 06/11] glr2.cc: use references to print symbols, Akim Demaille, 2021/01/10
- [PATCH 07/11] glr2.cc: example: style changes,
Akim Demaille <=
- [PATCH 08/11] glr2.cc: rely on symbol kinds rather than token kinds, Akim Demaille, 2021/01/10
- [PATCH 09/11] glr2.cc: tests: simplify, Akim Demaille, 2021/01/10
- [PATCH 11/11] glr2.cc: add support for api.token.constructor, Akim Demaille, 2021/01/10
- [PATCH 10/11] glr2.cc: introduce the yytranslate_ member function, Akim Demaille, 2021/01/10