Merge remote-tracking branch 'origin/maint'

* origin/maint: (43 commits)
  maint: post-release administrivia
  version 3.0.2
  gnulib: update
  output: do not generate source files when late errors are caught
  output: record what generated files are source or report files
  output: do not generate source files when early errors are caught
  xml: also use "%empty" with html output
  style: formatting changes
  xml: also display %empty for empty right-hand sides
  reports: display %empty in the generated pointed-rules
  news: YYERROR vs variants
  style: scope reduction in lalr.cc
  lalr1.cc: formatting changes
  lalr1.cc: fix the support of YYERROR with variants
  tests: check $$'s destruction with variant, YYERROR, and no error recovery
  tests: simplify useless obfuscation
  skeletons: use better names when computing a "goto"
  maint: post-release administrivia
  version 3.0.1
  aver: it is no longer "protected against NDEBUG"
  ...

Conflicts:
  data/glr.c
This commit is contained in:
Akim Demaille
2013-12-09 10:43:37 +01:00
61 changed files with 839 additions and 554 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

@@ -243,7 +243,7 @@ typedef std::list<std::string> strings_type;
// digraph for the left square bracket.
%type <::std::list<std::string>> list result;
%printer { yyo << $][$; }
%printer { yyo << $$; }
<int> <::std::string> <::std::list<std::string>>;
%%
@@ -253,13 +253,13 @@ result:
list:
/* nothing */ { /* Generates an empty string list */ }
| list item { std::swap ($][$,$][1); $$.push_back ($][2); }
| list error { std::swap ($][$,$][1); }
| list item { std::swap ($$,$][1); $$.push_back ($][2); }
| list error { std::swap ($$,$][1); }
;
item:
TEXT { std::swap ($][$,$][1); }
| NUMBER { if ($][1 == 3) YYERROR; else $][$ = string_cast ($][1); }
TEXT { std::swap ($$,$][1); }
| NUMBER { if ($][1 == 3) YYERROR; else $$ = string_cast ($][1); }
;
%%
]AT_TOKEN_CTOR_IF([],
@@ -649,11 +649,14 @@ AT_CLEANUP
## Exception safety. ##
## ------------------ ##
# AT_TEST([BISON-DIRECTIVES])
# ---------------------------
# AT_TEST([BISON-DIRECTIVES = ''], [WITH-RECOVERY = "with"])
# ----------------------------------------------------------
# Check that no object is leaked when exceptions are thrown.
# WITH-RECOVERY = "with" or "without".
m4_pushdef([AT_TEST],
[AT_SETUP([[Exception safety $1]])
[AT_SETUP([[Exception safety $2 error recovery $1]])
AT_SKIP_IF_EXCEPTION_SUPPORT_IS_POOR
AT_BISON_OPTION_PUSHDEFS([%skeleton "lalr1.cc" $1])
@@ -667,27 +670,43 @@ $1
#include <cassert>
#include <cstdlib> // size_t and getenv.
#include <iostream>
#include <list>
#include <set>
bool debug = false;
/// A class that counts its number of instances.
/// A class that tracks its instances.
struct Object
{
char val;
Object (char v)
: val (v)
{
Object::instances.push_back(this);
log (this, "Object::Object");
}
Object ()
: val ('?')
{
Object::instances.push_back(this);
log (this, "Object::Object");
Object::instances.insert (this);
}
Object (const Object& that)
: val (that.val)
{
log (this, "Object::Object");
Object::instances.insert (this);
}
Object (char v)
: val (v)
{
log (this, "Object::Object");
Object::instances.insert (this);
}
~Object ()
{
log (this, "Object::~Object");
objects::const_iterator i = instances.find (this);
// Make sure this object is alive.
assert (i != instances.end ());
Object::instances.erase (i);
}
Object& operator= (char v)
@@ -696,14 +715,8 @@ $1
return *this;
}
~Object ()
{
Object::instances.remove (this);
log (this, "Object::~Object");
}
// Static part.
typedef std::list<const Object*> objects;
typedef std::set<const Object*> objects;
static objects instances;
static bool
@@ -783,22 +796,23 @@ $1
start: list {]AT_VARIANT_IF([], [ delete $][1]; )[};
list:
item { $][$ = $][1; }
item { $$ = $][1; }
// Right recursion to load the stack.
| item list { $][$ = $][1; ]AT_VARIANT_IF([], [delete $][2]; )[}
| item list { $$ = $][1; ]AT_VARIANT_IF([], [delete $][2]; )[}
;
item:
'a' { $$][ = $][1; }
| 'e' { YYUSE ($][$); YYUSE($][1); error ("syntax error"); }
'a' { $$ = $][1; }
| 'e' { YYUSE ($$); YYUSE($][1); error ("syntax error"); }
// 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; }
| '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; }
| 'E' 'a' { YYUSE($][1); $$ = $][2; }
| 'R' { ]AT_VARIANT_IF([], [$$ = YY_NULLPTR; delete $][1]; )[YYERROR; }
| 'p' { $$ = $][1; }
| 's' { $$ = $][1; throw std::runtime_error ("reduction"); }
| 'T' { ]AT_VARIANT_IF([], [$$ = YY_NULLPTR; delete $][1]; )[YYABORT; }
]m4_if([$2], [with],
[[| error { $$ = ]AT_VARIANT_IF([], [new ])[Object ('R'); yyerrok; }]])[
;
%%
@@ -818,7 +832,8 @@ yylex (yy::parser::semantic_type *lvalp)
case 'l':
throw std::runtime_error ("yylex");
default:
lvalp]AT_VARIANT_IF([->build (res)], [->obj = new Object (res)])[;
lvalp->]AT_VARIANT_IF([build (Object (res))],
[obj = new Object (res)])[;
// Fall through.
case 0:
return res;
@@ -865,7 +880,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;
}
@@ -900,16 +915,17 @@ AT_PARSER_CHECK([[./input aaaaE]], [[2]], [[]],
AT_PARSER_CHECK([[./input aaaaT]], [[1]])
# There is error-recovery, so exit success.
AT_PARSER_CHECK([[./input aaaaR]], [[0]])
AT_PARSER_CHECK([[./input aaaaR]], [m4_if([$2], [with], [0], [1])])
AT_BISON_OPTION_POPDEFS
AT_CLEANUP
])
AT_TEST
AT_TEST([%define api.value.type variant])
AT_TEST([], [with])
AT_TEST([], [without])
AT_TEST([%define api.value.type variant], [with])
AT_TEST([%define api.value.type variant], [without])
m4_popdef([AT_TEST])

View File

@@ -1447,7 +1447,7 @@ State 0
0 $accept: . start $end
1 start: . resolved_conflict 'a' reported_conflicts 'a'
2 resolved_conflict: . 'a' unreachable1
3 | . ['a']
3 | . %empty ['a']
$default reduce using rule 3 (resolved_conflict)
@@ -1483,7 +1483,7 @@ State 4
1 start: resolved_conflict 'a' . reported_conflicts 'a'
8 reported_conflicts: . 'a'
9 | . 'a'
10 | . ['a']
10 | . %empty ['a']
'a' shift, and go to state 5
@@ -1576,11 +1576,11 @@ AT_CHECK([[cat input.output | sed -n '/^State 0$/,/^State 1$/p']], 0,
6 | . empty_c1 'c'
7 | . empty_c2 'c'
8 | . empty_c3 'c'
9 empty_a: . ['a']
10 empty_b: . []
11 empty_c1: . []
12 empty_c2: . []
13 empty_c3: . ['c']
9 empty_a: . %empty ['a']
10 empty_b: . %empty []
11 empty_c1: . %empty []
12 empty_c2: . %empty []
13 empty_c3: . %empty ['c']
'b' shift, and go to state 1
@@ -1652,11 +1652,11 @@ AT_CHECK([[cat input.output | sed -n '/^State 0$/,/^State 1$/p']], 0,
6 | . empty_c1 'c'
7 | . empty_c2 'c'
8 | . empty_c3 'c'
9 empty_a: . []
10 empty_b: . []
11 empty_c1: . []
12 empty_c2: . ['c']
13 empty_c3: . ['c']
9 empty_a: . %empty []
10 empty_b: . %empty []
11 empty_c1: . %empty []
12 empty_c2: . %empty ['c']
13 empty_c3: . %empty ['c']
'a' error (nonassociative)
'b' error (nonassociative)

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 };
@@ -1749,3 +1749,33 @@ Cleanup: popping token 'a' ()
])
AT_CLEANUP
## ----------------------------------------------------------------- ##
## Predicates. ##
## ##
## http://lists.gnu.org/archive/html/bug-bison/2013-10/msg00004.html ##
## ----------------------------------------------------------------- ##
AT_SETUP([Predicates])
# FIXME: We need genuine test cases with uses of %?.
AT_DATA_GRAMMAR([input.y],
[[%glr-parser
%expect-rr 1
%%
// Exercise "%?{...}" and "%? {...}".
widget:
%? {new_syntax} "widget" id new_args { $$ = f($3, $4); }
| %?{!new_syntax} "widget" id old_args { $$ = f($3, $4); }
;
id:;
new_args:;
old_args:;
%%
]])
AT_BISON_CHECK([[input.y]])
AT_CLEANUP

View File

@@ -223,9 +223,13 @@ AT_CHECK([[$PERL -n -0777 -e '
s{/\*.*?\*/}{}gs;
s{//.*}{}g;
s{\b(YYChar
|YYPUSH_MORE(_DEFINED)?
|YYPUSH_MORE(?:_DEFINED)?
|YYUSE
|YY_ATTRIBUTE(?:_PURE|_UNUSED)?
|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

@@ -956,15 +956,9 @@ without_period: "WITHOUT.PERIOD";
AT_BISON_OPTION_POPDEFS
# POSIX Yacc accept periods, but not dashes.
AT_BISON_CHECK([--yacc -Wno-error input.y], [], [],
[[input.y:9.8-16: warning: POSIX Yacc forbids dashes in symbol names: WITH-DASH [-Wyacc]
input.y:20.8-16: warning: POSIX Yacc forbids dashes in symbol names: with-dash [-Wyacc]
]])
# So warn about them.
AT_BISON_CHECK([-Wyacc input.y], [], [],
[[input.y:9.8-16: warning: POSIX Yacc forbids dashes in symbol names: WITH-DASH [-Wyacc]
input.y:20.8-16: warning: POSIX Yacc forbids dashes in symbol names: with-dash [-Wyacc]
AT_BISON_CHECK([--yacc input.y], [1], [],
[[input.y:9.8-16: error: POSIX Yacc forbids dashes in symbol names: WITH-DASH [-Werror=yacc]
input.y:20.8-16: error: POSIX Yacc forbids dashes in symbol names: with-dash [-Werror=yacc]
]])
# Dashes are fine for GNU Bison.
@@ -1768,11 +1762,11 @@ AT_BISON_CHECK([[-Dparse.lac.memory-trace=full input.y]],
AT_CLEANUP
## --------------------------------------------- ##
## -Werror is not affected by -Wnone and -Wall. ##
## --------------------------------------------- ##
## ---------------------- ##
## -Werror combinations. ##
## ---------------------- ##
AT_SETUP([[-Werror is not affected by -Wnone and -Wall]])
AT_SETUP([[-Werror combinations]])
AT_DATA([[input.y]],
[[%%
@@ -1798,6 +1792,18 @@ AT_BISON_CHECK([[-Werror,no-all,other input.y]], [[1]], [[]],
[[input.y:2.15: error: stray '$' [-Werror=other]
]])
# Check that -Wno-error keeps warnings enabled, but non fatal.
AT_BISON_CHECK([[-Werror -Wno-error=other input.y]], [[0]], [[]],
[[input.y:2.15: warning: stray '$' [-Wother]
]])
AT_BISON_CHECK([[-Wno-error=other -Werror input.y]], [[0]], [[]],
[[input.y:2.15: warning: stray '$' [-Wother]
]])
AT_BISON_CHECK([[-Werror=other -Wno-other input.y]], [[0]], [[]],
[[]])
AT_CLEANUP

View File

@@ -635,9 +635,12 @@ m4_define([AT_BISON_CHECK_],
# ----------------------------------------------------------
# Check that warnings (if some are expected) are correctly
# turned into errors with -Werror, etc.
#
# When -Wno-error is used, the rules are really different, don't try.
m4_define([AT_BISON_CHECK_WARNINGS],
[m4_if(m4_bregexp([$4], [: warning: ]), [-1], [],
[m4_null_if([$2], [AT_BISON_CHECK_WARNINGS_($@)])])])
m4_bregexp([$1], [-Wno-error=]), [-1],
[m4_null_if([$2], [AT_BISON_CHECK_WARNINGS_($@)])])])
m4_define([AT_BISON_CHECK_WARNINGS_],
[[# Defining POSIXLY_CORRECT causes bison to complain if options are
@@ -872,6 +875,49 @@ AT_PARSER_CHECK([./c-and-cxx])
])
# AT_SKIP_IF_EXCEPTION_SUPPORT_IS_POOR
# ------------------------------------
# Check that we can expect exceptions to be handled properly.
# GCC 4.3 and 4.4 fail https://trac.macports.org/ticket/40853.
m4_define([AT_SKIP_IF_EXCEPTION_SUPPORT_IS_POOR],
[AT_DATA_SOURCE([exception.cc],
[[#include <iostream>
#include <stdexcept>
void foo()
{
try
{
throw std::runtime_error("foo");
}
catch (...)
{
std::cerr << "Inner caught" << std::endl;
throw;
}
}
int main()
{
try
{
foo();
}
catch (...)
{
std::cerr << "Outer caught" << std::endl;
return 0;
}
return 1;
}
]])
AT_COMPILE_CXX([exception])
# The "empty" quadrigraph is to protect from cfg.mk's
# sc_at_parser_check.
AT_CHECK([@&t@./exception || exit 77], [0], [], [ignore])
])
## ---------------------------- ##
## Running a generated parser. ##
## ---------------------------- ##

View File

@@ -85,7 +85,7 @@ $(TESTSUITE): $(TESTSUITE_AT)
# Move into tests/ so that testsuite.dir etc. be created there.
RUN_TESTSUITE = $(TESTSUITE) -C tests $(TESTSUITEFLAGS)
check_SCRIPTS = $(BISON) tests/atconfig tests/atlocal
RUN_TESTSUITE_deps = $(TESTSUITE) $(check_SCRIPTS)
RUN_TESTSUITE_deps = all $(TESTSUITE) $(check_SCRIPTS)
clean-local: clean-local-tests
clean-local-tests:
@@ -126,3 +126,6 @@ maintainer-push-check:
maintainer-xml-check:
$(MAKE) $(AM_MAKEFLAGS) maintainer-check \
TESTSUITEFLAGS='BISON_TEST_XML=1 $(TESTSUITEFLAGS)'
.PHONY: maintainer-release-check
maintainer-release-check: maintainer-check maintainer-push-check maintainer-xml-check

View File

@@ -17,12 +17,23 @@
AT_BANNER([[Output file names.]])
# AT_CHECK_FILES(EXPECTED-FILES, [IGNORED-FILES])
# -----------------------------------------------
# Check that the current directory contains FILE... (sorted).
m4_define([AT_CHECK_FILES],
[AT_CHECK([[find . -type f |
$PERL -ne '
s,\./,,; chomp;
push @file, $_ unless m{^($2|testsuite.log)$};
END { print join (" ", sort @file), "\n" }']],
[], [$1
])])
# AT_CHECK_OUTPUT(INPUT-FILE, [DIRECTIVES], [FLAGS], EXPECTED-FILES, [SHELLIO],
# AT_CHECK_OUTPUT(INPUT-FILE, [DIRECTIVES], [FLAGS], EXPECTED-FILES, [STATUS],
# [ADDITIONAL-TESTS], [PRE-TESTS])
# -----------------------------------------------------------------------------
m4_define([AT_CHECK_OUTPUT],
[AT_SETUP([[Output files: ]$2 $3 $5])[
[AT_SETUP([[Output files: ]$2 $3])[
]$7[
for file in ]$1 $4[; do
case $file in
@@ -32,18 +43,12 @@ done
]AT_DATA([$1],
[$2[
%%
foo: {};
foo: %empty {};
]])[
]AT_BISON_CHECK([$3 $1 $5], 0)[
]AT_BISON_CHECK([$3 $1], [$5], [], [ignore])[
# Ignore the files non-generated files
]AT_CHECK([[find . -type f |
$PERL -ne '
s,\./,,; chomp;
push @file, $_ unless m{^($1|testsuite.log)$};
END { print join (" ", sort @file), "\n" }']],
[], [$4
])[
]AT_CHECK_FILES([$4], [$1])[
]$6[
]AT_CLEANUP[
]])
@@ -54,9 +59,9 @@ AT_CHECK_OUTPUT([foo.y], [], [-dv],
# Some versions of Valgrind (at least valgrind-3.6.0.SVN-Debian) report
# "fgrep: write error: Bad file descriptor" when stdout is closed, so we
# skip this test group during maintainer-check-valgrind.
AT_CHECK_OUTPUT([foo.y], [], [-dv],
AT_CHECK_OUTPUT([foo.y], [], [-dv >&-],
[foo.output foo.tab.c foo.tab.h],
[>&-], [],
[], [],
[AT_CHECK([[case "$PREBISON" in *valgrind*) exit 77;; esac]])])
AT_CHECK_OUTPUT([foo.y], [], [-dv -o foo.c],
@@ -114,6 +119,20 @@ AT_CHECK_OUTPUT([foo.yy], [],
[-o foo.c++ --graph=foo.gph],
[foo.c++ foo.gph])
# Do not generate code when there are early errors (even warnings as
# errors).
AT_CHECK_OUTPUT([foo.y], [%type <foo> useless],
[--defines --graph --xml --report=all -Wall -Werror],
[foo.dot foo.output foo.xml],
[1])
# Do not generate code when there are late errors (even warnings as
# errors).
AT_CHECK_OUTPUT([foo.y], [%define useless],
[--defines --graph --xml --report=all -Wall -Werror],
[foo.dot foo.output foo.xml],
[1])
## ------------ ##
## C++ output. ##
@@ -290,7 +309,7 @@ a: ;
b: 'b';
]],
[[
0 [label="State 0\n\l 0 $accept: . exp $end\l 1 exp: . a '?' b\l 2 a: .\l"]
0 [label="State 0\n\l 0 $accept: . exp $end\l 1 exp: . a '?' b\l 2 a: . %empty\l"]
0 -> 1 [style=dashed label="exp"]
0 -> 2 [style=dashed label="a"]
0 -> "0R2" [style=solid]
@@ -332,7 +351,7 @@ empty_b: %prec 'b';
empty_c: %prec 'c';
]],
[[
0 [label="State 0\n\l 0 $accept: . start $end\l 1 start: . 'a'\l 2 | . empty_a 'a'\l 3 | . 'b'\l 4 | . empty_b 'b'\l 5 | . 'c'\l 6 | . empty_c 'c'\l 7 empty_a: . ['a']\l 8 empty_b: . ['b']\l 9 empty_c: . ['c']\l"]
0 [label="State 0\n\l 0 $accept: . start $end\l 1 start: . 'a'\l 2 | . empty_a 'a'\l 3 | . 'b'\l 4 | . empty_b 'b'\l 5 | . 'c'\l 6 | . empty_c 'c'\l 7 empty_a: . %empty ['a']\l 8 empty_b: . %empty ['b']\l 9 empty_c: . %empty ['c']\l"]
0 -> 1 [style=solid label="'a'"]
0 -> 2 [style=solid label="'b'"]
0 -> 3 [style=solid label="'c'"]
@@ -399,7 +418,7 @@ empty_b: %prec 'b';
empty_c: %prec 'c';
]],
[[
0 [label="State 0\n\l 0 $accept: . start $end\l 1 start: . 'a'\l 2 | . empty_a 'a'\l 3 | . 'b'\l 4 | . empty_b 'b'\l 5 | . 'c'\l 6 | . empty_c 'c'\l 7 empty_a: . ['a']\l 8 empty_b: . []\l 9 empty_c: . []\l"]
0 [label="State 0\n\l 0 $accept: . start $end\l 1 start: . 'a'\l 2 | . empty_a 'a'\l 3 | . 'b'\l 4 | . empty_b 'b'\l 5 | . 'c'\l 6 | . empty_c 'c'\l 7 empty_a: . %empty ['a']\l 8 empty_b: . %empty []\l 9 empty_c: . %empty []\l"]
0 -> 1 [style=solid label="'b'"]
0 -> 2 [style=solid label="'c'"]
0 -> 3 [style=dashed label="start"]
@@ -447,7 +466,7 @@ a: ;
b: ;
]],
[[
0 [label="State 0\n\l 0 $accept: . exp $end\l 1 exp: . a\l 2 | . b\l 3 a: . [$end]\l 4 b: . [$end]\l"]
0 [label="State 0\n\l 0 $accept: . exp $end\l 1 exp: . a\l 2 | . b\l 3 a: . %empty [$end]\l 4 b: . %empty [$end]\l"]
0 -> 1 [style=dashed label="exp"]
0 -> 2 [style=dashed label="a"]
0 -> 3 [style=dashed label="b"]
@@ -480,7 +499,7 @@ b: ;
c: ;
]],
[[
0 [label="State 0\n\l 0 $accept: . exp $end\l 1 exp: . a ';'\l 2 | . a ';'\l 3 | . a '.'\l 4 | . b '?'\l 5 | . b '!'\l 6 | . c '?'\l 7 | . c ';'\l 8 a: . [';', '.']\l 9 b: . ['?', '!']\l 10 c: . [';', '?']\l"]
0 [label="State 0\n\l 0 $accept: . exp $end\l 1 exp: . a ';'\l 2 | . a ';'\l 3 | . a '.'\l 4 | . b '?'\l 5 | . b '!'\l 6 | . c '?'\l 7 | . c ';'\l 8 a: . %empty [';', '.']\l 9 b: . %empty ['?', '!']\l 10 c: . %empty [';', '?']\l"]
0 -> 1 [style=dashed label="exp"]
0 -> 2 [style=dashed label="a"]
0 -> 3 [style=dashed label="b"]
@@ -595,7 +614,7 @@ imm: '0';
"11R7d" [label="R7", fillcolor=5, shape=diamond, style=filled]
11 -> "11R7" [style=solid]
"11R7" [label="R7", fillcolor=3, shape=diamond, style=filled]
12 [label="State 12\n\l 4 ifexp: \"if\" exp \"then\" exp . elseexp\l 5 elseexp: . \"else\" exp\l 6 | . [$end, \"then\", \"else\", '+']\l 7 opexp: exp . '+' exp\l"]
12 [label="State 12\n\l 4 ifexp: \"if\" exp \"then\" exp . elseexp\l 5 elseexp: . \"else\" exp\l 6 | . %empty [$end, \"then\", \"else\", '+']\l 7 opexp: exp . '+' exp\l"]
12 -> 13 [style=solid label="\"else\""]
12 -> 9 [style=solid label="'+'"]
12 -> 14 [style=dashed label="elseexp"]

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

@@ -1057,7 +1057,7 @@ State 12
4 A: 'a' 'a' . B
5 B: . 'a'
6 | . ]AT_COND_CASE([[LALR]], [[['a', 'b']]], [[['a']]])[
6 | . %empty ]AT_COND_CASE([[LALR]], [[['a', 'b']]], [[['a']]])[
]AT_COND_CASE([[canonical LR]], [['a']],
[[$default]])[ reduce using rule 6 (B)
@@ -1087,7 +1087,7 @@ State 15
4 A: 'a' 'a' . B
5 B: . 'a'
6 | . [$end]
6 | . %empty [$end]
7 c: 'a' 'a' . 'b'
'a' shift, and go to state ]AT_COND_CASE([[canonical LR]], [[20]],
@@ -1150,7 +1150,7 @@ State 22]])[
4 A: 'a' 'a' . B
5 B: . 'a'
6 | . ['b']
6 | . %empty ['b']
'a' shift, and go to state ]AT_COND_CASE([[canonical LR]], [[23]],
[[16]])[
@@ -1575,8 +1575,8 @@ State 3
1 start: a . b
2 | a . b 'a'
3 | a . c 'b'
5 b: . [$end, 'a']
6 c: . ['b']]AT_COND_CASE([[most]], [[
5 b: . %empty [$end, 'a']
6 c: . %empty ['b']]AT_COND_CASE([[most]], [[
'b' reduce using rule 6 (c)
$default reduce using rule 5 (b)]], [[

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[] =
{