avoid error message from scanner in simple test mode

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1073 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Arnim Läuger 17 years ago
parent 0b588bae64
commit 6ccb9d3502

@ -1,5 +1,9 @@
2008-02-21 Arnim Laeuger <arniml@users.sourceforge.net>
* src/bsdl/bsdl_bison.y, src/bsdl/bsdl.h, src/bsdl/bsdl_flex.l, src/bsdl/bsdl.c:
push mode and debug through init tree to avoid error message from scanner
in simple test mode.
* src/bus/fjmem.c: merged branches/jmem to trunk
-> added fjmem bus driver

@ -104,7 +104,7 @@ int bsdl_read_file(const char *BSDL_File_Name, int mode, const char *idcode)
return -1;
}
if ((parser_priv = bsdl_parser_init(BSDL_File))) {
if ((parser_priv = bsdl_parser_init(BSDL_File, mode, bsdl_debug))) {
if (mode >= 0) {
if (mode >= 1) {
if (chain == NULL) {
@ -130,8 +130,6 @@ int bsdl_read_file(const char *BSDL_File_Name, int mode, const char *idcode)
} else
parser_priv->jtag_ctrl.part = NULL;
parser_priv->jtag_ctrl.mode = mode;
parser_priv->jtag_ctrl.debug = bsdl_debug;
parser_priv->jtag_ctrl.idcode = NULL;
bsdlparse(parser_priv);

@ -35,6 +35,8 @@
/* private data of the flex scanner
handled internally in bsdl_flex.l as yyextra */
struct scan_extra {
int mode;
int debug;
int Compile_Errors;
int Base;
};
@ -137,7 +139,7 @@ typedef struct parser_priv parser_priv_t;
void bsdl_msg(int, const char *, ...);
/* BSDL lexer declarations */
void *bsdl_flex_init(FILE *);
void *bsdl_flex_init(FILE *, int, int);
void bsdl_flex_deinit(void *);
void bsdl_flex_switch_file(void *, char *);
void bsdl_flex_switch_buffer(void *, const char *);
@ -147,7 +149,7 @@ int bsdl_flex_get_lineno(void *);
void bsdl_flex_set_bin_x(void *);
/* BSDL parser declarations */
parser_priv_t *bsdl_parser_init(FILE *);
parser_priv_t *bsdl_parser_init(FILE *, int, int);
void bsdl_parser_deinit(parser_priv_t *);
int bsdlparse(parser_priv_t *);

@ -957,7 +957,7 @@ void yyerror(parser_priv_t *priv_data, const char *error_string)
{
}
/*----------------------------------------------------------------------*/
parser_priv_t *bsdl_parser_init(FILE *f)
parser_priv_t *bsdl_parser_init(FILE *f, int mode, int debug)
{
parser_priv_t *new_priv;
@ -966,11 +966,14 @@ parser_priv_t *bsdl_parser_init(FILE *f)
return NULL;
}
new_priv->jtag_ctrl.mode = mode;
new_priv->jtag_ctrl.debug = debug;
new_priv->Reading_Package = 0;
new_priv->buffer_for_switch = NULL;
new_priv->len_buffer_for_switch = 0;
if (!(new_priv->scanner = bsdl_flex_init(f))) {
if (!(new_priv->scanner = bsdl_flex_init(f, mode, debug))) {
free(new_priv);
new_priv = NULL;
}

@ -404,11 +404,12 @@ Compliance_Patterns COMPLIANCE_PATTERNS
return(REAL_NUMBER);}
{Concatenate} {return(CONCATENATE);}
{Semicolon} {return(SEMICOLON);}
{Illegal} {bsdl_msg(BSDL_MSG_ERR,
_("Error: Illegal character %c (/%03o) at line %d:\n"),
(char)yytext[yyleng-1], (int)yytext[yyleng-1],
yylineno);
yyextra->Compile_Errors++;
{Illegal} {if (yyextra->debug || (yyextra->mode >= 0))
bsdl_msg(BSDL_MSG_ERR,
_("Illegal character %c (/%03o) at line %d:\n"),
(char)yytext[yyleng-1], (int)yytext[yyleng-1],
yylineno);
yyextra->Compile_Errors++;
return(ILLEGAL); /* Will cause syntax error */}
<<EOF>> {
yypop_buffer_state(yyscanner);
@ -416,7 +417,7 @@ Compliance_Patterns COMPLIANCE_PATTERNS
yyterminate();
}
%%
void *bsdl_flex_init(FILE *f) /* Change input file from STDIN to BSDL file */
void *bsdl_flex_init(FILE *f, int mode, int debug)
{
scan_extra_t *extra;
yyscan_t scanner;
@ -434,8 +435,10 @@ void *bsdl_flex_init(FILE *f) /* Change input file from STDIN to BSDL file */
return NULL;
}
extra->mode = mode;
extra->debug = debug;
extra->Compile_Errors = 0;
extra->Base = DECIMAL;
extra->Base = DECIMAL;
yyset_extra(extra, scanner);

Loading…
Cancel
Save