Merge remote-tracking branch 'origin/maint'

* origin/maint:
  maint: formatting changes.
  tests: support api.prefix.
  tests: pacify font-lock-mode.
  tests: remove test covered elsewhere.
  tests: factor the declaration/definition of yyerror and yylex.
  regen.
  tests: portability issues.
  tests: call the parser from another compilation unit.
  glr.c, yacc.c: declare yydebug in the header.
  skeletons: use header guards.
  tests: improve AT_FULL_COMPILE.
  tests: reorder.
  tests: strengthen the test on generated headers inclusion
  yacc.c: instead of duplicating y.tab.h inside y.tac.c, include it.
  yacc.c: factor.

Conflicts:
	NEWS
	data/glr.c
	data/yacc.c
	src/parse-gram.c
	src/parse-gram.h
	tests/conflicts.at
	tests/regression.at
This commit is contained in:
Akim Demaille
2012-06-19 17:35:53 +02:00
17 changed files with 685 additions and 843 deletions

View File

@@ -42,7 +42,8 @@ esac])
# Create FILE-NAME, containing a self checking parser for a huge
# triangular grammar.
m4_define([AT_DATA_TRIANGULAR_GRAMMAR],
[AT_DATA([[gengram.pl]],
[AT_BISON_OPTION_PUSHDEFS
AT_DATA([[gengram.pl]],
[[#! /usr/bin/perl -w
use strict;
@@ -56,8 +57,8 @@ print <<EOF;
#include <stdio.h>
#include <stdlib.h>
static int yylex (void);
static void yyerror (const char *msg);
]AT_YYLEX_DECLARE[
]AT_YYERROR_DECLARE[
%}
%union
{
@@ -127,6 +128,7 @@ main (void)
}
EOF
]])
AT_BISON_OPTION_POPDEFS
AT_CHECK([perl -w ./gengram.pl $2 || exit 77], 0, [stdout])
mv stdout $1
@@ -157,7 +159,8 @@ AT_CLEANUP
# Create FILE-NAME, containing a self checking parser for a huge
# horizontal grammar.
m4_define([AT_DATA_HORIZONTAL_GRAMMAR],
[AT_DATA([[gengram.pl]],
[AT_BISON_OPTION_PUSHDEFS
AT_DATA([[gengram.pl]],
[[#! /usr/bin/perl -w
use strict;
@@ -171,8 +174,8 @@ print <<EOF;
#include <stdio.h>
#include <stdlib.h>
static int yylex (void);
static void yyerror (const char *msg);
]AT_YYLEX_DECLARE[
]AT_YYERROR_DECLARE[
%}
%token
@@ -223,6 +226,7 @@ EOF
AT_CHECK([perl -w ./gengram.pl $2 || exit 77], 0, [stdout])
mv stdout $1
AT_BISON_OPTION_POPDEFS
])
@@ -263,7 +267,8 @@ AT_CLEANUP
# Create FILE-NAME, containing a self checking parser for a grammar
# requiring SIZE lookahead tokens.
m4_define([AT_DATA_LOOKAHEAD_TOKENS_GRAMMAR],
[AT_DATA([[gengram.pl]],
[AT_BISON_OPTION_PUSHDEFS
AT_DATA([[gengram.pl]],
[[#! /usr/bin/perl -w
use strict;
@@ -278,8 +283,8 @@ print <<EOF;
# include <stdlib.h>
# include <assert.h>
static int yylex (void);
static void yyerror (const char *msg);
]AT_YYLEX_DECLARE[
]AT_YYERROR_DECLARE[
%}
%union
{
@@ -363,6 +368,7 @@ EOF
AT_CHECK([perl -w ./gengram.pl $2 || exit 77], 0, [stdout])
mv stdout $1
AT_BISON_OPTION_POPDEFS
])
@@ -390,7 +396,8 @@ AT_CLEANUP
# ------------------------------------------------
# A parser specialized in torturing the stack size.
m4_define([AT_DATA_STACK_TORTURE],
[# A grammar of parens growing the stack thanks to right recursion.
[AT_BISON_OPTION_PUSHDEFS([$2])
# A grammar of parens growing the stack thanks to right recursion.
# exp:
AT_DATA([input.y],
[[%{
@@ -399,8 +406,8 @@ AT_DATA([input.y],
#include <stdio.h>
#include <stdlib.h>
]$1[
static int yylex (void);
static void yyerror (const char *msg);
]AT_YYLEX_DECLARE[
]AT_YYERROR_DECLARE[
%}
]$2[
%error-verbose
@@ -409,12 +416,7 @@ AT_DATA([input.y],
%%
exp: WAIT_FOR_EOF exp | ;
%%
static void
yyerror (const char *msg)
{
fprintf (stderr, "%s\n", msg);
}
]AT_YYERROR_DEFINE[
static int
yylex (void)
{
@@ -462,6 +464,7 @@ main (int argc, const char **argv)
}
}
]])
AT_BISON_OPTION_POPDEFS([$2])
AT_BISON_CHECK([-o input.c input.y])
AT_COMPILE([input])
])