Ensure that amatch output is not binary data.

This commit is contained in:
Brian Taylor 2022-12-27 20:48:53 -08:00
parent afcab5f907
commit f137cc0c5c
2 changed files with 16 additions and 6 deletions

View File

@ -721,6 +721,7 @@ static void aerror(char *s)
{
LEXER lx = parse_lexer;
printf("%s [%s]\n", s, lx->lexer_line + lx->lexer_pos);
fflush(stdout);
cleanup_parser();
}
@ -735,12 +736,11 @@ char *get_temp_name(void)
static BOOL amatch(int t)
{
LEXER lx = parse_lexer;
if (lookahead == t) {
lookahead = lex_scan();
} else {
printf("expect = '%c' [%d] lookahead = '%c' [%d] lexer_buf %s\n",
t, t, lookahead, lookahead, lx->lexer_buf);
printf("expect = %d lookahead = %d lexer_buf \"%s\"\n",
t, lookahead, parse_lexer->lexer_buf);
aerror("amatch: syntax error");
return FALSE;
}

View File

@ -3593,7 +3593,7 @@ BOOL u_check_instance(char *line)
}
if (ps_udevice_msgs >= 1) {
if (current_subckt && subckt_msg_count == 0) {
printf("%s\n", current_subckt);
printf("\nWARNING in %s\n", current_subckt);
}
subckt_msg_count++;
printf("WARNING ");
@ -3630,22 +3630,24 @@ BOOL u_process_instance(char *nline)
if (eq(itype, "logicexp")) {
delete_instance_hdr(hdr);
behav_ret = f_logicexp(nline);
if (!behav_ret && current_subckt && ps_udevice_msgs >= 1) {
if (!behav_ret && current_subckt) {
printf("ERROR in %s\n", current_subckt);
}
if (!behav_ret && ps_udevice_exit) {
fprintf(stderr, "ERROR bad syntax in logicexp\n");
fflush(stdout);
controlled_exit(EXIT_FAILURE);
}
return behav_ret;
} else if (eq(itype, "pindly")) {
delete_instance_hdr(hdr);
behav_ret = f_pindly(nline);
if (!behav_ret && current_subckt && ps_udevice_msgs >= 1) {
if (!behav_ret && current_subckt) {
printf("ERROR in %s\n", current_subckt);
}
if (!behav_ret && ps_udevice_exit) {
fprintf(stderr, "ERROR bad syntax in pindly\n");
fflush(stdout);
controlled_exit(EXIT_FAILURE);
}
return behav_ret;
@ -3676,7 +3678,11 @@ BOOL u_process_instance(char *nline)
} else {
delete_instance_hdr(hdr);
if (ps_udevice_exit) {
if (current_subckt) {
printf("ERROR in %s\n", current_subckt);
}
fprintf(stderr, "ERROR unknown U* device\n");
fflush(stdout);
controlled_exit(EXIT_FAILURE);
}
return FALSE;
@ -3687,7 +3693,11 @@ BOOL u_process_instance(char *nline)
return TRUE;
} else {
if (ps_udevice_exit) {
if (current_subckt) {
printf("ERROR in %s\n", current_subckt);
}
fprintf(stderr, "ERROR U* device syntax error\n");
fflush(stdout);
controlled_exit(EXIT_FAILURE);
}
return FALSE;