# $IdPath$
-SUBDIRS = libltdl tools m4 po
+SUBDIRS = libltdl m4 po
CFLAGS = @ANSI_CFLAGS@
AM_YFLAGS = -d
CLEANFILES = configure.lineno
EXTRA_DIST = config/config.rpath \
check/Makefile.inc \
+ tools/Makefile.inc \
src/Makefile.inc
include check/Makefile.inc
+include tools/Makefile.inc
include src/Makefile.inc
EXTRA_DIST += \
AC_CONFIG_FILES([Makefile
libltdl/Makefile
- tools/Makefile
- tools/re2c/Makefile
m4/Makefile
po/Makefile.in
])
+++ /dev/null
-# $IdPath$
-SUBDIRS = re2c
--- /dev/null
+# $IdPath$
+
+EXTRA_DIST += \
+ tools/re2c/Makefile.inc
+
+include tools/re2c/Makefile.inc
+++ /dev/null
-parser.c
-parser.h
-re2c
+++ /dev/null
-# $IdPath$
-AM_YFLAGS = -d
-
-INCLUDES = -I$(top_srcdir)
-
-noinst_PROGRAMS = re2c
-
-re2c_SOURCES = \
- basics.h \
- globals.h \
- ins.h \
- re.h \
- token.h \
- code.c \
- dfa.h \
- dfa.c \
- main.c \
- parse.h \
- parser.y \
- actions.c \
- scanner.h \
- scanner.c \
- substr.h \
- substr.c \
- translate.c
-
-BUILT_SOURCES = \
- parser.c \
- parser.h
-
-CLEANFILES = \
- parser.c \
- parser.h
-
-EXTRA_DIST = \
- CHANGELOG \
- NO_WARRANTY \
- README \
- scanner.re \
- re2c.1 \
- bootstrap/re2c.man \
- bootstrap/scanner.c \
- doc/loplas.ps.gz \
- doc/sample.bib \
- examples/basemmap.c \
- examples/c.re \
- examples/cmmap.re \
- examples/cnokw.re \
- examples/cunroll.re \
- examples/modula.re \
- examples/sample.re \
- examples/simple.re \
- examples/rexx/README \
- examples/rexx/rexx.l \
- examples/rexx/scanio.c \
- cleanup.pl
# $IdPath$
-AM_YFLAGS = -d
-INCLUDES = -I$(top_srcdir)
-
-noinst_PROGRAMS = re2c
+noinst_PROGRAMS += re2c
re2c_SOURCES = \
- basics.h \
- globals.h \
- ins.h \
- re.h \
- token.h \
- code.c \
- dfa.h \
- dfa.c \
- main.c \
- parse.h \
- parser.y \
- actions.c \
- scanner.h \
- scanner.c \
- substr.h \
- substr.c \
- translate.c
+ tools/re2c/basics.h \
+ tools/re2c/globals.h \
+ tools/re2c/ins.h \
+ tools/re2c/re.h \
+ tools/re2c/token.h \
+ tools/re2c/code.c \
+ tools/re2c/dfa.h \
+ tools/re2c/dfa.c \
+ tools/re2c/re2c.c \
+ tools/re2c/parse.h \
+ tools/re2c/re2c-parser.y \
+ tools/re2c/actions.c \
+ tools/re2c/scanner.h \
+ tools/re2c/scanner.c \
+ tools/re2c/substr.h \
+ tools/re2c/substr.c \
+ tools/re2c/translate.c
-BUILT_SOURCES = \
- parser.c \
- parser.h
+BUILT_SOURCES += \
+ re2c-parser.c \
+ re2c-parser.h
-CLEANFILES = \
- parser.c \
- parser.h
+CLEANFILES += \
+ re2c-parser.c \
+ re2c-parser.h
-EXTRA_DIST = \
- CHANGELOG \
- NO_WARRANTY \
- README \
- scanner.re \
- re2c.1 \
- bootstrap/re2c.man \
- bootstrap/scanner.c \
- doc/loplas.ps.gz \
- doc/sample.bib \
- examples/basemmap.c \
- examples/c.re \
- examples/cmmap.re \
- examples/cnokw.re \
- examples/cunroll.re \
- examples/modula.re \
- examples/sample.re \
- examples/simple.re \
- examples/rexx/README \
- examples/rexx/rexx.l \
- examples/rexx/scanio.c \
- cleanup.pl
+EXTRA_DIST += \
+ tools/re2c/CHANGELOG \
+ tools/re2c/NO_WARRANTY \
+ tools/re2c/README \
+ tools/re2c/scanner.re \
+ tools/re2c/re2c.1 \
+ tools/re2c/bootstrap/re2c.man \
+ tools/re2c/bootstrap/scanner.c \
+ tools/re2c/doc/loplas.ps.gz \
+ tools/re2c/doc/sample.bib \
+ tools/re2c/examples/basemmap.c \
+ tools/re2c/examples/c.re \
+ tools/re2c/examples/cmmap.re \
+ tools/re2c/examples/cnokw.re \
+ tools/re2c/examples/cunroll.re \
+ tools/re2c/examples/modula.re \
+ tools/re2c/examples/sample.re \
+ tools/re2c/examples/simple.re \
+ tools/re2c/examples/rexx/README \
+ tools/re2c/examples/rexx/rexx.l \
+ tools/re2c/examples/rexx/scanio.c \
+ tools/re2c/cleanup.pl
#include <string.h>
#include <stdio.h>
-#include "globals.h"
-#include "parse.h"
-#include "dfa.h"
+#include "tools/re2c/globals.h"
+#include "tools/re2c/parse.h"
+#include "tools/re2c/dfa.h"
static Symbol *first = NULL;
#ifndef re2c_basics_h
#define re2c_basics_h
+#if defined(__GNUC__) && !defined(inline)
+#define inline __inline__
+#endif
+
typedef unsigned int uint;
typedef unsigned char uchar, byte;
typedef unsigned short ushort, word;
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
-#include "substr.h"
-#include "globals.h"
-#include "dfa.h"
+#include "tools/re2c/substr.h"
+#include "tools/re2c/globals.h"
+#include "tools/re2c/dfa.h"
/* there must be at least one span in list; all spans must cover
* same range
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
-#include "globals.h"
-#include "substr.h"
-#include "dfa.h"
+#include "tools/re2c/globals.h"
+#include "tools/re2c/substr.h"
+#include "tools/re2c/dfa.h"
#define octCh(c) ('0' + c%8)
#define re2c_dfa_h
#include <stdio.h>
-#include "re.h"
+#include "tools/re2c/re.h"
extern void prtCh(FILE *, uchar);
extern void printSpan(FILE *, uint, uint);
#ifndef re2c_globals_h
#define re2c_globals_h
-#include "basics.h"
+#include "tools/re2c/basics.h"
extern char *fileName;
extern int sFlag;
#ifndef re2c_ins_h
#define re2c_ins_h
-#include "basics.h"
+#include "tools/re2c/basics.h"
#define nChars 256
typedef uchar Char;
+++ /dev/null
-#include <config.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "globals.h"
-#include "parse.h"
-#include "dfa.h"
-
-char *fileName;
-int sFlag = 0;
-int bFlag = 0;
-
-int main(int argc, char *argv[]){
- FILE *f;
-
- fileName = NULL;
- if(argc == 1)
- goto usage;
- while(--argc > 1){
- char *p = *++argv;
- while(*++p != '\0'){
- switch(*p){
- case 'e':
- xlat = asc2ebc;
- talx = ebc2asc;
- break;
- case 's':
- sFlag = 1;
- break;
- case 'b':
- sFlag = 1;
- bFlag = 1;
- break;
- default:
- goto usage;
- }
- }
- }
- fileName = *++argv;
- if(fileName[0] == '-' && fileName[1] == '\0'){
- fileName = "<stdin>";
- f = stdin;
- } else {
- if((f = fopen(fileName, "rt")) < 0){
- fprintf(stderr, "can't open %s\n", fileName);
- return 1;
- }
- }
- parse(f, stdout);
- return 0;
-usage:
- fputs("usage: re2c [-esb] name\n", stderr);
- return 2;
-}
#define re2c_parse_h
#include <stdio.h>
-#include "scanner.h"
-#include "re.h"
+#include "tools/re2c/scanner.h"
+#include "tools/re2c/re.h"
typedef struct Symbol {
struct Symbol *next;
+++ /dev/null
-%{
-#include <config.h>
-
-#include <time.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include "globals.h"
-#include "parse.h"
-int yyparse();
-int yylex();
-void yyerror(char*);
-
-static uint accept;
-static RegExp *spec;
-static Scanner *in;
-
-%}
-
-%start spec
-
-%union {
- Symbol *symbol;
- RegExp *regexp;
- Token *token;
- char op;
-}
-
-%token CLOSE ID CODE RANGE STRING
-
-%type <op> CLOSE
-%type <op> close
-%type <symbol> ID
-%type <token> CODE
-%type <regexp> RANGE STRING
-%type <regexp> rule look expr diff term factor primary
-
-%%
-
-spec :
- { accept = 0;
- spec = NULL; }
- | spec rule
- { spec = spec? mkAlt(spec, $2) : $2; }
- | spec decl
- ;
-
-decl : ID '=' expr ';'
- { if($1->re)
- Scanner_fatal(in, "sym already defined");
- $1->re = $3; }
- ;
-
-rule : expr look CODE
- { $$ = RegExp_new_RuleOp($1, $2, $3, accept++); }
- ;
-
-look :
- { $$ = RegExp_new_NullOp(); }
- | '/' expr
- { $$ = $2; }
- ;
-
-expr : diff
- { $$ = $1; }
- | expr '|' diff
- { $$ = mkAlt($1, $3); }
- ;
-
-diff : term
- { $$ = $1; }
- | diff '\\' term
- { $$ = mkDiff($1, $3);
- if(!$$)
- Scanner_fatal(in, "can only difference char sets");
- }
- ;
-
-term : factor
- { $$ = $1; }
- | term factor
- { $$ = RegExp_new_CatOp($1, $2); }
- ;
-
-factor : primary
- { $$ = $1; }
- | primary close
- {
- switch($2){
- case '*':
- $$ = mkAlt(RegExp_new_CloseOp($1), RegExp_new_NullOp());
- break;
- case '+':
- $$ = RegExp_new_CloseOp($1);
- break;
- case '?':
- $$ = mkAlt($1, RegExp_new_NullOp());
- break;
- }
- }
- ;
-
-close : CLOSE
- { $$ = $1; }
- | close CLOSE
- { $$ = ($1 == $2) ? $1 : '*'; }
- ;
-
-primary : ID
- { if(!$1->re)
- Scanner_fatal(in, "can't find symbol");
- $$ = $1->re; }
- | RANGE
- { $$ = $1; }
- | STRING
- { $$ = $1; }
- | '(' expr ')'
- { $$ = $2; }
- ;
-
-%%
-
-void yyerror(char* s){
- Scanner_fatal(in, s);
-}
-
-int yylex(){
- return Scanner_scan(in);
-}
-
-char *
-mystrdup(const char *str)
-{
- size_t len;
- char *copy;
-
- len = strlen(str) + 1;
- copy = malloc(len);
- memcpy(copy, str, len);
- return (copy);
-}
-
-void parse(FILE *i, FILE *o){
- char * fnamebuf;
- char * token;
- time_t now;
-
- time(&now);
-
- fputs("/* Generated by re2c 0.9.1-C on ", o);
- fprintf(o, "%-24s", ctime(&now));
- fputs(" */\n", o);
-
- in = Scanner_new(i);
-
- fprintf(o, "#line %u \"", Scanner_line(in));
- if( fileName != NULL ) {
- fnamebuf = mystrdup( fileName );
- } else {
- fnamebuf = mystrdup( "<stdin>" );
- }
- token = strtok( fnamebuf, "\\" );
- for(;;) {
- fprintf(o, "%s", token);
- token = strtok( NULL, "\\" );
- if( token == NULL ) break;
- fputs("\\\\", o);
- }
- fputs("\"\n", o);
- free( fnamebuf );
-
- while(Scanner_echo(in, o)){
- yyparse();
- if(spec)
- genCode(o, spec);
- fprintf(o, "#line %u\n", Scanner_line(in));
- }
-}
#define re2c_re_h
#include <stdio.h>
-#include "token.h"
-#include "ins.h"
+#include "tools/re2c/token.h"
+#include "tools/re2c/ins.h"
typedef struct CharPtn {
uint card;
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
-#include "globals.h"
-#include "parse.h"
+#include "tools/re2c/globals.h"
+#include "tools/re2c/parse.h"
int yyparse();
int yylex();
void yyerror(char*);
#include <stdio.h>
#include <stdlib.h>
-#include "globals.h"
-#include "parse.h"
-#include "dfa.h"
+#include "tools/re2c/globals.h"
+#include "tools/re2c/parse.h"
+#include "tools/re2c/dfa.h"
char *fileName;
int sFlag = 0;
#include <stdlib.h>
#include <string.h>
-#include "scanner.h"
-#include "parse.h"
-#include "parser.h"
+#include "tools/re2c/scanner.h"
+#include "tools/re2c/parse.h"
+#include "re2c-parser.h"
extern YYSTYPE yylval;
#define _scanner_h
#include <stdio.h>
-#include "token.h"
+#include "tools/re2c/token.h"
typedef struct Scanner {
FILE *in;
#include <stdlib.h>
#include <string.h>
-#include "scanner.h"
-#include "parse.h"
-#include "parser.h"
+#include "tools/re2c/scanner.h"
+#include "tools/re2c/parse.h"
+#include "re2c-parser.h"
extern YYSTYPE yylval;
#include <config.h>
#include <string.h>
-#include "substr.h"
+#include "tools/re2c/substr.h"
void
SubStr_out(const SubStr *s, FILE *o)
#include <stdio.h>
#include <stdlib.h>
-#include "basics.h"
+#include "tools/re2c/basics.h"
struct SubStr {
char *str;
#include <config.h>
-#include "globals.h"
+#include "tools/re2c/globals.h"
uchar asc2asc[256] = {
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,