parsers: rename YY_NULL as YY_NULLPTR to avoid conflicts with Flex

Flex also defines YY_NULL (to 0).  Avoid gratuitous conflicts.

* data/c.m4 (b4_null_define): Rename YY_NULL as YY_NULLPTR.

* data/glr.c, data/lalr1.cc, data/location.cc, data/variant.hh,
* data/yacc.c, src/parse-gram.c, tests/actions.at, tests/c++.at,
* tests/cxx-type.at, tests/glr-regression.at, tests/headers.at,
* tests/push.at, tests/regression.at:
Adjust.
This commit is contained in:
Akim Demaille
2013-11-08 10:52:15 +01:00
parent afc4457605
commit 8d0b7cef7d
14 changed files with 105 additions and 105 deletions

View File

@@ -596,7 +596,7 @@ thing:
;
%%
/* Alias to ARGV[1]. */
const char *source = YY_NULL;
const char *source = YY_NULLPTR;
]AT_YYERROR_DEFINE[

View File

@@ -796,11 +796,11 @@ item:
// Not just 'E', otherwise we reduce when 'E' is the lookahead, and
// then the stack is emptied, defeating the point of the test.
| 'E' 'a' { YYUSE($][1); $][$ = $][2; }
| 'R' { ]AT_VARIANT_IF([], [$][$ = YY_NULL; delete $][1]; )[YYERROR; }
| 'R' { ]AT_VARIANT_IF([], [$][$ = YY_NULLPTR; delete $][1]; )[YYERROR; }
| 'p' { $][$ = $][1; }
| 's' { $][$ = $][1; throw std::runtime_error ("reduction"); }
| 'T' { ]AT_VARIANT_IF([], [$][$ = YY_NULL; delete $][1]; )[YYABORT; }
| error { ]AT_VARIANT_IF([], [$][$ = YY_NULL; ])[yyerrok; }
| 'T' { ]AT_VARIANT_IF([], [$][$ = YY_NULLPTR; delete $][1]; )[YYABORT; }
| error { ]AT_VARIANT_IF([], [$][$ = YY_NULLPTR; ])[yyerrok; }
;
%%
@@ -868,7 +868,7 @@ main (int argc, const char *argv[])
{
std::cerr << "unknown exception caught" << std::endl;
}
Object::log (YY_NULL, "end");
Object::log (YY_NULLPTR, "end");
assert (Object::empty());
return res;
}

View File

@@ -94,19 +94,19 @@ prog :
stmt : expr ';' $2 { $$ = ]$[1; }
| decl $3
| error ';' { $$ = new_nterm ("<error>", YY_NULL, YY_NULL, YY_NULL); }
| error ';' { $$ = new_nterm ("<error>", YY_NULLPTR, YY_NULLPTR, YY_NULLPTR); }
| '@' { YYACCEPT; }
;
expr : ID
| TYPENAME '(' expr ')'
{ $$ = new_nterm ("<cast>(%s,%s)", ]$[3, ]$[1, YY_NULL); }
| expr '+' expr { $$ = new_nterm ("+(%s,%s)", ]$[1, ]$[3, YY_NULL); }
| expr '=' expr { $$ = new_nterm ("=(%s,%s)", ]$[1, ]$[3, YY_NULL); }
{ $$ = new_nterm ("<cast>(%s,%s)", ]$[3, ]$[1, YY_NULLPTR); }
| expr '+' expr { $$ = new_nterm ("+(%s,%s)", ]$[1, ]$[3, YY_NULLPTR); }
| expr '=' expr { $$ = new_nterm ("=(%s,%s)", ]$[1, ]$[3, YY_NULLPTR); }
;
decl : TYPENAME declarator ';'
{ $$ = new_nterm ("<declare>(%s,%s)", ]$[1, ]$[2, YY_NULL); }
{ $$ = new_nterm ("<declare>(%s,%s)", ]$[1, ]$[2, YY_NULLPTR); }
| TYPENAME declarator '=' expr ';'
{ $$ = new_nterm ("<init-declare>(%s,%s,%s)", ]$[1,
]$[2, ]$[4); }
@@ -195,7 +195,7 @@ main (int argc, char **argv)
{
colNum += 1;
tok = c;
yylval = YY_NULL;
yylval = YY_NULLPTR;
}]AT_LOCATION_IF([[
yylloc.last_column = colNum-1;]])[
return tok;
@@ -287,7 +287,7 @@ m4_bmatch([$2], [stmtMerge],
[[static YYSTYPE
stmtMerge (YYSTYPE x0, YYSTYPE x1)
{
return new_nterm ("<OR>(%s,%s)", x0, x1, YY_NULL);
return new_nterm ("<OR>(%s,%s)", x0, x1, YY_NULLPTR);
}
]])
)

View File

@@ -67,7 +67,7 @@ static YYSTYPE exprMerge (YYSTYPE x0, YYSTYPE x1)
return 0;
}
const char *input = YY_NULL;
const char *input = YY_NULLPTR;
int
main (int argc, const char* argv[])
@@ -304,7 +304,7 @@ MergeRule (int x0, int x1)
}
]AT_YYERROR_DEFINE[
FILE *input = YY_NULL;
FILE *input = YY_NULLPTR;
int P[] = { P1, P2 };
int O[] = { O1, O2 };

View File

@@ -229,7 +229,7 @@ AT_CHECK([[$PERL -n -0777 -e '
|YY_IGNORE_MAYBE_UNINITIALIZED_(?:BEGIN|END)
|YY_INITIAL_VALUE
|YY_\w+_INCLUDED
|YY_NULL
|YY_NULLPTR
|(defined|if)\ YYDEBUG
)\b}{}gx;
while (/^(.*YY.*)$/gm)

View File

@@ -57,12 +57,12 @@ main (void)
/* yypstate_delete used to leak ps->yyss if the stack was reallocated but the
parse did not return on success, syntax error, or memory exhaustion. */
ps = yypstate_new ();
assert (yypush_parse (ps, 'a', YY_NULL) == YYPUSH_MORE);
assert (yypush_parse (ps, 'a', YY_NULLPTR) == YYPUSH_MORE);
yypstate_delete (ps);
ps = yypstate_new ();
assert (yypush_parse (ps, 'a', YY_NULL) == YYPUSH_MORE);
assert (yypush_parse (ps, 'b', YY_NULL) == YYPUSH_MORE);
assert (yypush_parse (ps, 'a', YY_NULLPTR) == YYPUSH_MORE);
assert (yypush_parse (ps, 'b', YY_NULLPTR) == YYPUSH_MORE);
yypstate_delete (ps);
return 0;
@@ -111,11 +111,11 @@ main (void)
{
yypstate *ps = yypstate_new ();
assert (ps);
assert (yypstate_new () == YY_NULL);
assert (yypstate_new () == YY_NULLPTR);
]m4_if([$1], [[both]], [[assert (yyparse () == 2)]])[;
yychar = 0;
assert (yypush_parse (ps) == 0);
assert (yypstate_new () == YY_NULL);
assert (yypstate_new () == YY_NULLPTR);
]m4_if([$1], [[both]], [[assert (yyparse () == 2)]])[;
yypstate_delete (ps);
}

View File

@@ -770,7 +770,7 @@ static const yytype_uint8 yyrline[] =
static const char *const yytname[] =
{
"$end", "error", "$undefined", "\"if\"", "\"const\"", "\"then\"",
"\"else\"", "$accept", "statement", "struct_stat", "if", "else", YY_NULL
"\"else\"", "$accept", "statement", "struct_stat", "if", "else", YY_NULLPTR
};
static const yytype_uint16 yytoknum[] =
{