Skip to content

Commit

Permalink
C tests: deduplicate test_syntax_error()
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCount committed Nov 2, 2018
1 parent 52a15f0 commit b931e20
Show file tree
Hide file tree
Showing 45 changed files with 17 additions and 704 deletions.
17 changes: 17 additions & 0 deletions test/C/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define YAEP_TEST_C_COMMON_H_

#include<assert.h>
#include<stdio.h>
#include<stdlib.h>

static void *
Expand All @@ -22,4 +23,20 @@ test_parse_free (void * mem)
free( mem );
}

/* Printing syntax error. */
static void
test_syntax_error (int err_tok_num, void *err_tok_attr,
int start_ignored_tok_num, void *start_ignored_tok_attr,
int start_recovered_tok_num, void *start_recovered_tok_attr)
{
if (start_ignored_tok_num < 0)
fprintf (stderr, "Syntax error on token %d\n", err_tok_num);
else
fprintf
(stderr,
"Syntax error on token %d:ignore %d tokens starting with token = %d\n",
err_tok_num, start_recovered_tok_num - start_ignored_tok_num,
start_ignored_tok_num);
}

#endif
16 changes: 0 additions & 16 deletions test/C/test06.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,6 @@
#include"common.h"
#include "yaep.h"

/* Printing syntax error. */
static void
test_syntax_error (int err_tok_num, void *err_tok_attr,
int start_ignored_tok_num, void *start_ignored_tok_attr,
int start_recovered_tok_num, void *start_recovered_tok_attr)
{
if (start_ignored_tok_num < 0)
fprintf (stderr, "Syntax error on token %d\n", err_tok_num);
else
fprintf
(stderr,
"Syntax error on token %d:ignore %d tokens starting with token = %d\n",
err_tok_num, start_recovered_tok_num - start_ignored_tok_num,
start_ignored_tok_num);
}

/* The following variable is the current number of next input
token. */
static int ntok;
Expand Down
16 changes: 0 additions & 16 deletions test/C/test07.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,6 @@
#include"common.h"
#include "yaep.h"

/* Printing syntax error. */
static void
test_syntax_error (int err_tok_num, void *err_tok_attr,
int start_ignored_tok_num, void *start_ignored_tok_attr,
int start_recovered_tok_num, void *start_recovered_tok_attr)
{
if (start_ignored_tok_num < 0)
fprintf (stderr, "Syntax error on token %d\n", err_tok_num);
else
fprintf
(stderr,
"Syntax error on token %d:ignore %d tokens starting with token = %d\n",
err_tok_num, start_recovered_tok_num - start_ignored_tok_num,
start_ignored_tok_num);
}

/* The following variable is the current number of next input
token. */
static int ntok;
Expand Down
16 changes: 0 additions & 16 deletions test/C/test08.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,6 @@
#include"common.h"
#include "yaep.h"

/* Printing syntax error. */
static void
test_syntax_error (int err_tok_num, void *err_tok_attr,
int start_ignored_tok_num, void *start_ignored_tok_attr,
int start_recovered_tok_num, void *start_recovered_tok_attr)
{
if (start_ignored_tok_num < 0)
fprintf (stderr, "Syntax error on token %d\n", err_tok_num);
else
fprintf
(stderr,
"Syntax error on token %d:ignore %d tokens starting with token = %d\n",
err_tok_num, start_recovered_tok_num - start_ignored_tok_num,
start_ignored_tok_num);
}

/* The following variable is the current number of next input
token. */
static int ntok;
Expand Down
16 changes: 0 additions & 16 deletions test/C/test09.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,6 @@
#include"common.h"
#include "yaep.h"

/* Printing syntax error. */
static void
test_syntax_error (int err_tok_num, void *err_tok_attr,
int start_ignored_tok_num, void *start_ignored_tok_attr,
int start_recovered_tok_num, void *start_recovered_tok_attr)
{
if (start_ignored_tok_num < 0)
fprintf (stderr, "Syntax error on token %d\n", err_tok_num);
else
fprintf
(stderr,
"Syntax error on token %d:ignore %d tokens starting with token = %d\n",
err_tok_num, start_recovered_tok_num - start_ignored_tok_num,
start_ignored_tok_num);
}

/* The following variable is the current number of next input
token. */
static int ntok;
Expand Down
16 changes: 0 additions & 16 deletions test/C/test10.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,6 @@
#include"common.h"
#include "yaep.h"

/* Printing syntax error. */
static void
test_syntax_error (int err_tok_num, void *err_tok_attr,
int start_ignored_tok_num, void *start_ignored_tok_attr,
int start_recovered_tok_num, void *start_recovered_tok_attr)
{
if (start_ignored_tok_num < 0)
fprintf (stderr, "Syntax error on token %d\n", err_tok_num);
else
fprintf
(stderr,
"Syntax error on token %d:ignore %d tokens starting with token = %d\n",
err_tok_num, start_recovered_tok_num - start_ignored_tok_num,
start_ignored_tok_num);
}

/* The following variable is the current number of next input
token. */
static int ntok;
Expand Down
16 changes: 0 additions & 16 deletions test/C/test11.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,6 @@
#include"common.h"
#include "yaep.h"

/* Printing syntax error. */
static void
test_syntax_error (int err_tok_num, void *err_tok_attr,
int start_ignored_tok_num, void *start_ignored_tok_attr,
int start_recovered_tok_num, void *start_recovered_tok_attr)
{
if (start_ignored_tok_num < 0)
fprintf (stderr, "Syntax error on token %d\n", err_tok_num);
else
fprintf
(stderr,
"Syntax error on token %d:ignore %d tokens starting with token = %d\n",
err_tok_num, start_recovered_tok_num - start_ignored_tok_num,
start_ignored_tok_num);
}

/* The following variable is the current number of next input
token. */
static int ntok;
Expand Down
16 changes: 0 additions & 16 deletions test/C/test12.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,6 @@
#include"common.h"
#include "yaep.h"

/* Printing syntax error. */
static void
test_syntax_error (int err_tok_num, void *err_tok_attr,
int start_ignored_tok_num, void *start_ignored_tok_attr,
int start_recovered_tok_num, void *start_recovered_tok_attr)
{
if (start_ignored_tok_num < 0)
fprintf (stderr, "Syntax error on token %d\n", err_tok_num);
else
fprintf
(stderr,
"Syntax error on token %d:ignore %d tokens starting with token = %d\n",
err_tok_num, start_recovered_tok_num - start_ignored_tok_num,
start_ignored_tok_num);
}

/* The following variable is the current number of next input
token. */
static int ntok;
Expand Down
16 changes: 0 additions & 16 deletions test/C/test13.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,6 @@
#include"common.h"
#include "yaep.h"

/* Printing syntax error. */
static void
test_syntax_error (int err_tok_num, void *err_tok_attr,
int start_ignored_tok_num, void *start_ignored_tok_attr,
int start_recovered_tok_num, void *start_recovered_tok_attr)
{
if (start_ignored_tok_num < 0)
fprintf (stderr, "Syntax error on token %d\n", err_tok_num);
else
fprintf
(stderr,
"Syntax error on token %d:ignore %d tokens starting with token = %d\n",
err_tok_num, start_recovered_tok_num - start_ignored_tok_num,
start_ignored_tok_num);
}

/* The following variable is the current number of next input
token. */
static int ntok;
Expand Down
16 changes: 0 additions & 16 deletions test/C/test14.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,6 @@
#include"common.h"
#include "yaep.h"

/* Printing syntax error. */
static void
test_syntax_error (int err_tok_num, void *err_tok_attr,
int start_ignored_tok_num, void *start_ignored_tok_attr,
int start_recovered_tok_num, void *start_recovered_tok_attr)
{
if (start_ignored_tok_num < 0)
fprintf (stderr, "Syntax error on token %d\n", err_tok_num);
else
fprintf
(stderr,
"Syntax error on token %d:ignore %d tokens starting with token = %d\n",
err_tok_num, start_recovered_tok_num - start_ignored_tok_num,
start_ignored_tok_num);
}

/* The following variable is the current number of next input
token. */
static int ntok;
Expand Down
16 changes: 0 additions & 16 deletions test/C/test15.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,6 @@
#include"common.h"
#include "yaep.h"

/* Printing syntax error. */
static void
test_syntax_error (int err_tok_num, void *err_tok_attr,
int start_ignored_tok_num, void *start_ignored_tok_attr,
int start_recovered_tok_num, void *start_recovered_tok_attr)
{
if (start_ignored_tok_num < 0)
fprintf (stderr, "Syntax error on token %d\n", err_tok_num);
else
fprintf
(stderr,
"Syntax error on token %d:ignore %d tokens starting with token = %d\n",
err_tok_num, start_recovered_tok_num - start_ignored_tok_num,
start_ignored_tok_num);
}

/* The following variable is the current number of next input
token. */
static int ntok;
Expand Down
16 changes: 0 additions & 16 deletions test/C/test16.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,6 @@
#include"common.h"
#include "yaep.h"

/* Printing syntax error. */
static void
test_syntax_error (int err_tok_num, void *err_tok_attr,
int start_ignored_tok_num, void *start_ignored_tok_attr,
int start_recovered_tok_num, void *start_recovered_tok_attr)
{
if (start_ignored_tok_num < 0)
fprintf (stderr, "Syntax error on token %d\n", err_tok_num);
else
fprintf
(stderr,
"Syntax error on token %d:ignore %d tokens starting with token = %d\n",
err_tok_num, start_recovered_tok_num - start_ignored_tok_num,
start_ignored_tok_num);
}

/* The following variable is the current number of next input
token. */
static int ntok;
Expand Down
16 changes: 0 additions & 16 deletions test/C/test17.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,6 @@
#include"common.h"
#include "yaep.h"

/* Printing syntax error. */
static void
test_syntax_error (int err_tok_num, void *err_tok_attr,
int start_ignored_tok_num, void *start_ignored_tok_attr,
int start_recovered_tok_num, void *start_recovered_tok_attr)
{
if (start_ignored_tok_num < 0)
fprintf (stderr, "Syntax error on token %d\n", err_tok_num);
else
fprintf
(stderr,
"Syntax error on token %d:ignore %d tokens starting with token = %d\n",
err_tok_num, start_recovered_tok_num - start_ignored_tok_num,
start_ignored_tok_num);
}

/* The following variable is the current number of next input
token. */
static int ntok;
Expand Down
16 changes: 0 additions & 16 deletions test/C/test18.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,6 @@
#include"common.h"
#include "yaep.h"

/* Printing syntax error. */
static void
test_syntax_error (int err_tok_num, void *err_tok_attr,
int start_ignored_tok_num, void *start_ignored_tok_attr,
int start_recovered_tok_num, void *start_recovered_tok_attr)
{
if (start_ignored_tok_num < 0)
fprintf (stderr, "Syntax error on token %d\n", err_tok_num);
else
fprintf
(stderr,
"Syntax error on token %d:ignore %d tokens starting with token = %d\n",
err_tok_num, start_recovered_tok_num - start_ignored_tok_num,
start_ignored_tok_num);
}

/* The following variable is the current number of next input
token. */
static int ntok;
Expand Down
16 changes: 0 additions & 16 deletions test/C/test19.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,6 @@
#include"common.h"
#include "yaep.h"

/* Printing syntax error. */
static void
test_syntax_error (int err_tok_num, void *err_tok_attr,
int start_ignored_tok_num, void *start_ignored_tok_attr,
int start_recovered_tok_num, void *start_recovered_tok_attr)
{
if (start_ignored_tok_num < 0)
fprintf (stderr, "Syntax error on token %d\n", err_tok_num);
else
fprintf
(stderr,
"Syntax error on token %d:ignore %d tokens starting with token = %d\n",
err_tok_num, start_recovered_tok_num - start_ignored_tok_num,
start_ignored_tok_num);
}

/* The following variable is the current number of next input
token. */
static int ntok;
Expand Down
16 changes: 0 additions & 16 deletions test/C/test20.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,6 @@
#include"common.h"
#include "yaep.h"

/* Printing syntax error. */
static void
test_syntax_error (int err_tok_num, void *err_tok_attr,
int start_ignored_tok_num, void *start_ignored_tok_attr,
int start_recovered_tok_num, void *start_recovered_tok_attr)
{
if (start_ignored_tok_num < 0)
fprintf (stderr, "Syntax error on token %d\n", err_tok_num);
else
fprintf
(stderr,
"Syntax error on token %d:ignore %d tokens starting with token = %d\n",
err_tok_num, start_recovered_tok_num - start_ignored_tok_num,
start_ignored_tok_num);
}

/* The following variable is the current number of next input
token. */
static int ntok;
Expand Down
16 changes: 0 additions & 16 deletions test/C/test21.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,6 @@
#include"common.h"
#include "yaep.h"

/* Printing syntax error. */
static void
test_syntax_error (int err_tok_num, void *err_tok_attr,
int start_ignored_tok_num, void *start_ignored_tok_attr,
int start_recovered_tok_num, void *start_recovered_tok_attr)
{
if (start_ignored_tok_num < 0)
fprintf (stderr, "Syntax error on token %d\n", err_tok_num);
else
fprintf
(stderr,
"Syntax error on token %d:ignore %d tokens starting with token = %d\n",
err_tok_num, start_recovered_tok_num - start_ignored_tok_num,
start_ignored_tok_num);
}

/* The following variable is the current number of next input grammar
terminal. */
static int nterm;
Expand Down
Loading

0 comments on commit b931e20

Please sign in to comment.