mirror of
git://git.savannah.nongnu.org/eliot.git
synced 2025-01-28 19:58:35 +01:00
lexer/parser function name changed yy* -> regexp*
This commit is contained in:
parent
2b829c1768
commit
e29aa11a75
3 changed files with 17 additions and 20 deletions
|
@ -16,7 +16,7 @@
|
|||
/* along with this program; if not, write to the Free Software */
|
||||
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
/*
|
||||
* $Id: dic_search.c,v 1.8 2005/04/19 20:02:55 afrab Exp $
|
||||
* $Id: dic_search.c,v 1.9 2005/04/26 16:31:45 afrab Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -39,7 +39,7 @@
|
|||
#include "scanner.h" /* generated by flex */
|
||||
#include "automaton.h"
|
||||
|
||||
extern int yyparse(yyscan_t scanner, NODE ** root);
|
||||
extern int regexpparse(yyscan_t scanner, NODE ** root);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -451,7 +451,7 @@ Dic_search_regexp_rec(struct params_regexp_t *params,
|
|||
/* 1 : the letter appears in the automaton as is */
|
||||
if (params->automaton->marque[next_state])
|
||||
{
|
||||
#ifdef DEBUG_RE
|
||||
#ifdef DEBUG_RE_SEARCH
|
||||
fprintf(stderr,"adding letter %c to partial word -%s-\n",current->chr + 'a' - 1,params->word);
|
||||
#endif
|
||||
params->word[params->wordlen] = current->chr + 'a' - 1;
|
||||
|
@ -475,7 +475,7 @@ Dic_search_regexp_rec(struct params_regexp_t *params,
|
|||
if (params->charlist->letters[i][current->chr] &&
|
||||
params->automaton->marque[next_state])
|
||||
{
|
||||
#ifdef DEBUG_RE
|
||||
#ifdef DEBUG_RE_SEARCH
|
||||
fprintf(stderr,"** special char ");
|
||||
regexp_print_letter(stderr,special_char);
|
||||
fprintf(stderr," resolves to ");
|
||||
|
@ -506,7 +506,7 @@ Dic_search_regexp_rec(struct params_regexp_t *params,
|
|||
} while (!(*current++).last);
|
||||
}
|
||||
|
||||
void yyerror (yyscan_t yyscanner, NODE** root, char const *msg)
|
||||
void regexperror (yyscan_t yyscanner, NODE** root, char const *msg)
|
||||
{
|
||||
printf("\n erreur ! (%s)\n",msg);
|
||||
}
|
||||
|
@ -541,12 +541,12 @@ Dic_search_RegE(const Dictionary dic, const char* re,
|
|||
ptl[i] = 0;
|
||||
}
|
||||
|
||||
yylex_init( &scanner );
|
||||
buf = yy_scan_string( stringbuf, scanner );
|
||||
regexplex_init( &scanner );
|
||||
buf = regexp_scan_string( stringbuf, scanner );
|
||||
root = NULL;
|
||||
value = yyparse( scanner , &root);
|
||||
yy_delete_buffer(buf,scanner);
|
||||
yylex_destroy( scanner );
|
||||
value = regexpparse( scanner , &root);
|
||||
regexp_delete_buffer(buf,scanner);
|
||||
regexplex_destroy( scanner );
|
||||
|
||||
if (value)
|
||||
{
|
||||
|
@ -578,7 +578,6 @@ Dic_search_RegE(const Dictionary dic, const char* re,
|
|||
for(i=0; i<DIC_LETTERS; i++)
|
||||
if (list->letters[0][i])
|
||||
{
|
||||
//fprintf(stderr,"%c",i+'a'-1);
|
||||
regexp_print_letter(stderr,i);
|
||||
}
|
||||
fprintf(stderr,"\n");
|
||||
|
@ -586,7 +585,6 @@ Dic_search_RegE(const Dictionary dic, const char* re,
|
|||
for(i=0; i<DIC_LETTERS; i++)
|
||||
if (list->letters[1][i])
|
||||
{
|
||||
//fprintf(stderr,"%c",i+'a'-1);
|
||||
regexp_print_letter(stderr,i);
|
||||
}
|
||||
fprintf(stderr,"\n");
|
||||
|
@ -594,7 +592,6 @@ Dic_search_RegE(const Dictionary dic, const char* re,
|
|||
for(i=0; i<DIC_LETTERS; i++)
|
||||
if (list->letters[2][i])
|
||||
{
|
||||
//fprintf(stderr,"%c",i+'a'-1);
|
||||
regexp_print_letter(stderr,i);
|
||||
}
|
||||
fprintf(stderr,"\n");
|
||||
|
|
7
dic/er.l
7
dic/er.l
|
@ -3,12 +3,11 @@
|
|||
#include "regexp.h"
|
||||
#include "libdic_a-er.h"
|
||||
|
||||
/* %option bison-locations */
|
||||
/* %option prefix="ER" */
|
||||
|
||||
%}
|
||||
%option 8bit reentrant bison-bridge
|
||||
%option prefix="regexp"
|
||||
%option outfile="lex.yy.c"
|
||||
%option header-file="scanner.h"
|
||||
%option 8bit reentrant bison-bridge
|
||||
%option nounput noyywrap
|
||||
|
||||
alphabet [a-zA-Z]
|
||||
|
|
7
dic/er.y
7
dic/er.y
|
@ -10,7 +10,7 @@
|
|||
#include "libdic_a-er.h"
|
||||
#include "scanner.h"
|
||||
|
||||
void yyerror (yyscan_t scanner, NODE** root, char const *msg);
|
||||
void regexperror (yyscan_t scanner, NODE** root, char const *msg);
|
||||
|
||||
%}
|
||||
%union {
|
||||
|
@ -19,6 +19,7 @@ void yyerror (yyscan_t scanner, NODE** root, char const *msg);
|
|||
};
|
||||
|
||||
%defines
|
||||
%name-prefix="regexp"
|
||||
%pure-parser
|
||||
%parse-param {yyscan_t yyscanner}
|
||||
%parse-param {NODE **root}
|
||||
|
@ -61,7 +62,7 @@ expr : var
|
|||
{
|
||||
$$=$1;
|
||||
}
|
||||
| expr expr
|
||||
| var expr
|
||||
{
|
||||
$$=regexp_createNODE(NODE_AND,'\0',$1,$2);
|
||||
}
|
||||
|
@ -118,7 +119,7 @@ exprdis: var
|
|||
{
|
||||
$$=$1;
|
||||
}
|
||||
| exprdis exprdis
|
||||
| var exprdis
|
||||
{
|
||||
$$=regexp_createNODE(NODE_OR,'\0',$1,$2);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue