From e98b2df022fd47b62af35aebd3053f6e218f9926 Mon Sep 17 00:00:00 2001 From: Will Estes Date: Tue, 17 Jun 2014 09:42:24 -0400 Subject: refactor include_by_* tests for new test suite layout --- tests/.gitignore | 6 ++ tests/Makefile.am | 21 ++++++ tests/include_by_buffer.direct.l | 102 +++++++++++++++++++++++++++ tests/include_by_buffer.direct.txt | 3 + tests/include_by_buffer.direct_2.txt | 3 + tests/include_by_buffer.direct_3.txt | 2 + tests/include_by_push.direct.l | 92 ++++++++++++++++++++++++ tests/include_by_push.direct.txt | 3 + tests/include_by_push.direct_2.txt | 3 + tests/include_by_push.direct_3.txt | 2 + tests/include_by_reentrant.direct.l | 101 ++++++++++++++++++++++++++ tests/include_by_reentrant.direct.txt | 3 + tests/include_by_reentrant.direct_2.txt | 3 + tests/include_by_reentrant.direct_3.txt | 2 + tests/test-include-by-buffer/.gitignore | 7 -- tests/test-include-by-buffer/Makefile.am | 49 ------------- tests/test-include-by-buffer/scanner.l | 102 --------------------------- tests/test-include-by-buffer/test-1.input | 3 - tests/test-include-by-buffer/test-2.input | 3 - tests/test-include-by-buffer/test-3.input | 2 - tests/test-include-by-push/.gitignore | 7 -- tests/test-include-by-push/Makefile.am | 49 ------------- tests/test-include-by-push/scanner.l | 92 ------------------------ tests/test-include-by-push/test-1.input | 3 - tests/test-include-by-push/test-2.input | 3 - tests/test-include-by-push/test-3.input | 2 - tests/test-include-by-reentrant/.gitignore | 7 -- tests/test-include-by-reentrant/Makefile.am | 49 ------------- tests/test-include-by-reentrant/scanner.l | 101 -------------------------- tests/test-include-by-reentrant/test-1.input | 3 - tests/test-include-by-reentrant/test-2.input | 3 - tests/test-include-by-reentrant/test-3.input | 2 - 32 files changed, 346 insertions(+), 487 deletions(-) create mode 100644 tests/include_by_buffer.direct.l create mode 100644 tests/include_by_buffer.direct.txt create mode 100644 tests/include_by_buffer.direct_2.txt create mode 100644 tests/include_by_buffer.direct_3.txt create mode 100644 tests/include_by_push.direct.l create mode 100644 tests/include_by_push.direct.txt create mode 100644 tests/include_by_push.direct_2.txt create mode 100644 tests/include_by_push.direct_3.txt create mode 100644 tests/include_by_reentrant.direct.l create mode 100644 tests/include_by_reentrant.direct.txt create mode 100644 tests/include_by_reentrant.direct_2.txt create mode 100644 tests/include_by_reentrant.direct_3.txt delete mode 100644 tests/test-include-by-buffer/.gitignore delete mode 100644 tests/test-include-by-buffer/Makefile.am delete mode 100644 tests/test-include-by-buffer/scanner.l delete mode 100644 tests/test-include-by-buffer/test-1.input delete mode 100644 tests/test-include-by-buffer/test-2.input delete mode 100644 tests/test-include-by-buffer/test-3.input delete mode 100644 tests/test-include-by-push/.gitignore delete mode 100644 tests/test-include-by-push/Makefile.am delete mode 100644 tests/test-include-by-push/scanner.l delete mode 100644 tests/test-include-by-push/test-1.input delete mode 100644 tests/test-include-by-push/test-2.input delete mode 100644 tests/test-include-by-push/test-3.input delete mode 100644 tests/test-include-by-reentrant/.gitignore delete mode 100644 tests/test-include-by-reentrant/Makefile.am delete mode 100644 tests/test-include-by-reentrant/scanner.l delete mode 100644 tests/test-include-by-reentrant/test-1.input delete mode 100644 tests/test-include-by-reentrant/test-2.input delete mode 100644 tests/test-include-by-reentrant/test-3.input (limited to 'tests') diff --git a/tests/.gitignore b/tests/.gitignore index 99e307a..5e1c540 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -41,6 +41,12 @@ header_nr header_nr_scanner.[ch] header_r header_r_scanner.[ch] +include_by_buffer.direct +include_by_buffer.direct.c +include_by_push.direct +include_by_push.direct.c +include_by_reentrant.direct +include_by_reentrant.direct.c mem_nr mem_nr.c mem_r diff --git a/tests/Makefile.am b/tests/Makefile.am index eedc939..6ae705d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -87,6 +87,9 @@ TABLE_TESTS = \ reject_ver.table DIRECT_TESTS = \ + include_by_buffer.direct \ + include_by_push.direct \ + include_by_reentrant.direct \ rescan_nr.direct \ rescan_r.direct @@ -108,6 +111,9 @@ debug_r_SOURCES = debug_r.l extended_SOURCES = extended.l header_nr_SOURCES = header_nr_scanner.l header_nr_main.c header_r_SOURCES = header_r_scanner.l header_r_main.c +include_by_buffer_direct_SOURCES = include_by_buffer.direct.l +include_by_push_direct_SOURCES = include_by_push.direct.l +include_by_reentrant_direct_SOURCES = include_by_reentrant.direct.l mem_nr_SOURCES = mem_nr.l mem_r_SOURCES = mem_r.l multiple_scanners_nr_SOURCES = multiple_scanners_nr_main.c multiple_scanners_nr_1.l multiple_scanners_nr_2.l @@ -179,6 +185,15 @@ basic_nr.txt \ header_nr.txt \ header_r_scanner.h \ header_r.txt \ + include_by_buffer.direct.txt \ + include_by_buffer.direct_2.txt \ + include_by_buffer.direct_3.txt \ + include_by_push.direct.txt \ + include_by_push.direct_2.txt \ + include_by_push.direct_3.txt \ + include_by_reentrant.direct.txt \ + include_by_reentrant.direct_2.txt \ + include_by_reentrant.direct_3.txt \ mem_nr.txt \ mem_r.txt \ noansi_nr.txt \ @@ -232,6 +247,12 @@ header_nr_scanner.h: header_nr_scanner.c header_r_main.$(OBJEXT): header_r_scanner.h header_r_scanner.h: header_r_scanner.c +include_by_buffer.direct$(EXE): include_by_buffer.direct.txt include_by_buffer.direct_2.txt include_by_buffer.direct_3.txt + +include_by_push.direct$(EXE): include_by_push.direct.txt include_by_push.direct_2.txt include_by_push.direct_3.txt + +include_by_reentrant.direct$(EXE): include_by_reentrant.direct.txt include_by_reentrant.direct_2.txt include_by_reentrant.direct_3.txt + multiple_scanners_nr_main.$(OBJEXT): multiple_scanners_nr_1.h multiple_scanners_nr_2.h multiple_scanners_nr_1.h: multiple_scanners_nr_1.c multiple_scanners_nr_2.h: multiple_scanners_nr_2.c diff --git a/tests/include_by_buffer.direct.l b/tests/include_by_buffer.direct.l new file mode 100644 index 0000000..4dc0091 --- /dev/null +++ b/tests/include_by_buffer.direct.l @@ -0,0 +1,102 @@ +/* + * This file is part of flex. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions +f * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE. + */ + +%{ +/* A scanner file to build "scanner.c". + Input language is any text. + "#include " causes a buffer switch. + */ +#include +#include +#include "config.h" +%} + +%option 8bit prefix="test" +%option nounput nomain noyywrap +%option warn + +%x GET_FILENAME +%{ + +#define MAX_INCLUDE_DEPTH 10 +YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH]; +int include_stack_ptr = 0; +%} +%% + +{ +^"#include"[[:blank:]]+"<" { BEGIN(GET_FILENAME); } +.|\n { ECHO; } +} + +{ +[[:alnum:]_.-]+> { + /* recurse */ + yytext[yyleng-1]='\0'; + include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER; + if((yyin=fopen(yytext,"r"))==NULL) { + fprintf(stderr,"*** Error: Could not open include file \"%s\".\n",yytext); + yyterminate(); + } + yy_switch_to_buffer( yy_create_buffer( yyin, YY_BUF_SIZE )); + BEGIN(0); + } +.|\n { + fprintf(stderr,"Invalid input \"%s\".\n", yytext); + yyterminate(); + } +} + +<> { + if ( --include_stack_ptr < 0 ) { + yyterminate(); + } + else { + fclose(yyin); + yy_delete_buffer( YY_CURRENT_BUFFER ); + yy_switch_to_buffer( include_stack[include_stack_ptr] ); + } + } + +%% + +int main(int argc, char** argv); + +int +main ( int argc, char** argv ) +{ + FILE * fp; + if( argc != 2 ) { + fprintf(stderr,"*** Error: Must specify one filename.\n"); + exit(-1); + } + if((fp=fopen(argv[1],"r"))==NULL) { + fprintf(stderr,"*** Error: fopen(%s) failed.\n",argv[1]); + exit(-1); + } + yyin = fp; + yyout = stdout; + yylex(); + printf("TEST RETURNING OK.\n"); + return 0; +} diff --git a/tests/include_by_buffer.direct.txt b/tests/include_by_buffer.direct.txt new file mode 100644 index 0000000..56f1ed2 --- /dev/null +++ b/tests/include_by_buffer.direct.txt @@ -0,0 +1,3 @@ +Beginning of "include_by_buffer.direct.txt" +#include +End of "include_by_buffer.direct.txt" diff --git a/tests/include_by_buffer.direct_2.txt b/tests/include_by_buffer.direct_2.txt new file mode 100644 index 0000000..52e61ea --- /dev/null +++ b/tests/include_by_buffer.direct_2.txt @@ -0,0 +1,3 @@ +Beginning of "include_by_buffer.direct_2.txt" +#include +End of "include_by_buffer.direct_2.txt" diff --git a/tests/include_by_buffer.direct_3.txt b/tests/include_by_buffer.direct_3.txt new file mode 100644 index 0000000..3cfdd0f --- /dev/null +++ b/tests/include_by_buffer.direct_3.txt @@ -0,0 +1,2 @@ +Beginning of "include_by_buffer.direct_3.txt" +End of "include_by_buffer.direct_3.txt" diff --git a/tests/include_by_push.direct.l b/tests/include_by_push.direct.l new file mode 100644 index 0000000..9e978ce --- /dev/null +++ b/tests/include_by_push.direct.l @@ -0,0 +1,92 @@ +/* + * This file is part of flex. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE. + */ + +%{ +/* A scanner file to build "scanner.c". + Input language is any text. + "#include " causes a buffer switch. + */ +#include +#include +#include "config.h" +%} + +%option 8bit prefix="test" +%option nounput nomain noyywrap +%option warn + +%x GET_FILENAME + +%% + +{ +^"#include"[[:blank:]]+"<" { BEGIN(GET_FILENAME); } +.|\n { ECHO; } +} + +{ +[[:alnum:]_.-]+> { + /* recurse */ + yytext[yyleng-1]='\0'; + if((yyin=fopen(yytext,"r"))==NULL) { + fprintf(stderr,"*** Error: Could not open include file \"%s\".\n",yytext); + yyterminate(); + } + yypush_buffer_state( yy_create_buffer( yyin, YY_BUF_SIZE )); + BEGIN(0); + } +.|\n { + fprintf(stderr,"Invalid input \"%s\".\n", yytext); + yyterminate(); + } +} + +<> { + fclose(yyin); + yypop_buffer_state(); + if(!YY_CURRENT_BUFFER) + yyterminate(); + } + +%% + +int main(int argc, char** argv); + +int +main ( int argc, char** argv ) +{ + FILE * fp; + if( argc != 2 ) { + fprintf(stderr,"*** Error: Must specify one filename.\n"); + exit(-1); + } + if((fp=fopen(argv[1],"r"))==NULL) { + fprintf(stderr,"*** Error: fopen(%s) failed.\n",argv[1]); + exit(-1); + } + yyin = fp; + yyout = stdout; + yylex(); + printf("TEST RETURNING OK.\n"); + return 0; +} diff --git a/tests/include_by_push.direct.txt b/tests/include_by_push.direct.txt new file mode 100644 index 0000000..93136f6 --- /dev/null +++ b/tests/include_by_push.direct.txt @@ -0,0 +1,3 @@ +Beginning of "include_by_push.direct.txt" +#include +End of "include_by_push.direct.txt" diff --git a/tests/include_by_push.direct_2.txt b/tests/include_by_push.direct_2.txt new file mode 100644 index 0000000..8b378e8 --- /dev/null +++ b/tests/include_by_push.direct_2.txt @@ -0,0 +1,3 @@ +Beginning of "include_by_push.direct_2.txt" +#include +End of "include_by_push.direct_2.txt" diff --git a/tests/include_by_push.direct_3.txt b/tests/include_by_push.direct_3.txt new file mode 100644 index 0000000..8b8f9a5 --- /dev/null +++ b/tests/include_by_push.direct_3.txt @@ -0,0 +1,2 @@ +Beginning of "include_by_push.direct_3.txt" +End of "include_by_push.direct_3.txt" diff --git a/tests/include_by_reentrant.direct.l b/tests/include_by_reentrant.direct.l new file mode 100644 index 0000000..f993133 --- /dev/null +++ b/tests/include_by_reentrant.direct.l @@ -0,0 +1,101 @@ +/* + * This file is part of flex. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE. + */ + +%{ +/* A scanner file to build "scanner.c". + Input language is any text. + "#include " causes a new scanner to be created. + */ +#include +#include +#include "config.h" +%} + +%option 8bit prefix="test" +%option nounput nomain noyywrap +%option reentrant +%option warn + +%x GET_FILENAME + +%% + +{ +^"#include"[[:blank:]]+"<" { BEGIN(GET_FILENAME); } +.|\n { ECHO; } +} + +{ +[[:alnum:]_.-]+> { + /* recurse */ + yyscan_t scanner; + FILE * fp; + yytext[yyleng-1]='\0'; + if((fp=fopen(yytext,"r"))==NULL) { + fprintf(stderr,"*** Error: Could not open include file \"%s\".\n", + yytext); + yyterminate(); + } + yylex_init(&scanner); + yyset_in( fp, scanner); + yyset_out( stdout, scanner); + yylex(scanner); + yylex_destroy(scanner); + + BEGIN(0); + } +.|\n { + fprintf(stderr,"Invalid input \"%s\".\n", yytext); + yyterminate(); + } +} + +<> { fclose(yyin); yyterminate();} + +%% + +int main (int argc, char** argv); + +int +main ( argc, argv ) + int argc; + char ** argv; +{ + FILE * fp; + yyscan_t scanner; + if( argc != 2 ) { + fprintf(stderr,"*** Error: Must specify one filename.\n"); + exit(-1); + } + if((fp=fopen(argv[1],"r"))==NULL) { + fprintf(stderr,"*** Error: fopen(%s) failed.\n",argv[1]); + exit(-1); + } + yylex_init(&scanner); + yyset_in( fp, scanner); + yyset_out( stdout, scanner); + yylex(scanner); + yylex_destroy(scanner); + printf("TEST RETURNING OK.\n"); + return 0; +} diff --git a/tests/include_by_reentrant.direct.txt b/tests/include_by_reentrant.direct.txt new file mode 100644 index 0000000..190a600 --- /dev/null +++ b/tests/include_by_reentrant.direct.txt @@ -0,0 +1,3 @@ +Beginning of "include_by_reentrant.direct.txt". +#include +End of "include_by_reentrant.direct.txt". diff --git a/tests/include_by_reentrant.direct_2.txt b/tests/include_by_reentrant.direct_2.txt new file mode 100644 index 0000000..84a647b --- /dev/null +++ b/tests/include_by_reentrant.direct_2.txt @@ -0,0 +1,3 @@ +Beginning of "include_by_reentrant.direct_2.txt". +#include +End of "include_by_reentrant.direct_2.txt". diff --git a/tests/include_by_reentrant.direct_3.txt b/tests/include_by_reentrant.direct_3.txt new file mode 100644 index 0000000..b0fba64 --- /dev/null +++ b/tests/include_by_reentrant.direct_3.txt @@ -0,0 +1,2 @@ +Beginning of "include_by_reentrant.direct_3.txt". +End of "include_by_reentrant.direct_3.txt". diff --git a/tests/test-include-by-buffer/.gitignore b/tests/test-include-by-buffer/.gitignore deleted file mode 100644 index 90467e8..0000000 --- a/tests/test-include-by-buffer/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -Makefile -Makefile.in -parser.c -parser.h -scanner.c -test-include-by-buffer -OUTPUT diff --git a/tests/test-include-by-buffer/Makefile.am b/tests/test-include-by-buffer/Makefile.am deleted file mode 100644 index 78e43af..0000000 --- a/tests/test-include-by-buffer/Makefile.am +++ /dev/null @@ -1,49 +0,0 @@ -# This file is part of flex. - -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: - -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. - -# Neither the name of the University nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. - -# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE. - - -FLEX = $(top_builddir)/flex - -EXTRA_DIST = scanner.l test-1.input test-2.input test-3.input -CLEANFILES = scanner.c scanner.h parser.c parser.h $(testname)$(EXEEXT) OUTPUT $(OBJS) -OBJS = scanner.o # parser.o - -AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir) -#LDFLAGS = $(top_srcdir)/libfl.a -#LFLAGS = --header="scanner.h" -#YFLAGS = --defines --output=parser.c - -testname = test-include-by-buffer - -scanner.c: $(srcdir)/scanner.l - $(FLEX) $< - -parser.c: $(srcdir)/parser.y - $(BISON) $(YFLAGS) $< - -$(testname)$(EXEEXT): $(OBJS) - $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $(OBJS) $(LOADLIBES) - -test: $(testname)$(EXEEXT) - ./$(testname)$(EXEEXT) $(srcdir)/test-1.input - -.c.o: - $(CC) -c -o $@ $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) $< diff --git a/tests/test-include-by-buffer/scanner.l b/tests/test-include-by-buffer/scanner.l deleted file mode 100644 index 3224543..0000000 --- a/tests/test-include-by-buffer/scanner.l +++ /dev/null @@ -1,102 +0,0 @@ -/* - * This file is part of flex. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE. - */ - -%{ -/* A scanner file to build "scanner.c". - Input language is any text. - "#include " causes a buffer switch. - */ -#include -#include -#include "config.h" -%} - -%option 8bit outfile="scanner.c" prefix="test" -%option nounput nomain noyywrap -%option warn - -%x GET_FILENAME -%{ - -#define MAX_INCLUDE_DEPTH 10 -YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH]; -int include_stack_ptr = 0; -%} -%% - -{ -^"#include"[[:blank:]]+"<" { BEGIN(GET_FILENAME); } -.|\n { ECHO; } -} - -{ -[[:alnum:]_.-]+> { - /* recurse */ - yytext[yyleng-1]='\0'; - include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER; - if((yyin=fopen(yytext,"r"))==NULL) { - fprintf(stderr,"*** Error: Could not open include file \"%s\".\n",yytext); - yyterminate(); - } - yy_switch_to_buffer( yy_create_buffer( yyin, YY_BUF_SIZE )); - BEGIN(0); - } -.|\n { - fprintf(stderr,"Invalid input \"%s\".\n", yytext); - yyterminate(); - } -} - -<> { - if ( --include_stack_ptr < 0 ) { - yyterminate(); - } - else { - fclose(yyin); - yy_delete_buffer( YY_CURRENT_BUFFER ); - yy_switch_to_buffer( include_stack[include_stack_ptr] ); - } - } - -%% - -int main(int argc, char** argv); - -int -main ( int argc, char** argv ) -{ - FILE * fp; - if( argc != 2 ) { - fprintf(stderr,"*** Error: Must specifiy one filename.\n"); - exit(-1); - } - if((fp=fopen(argv[1],"r"))==NULL) { - fprintf(stderr,"*** Error: fopen(%s) failed.\n",argv[1]); - exit(-1); - } - yyin = fp; - yyout = stdout; - yylex(); - printf("TEST RETURNING OK.\n"); - return 0; -} diff --git a/tests/test-include-by-buffer/test-1.input b/tests/test-include-by-buffer/test-1.input deleted file mode 100644 index 355beaa..0000000 --- a/tests/test-include-by-buffer/test-1.input +++ /dev/null @@ -1,3 +0,0 @@ -Beginning of "test-1.input". -#include -End of "test-1.input". diff --git a/tests/test-include-by-buffer/test-2.input b/tests/test-include-by-buffer/test-2.input deleted file mode 100644 index 45f11f9..0000000 --- a/tests/test-include-by-buffer/test-2.input +++ /dev/null @@ -1,3 +0,0 @@ -Beginning of "test-2.input". -#include -End of "test-2.input". diff --git a/tests/test-include-by-buffer/test-3.input b/tests/test-include-by-buffer/test-3.input deleted file mode 100644 index 6a2d055..0000000 --- a/tests/test-include-by-buffer/test-3.input +++ /dev/null @@ -1,2 +0,0 @@ -Beginning of "test-3.input". -End of "test-3.input". diff --git a/tests/test-include-by-push/.gitignore b/tests/test-include-by-push/.gitignore deleted file mode 100644 index 7a7c74b..0000000 --- a/tests/test-include-by-push/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -Makefile -Makefile.in -parser.c -parser.h -scanner.c -test-include-by-push -OUTPUT diff --git a/tests/test-include-by-push/Makefile.am b/tests/test-include-by-push/Makefile.am deleted file mode 100644 index fac4a0e..0000000 --- a/tests/test-include-by-push/Makefile.am +++ /dev/null @@ -1,49 +0,0 @@ -# This file is part of flex. - -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: - -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. - -# Neither the name of the University nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. - -# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE. - - -FLEX = $(top_builddir)/flex - -EXTRA_DIST = scanner.l test-1.input test-2.input test-3.input -CLEANFILES = scanner.c scanner.h parser.c parser.h $(testname)$(EXEEXT) OUTPUT $(OBJS) -OBJS = scanner.o # parser.o - -AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir) -#LDFLAGS = $(top_srcdir)/libfl.a -#LFLAGS = --header="scanner.h" -#YFLAGS = --defines --output=parser.c - -testname = test-include-by-push - -scanner.c: $(srcdir)/scanner.l - $(FLEX) $< - -parser.c: $(srcdir)/parser.y - $(BISON) $(YFLAGS) $< - -$(testname)$(EXEEXT): $(OBJS) - $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $(OBJS) $(LOADLIBES) - -test: $(testname)$(EXEEXT) - ./$(testname)$(EXEEXT) $(srcdir)/test-1.input - -.c.o: - $(CC) -c -o $@ $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) $< diff --git a/tests/test-include-by-push/scanner.l b/tests/test-include-by-push/scanner.l deleted file mode 100644 index 8556152..0000000 --- a/tests/test-include-by-push/scanner.l +++ /dev/null @@ -1,92 +0,0 @@ -/* - * This file is part of flex. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE. - */ - -%{ -/* A scanner file to build "scanner.c". - Input language is any text. - "#include " causes a buffer switch. - */ -#include -#include -#include "config.h" -%} - -%option 8bit outfile="scanner.c" prefix="test" -%option nounput nomain noyywrap -%option warn - -%x GET_FILENAME - -%% - -{ -^"#include"[[:blank:]]+"<" { BEGIN(GET_FILENAME); } -.|\n { ECHO; } -} - -{ -[[:alnum:]_.-]+> { - /* recurse */ - yytext[yyleng-1]='\0'; - if((yyin=fopen(yytext,"r"))==NULL) { - fprintf(stderr,"*** Error: Could not open include file \"%s\".\n",yytext); - yyterminate(); - } - yypush_buffer_state( yy_create_buffer( yyin, YY_BUF_SIZE )); - BEGIN(0); - } -.|\n { - fprintf(stderr,"Invalid input \"%s\".\n", yytext); - yyterminate(); - } -} - -<> { - fclose(yyin); - yypop_buffer_state(); - if(!YY_CURRENT_BUFFER) - yyterminate(); - } - -%% - -int main(int argc, char** argv); - -int -main ( int argc, char** argv ) -{ - FILE * fp; - if( argc != 2 ) { - fprintf(stderr,"*** Error: Must specifiy one filename.\n"); - exit(-1); - } - if((fp=fopen(argv[1],"r"))==NULL) { - fprintf(stderr,"*** Error: fopen(%s) failed.\n",argv[1]); - exit(-1); - } - yyin = fp; - yyout = stdout; - yylex(); - printf("TEST RETURNING OK.\n"); - return 0; -} diff --git a/tests/test-include-by-push/test-1.input b/tests/test-include-by-push/test-1.input deleted file mode 100644 index 355beaa..0000000 --- a/tests/test-include-by-push/test-1.input +++ /dev/null @@ -1,3 +0,0 @@ -Beginning of "test-1.input". -#include -End of "test-1.input". diff --git a/tests/test-include-by-push/test-2.input b/tests/test-include-by-push/test-2.input deleted file mode 100644 index 45f11f9..0000000 --- a/tests/test-include-by-push/test-2.input +++ /dev/null @@ -1,3 +0,0 @@ -Beginning of "test-2.input". -#include -End of "test-2.input". diff --git a/tests/test-include-by-push/test-3.input b/tests/test-include-by-push/test-3.input deleted file mode 100644 index 6a2d055..0000000 --- a/tests/test-include-by-push/test-3.input +++ /dev/null @@ -1,2 +0,0 @@ -Beginning of "test-3.input". -End of "test-3.input". diff --git a/tests/test-include-by-reentrant/.gitignore b/tests/test-include-by-reentrant/.gitignore deleted file mode 100644 index a824aa3..0000000 --- a/tests/test-include-by-reentrant/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -Makefile -Makefile.in -parser.c -parser.h -scanner.c -test-include-by-reentrant -OUTPUT diff --git a/tests/test-include-by-reentrant/Makefile.am b/tests/test-include-by-reentrant/Makefile.am deleted file mode 100644 index 3f4d1d5..0000000 --- a/tests/test-include-by-reentrant/Makefile.am +++ /dev/null @@ -1,49 +0,0 @@ -# This file is part of flex. - -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: - -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. - -# Neither the name of the University nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. - -# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE. - - -FLEX = $(top_builddir)/flex - -EXTRA_DIST = scanner.l test-1.input test-2.input test-3.input -CLEANFILES = scanner.c scanner.h parser.c parser.h $(testname)$(EXEEXT) OUTPUT $(OBJS) -OBJS = scanner.o # parser.o - -AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir) -#LDFLAGS = $(top_srcdir)/libfl.a -#LFLAGS = --header="scanner.h" -#YFLAGS = --defines --output=parser.c - -testname = test-include-by-reentrant - -scanner.c: $(srcdir)/scanner.l - $(FLEX) $(LFLAGS) $< - -parser.c: $(srcdir)/parser.y - $(BISON) $(YFLAGS) $< - -$(testname)$(EXEEXT): $(OBJS) - $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $(OBJS) $(LOADLIBES) - -test: $(testname)$(EXEEXT) - ./$(testname) $(srcdir)/test-1.input - -.c.o: - $(CC) -c -o $@ $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) $< diff --git a/tests/test-include-by-reentrant/scanner.l b/tests/test-include-by-reentrant/scanner.l deleted file mode 100644 index 8d23681..0000000 --- a/tests/test-include-by-reentrant/scanner.l +++ /dev/null @@ -1,101 +0,0 @@ -/* - * This file is part of flex. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE. - */ - -%{ -/* A scanner file to build "scanner.c". - Input language is any text. - "#include " causes a new scanner to be created. - */ -#include -#include -#include "config.h" -%} - -%option 8bit outfile="scanner.c" prefix="test" -%option nounput nomain noyywrap -%option reentrant -%option warn - -%x GET_FILENAME - -%% - -{ -^"#include"[[:blank:]]+"<" { BEGIN(GET_FILENAME); } -.|\n { ECHO; } -} - -{ -[[:alnum:]_.-]+> { - /* recurse */ - yyscan_t scanner; - FILE * fp; - yytext[yyleng-1]='\0'; - if((fp=fopen(yytext,"r"))==NULL) { - fprintf(stderr,"*** Error: Could not open include file \"%s\".\n", - yytext); - yyterminate(); - } - yylex_init(&scanner); - yyset_in( fp, scanner); - yyset_out( stdout, scanner); - yylex(scanner); - yylex_destroy(scanner); - - BEGIN(0); - } -.|\n { - fprintf(stderr,"Invalid input \"%s\".\n", yytext); - yyterminate(); - } -} - -<> { fclose(yyin); yyterminate();} - -%% - -int main (int argc, char** argv); - -int -main ( argc, argv ) - int argc; - char ** argv; -{ - FILE * fp; - yyscan_t scanner; - if( argc != 2 ) { - fprintf(stderr,"*** Error: Must specifiy one filename.\n"); - exit(-1); - } - if((fp=fopen(argv[1],"r"))==NULL) { - fprintf(stderr,"*** Error: fopen(%s) failed.\n",argv[1]); - exit(-1); - } - yylex_init(&scanner); - yyset_in( fp, scanner); - yyset_out( stdout, scanner); - yylex(scanner); - yylex_destroy(scanner); - printf("TEST RETURNING OK.\n"); - return 0; -} diff --git a/tests/test-include-by-reentrant/test-1.input b/tests/test-include-by-reentrant/test-1.input deleted file mode 100644 index 355beaa..0000000 --- a/tests/test-include-by-reentrant/test-1.input +++ /dev/null @@ -1,3 +0,0 @@ -Beginning of "test-1.input". -#include -End of "test-1.input". diff --git a/tests/test-include-by-reentrant/test-2.input b/tests/test-include-by-reentrant/test-2.input deleted file mode 100644 index 45f11f9..0000000 --- a/tests/test-include-by-reentrant/test-2.input +++ /dev/null @@ -1,3 +0,0 @@ -Beginning of "test-2.input". -#include -End of "test-2.input". diff --git a/tests/test-include-by-reentrant/test-3.input b/tests/test-include-by-reentrant/test-3.input deleted file mode 100644 index 6a2d055..0000000 --- a/tests/test-include-by-reentrant/test-3.input +++ /dev/null @@ -1,2 +0,0 @@ -Beginning of "test-3.input". -End of "test-3.input". -- cgit v1.2.3