Additions for non-correcting error recovery
This commit is contained in:
@@ -19,11 +19,17 @@ LLmessage(tk) {
|
||||
error("end of file expected");
|
||||
}
|
||||
else if (tk) {
|
||||
#ifndef LLNONCORR
|
||||
error("%s missing before %s", symbol2str(tk), symbol2str(DOT));
|
||||
#endif
|
||||
insert_token(tk);
|
||||
}
|
||||
else {
|
||||
#ifndef LLNONCORR
|
||||
error("%s deleted", symbol2str(DOT));
|
||||
#else
|
||||
error("%s not expected", symbol2str(DOT));
|
||||
#endif
|
||||
}
|
||||
tk_nmb_at_last_syn_err = token_nmb;
|
||||
}
|
||||
|
||||
@@ -145,6 +145,7 @@ single_decl_specifier /* non_empty */ (register struct decspecs *ds;)
|
||||
ds->ds_typedef = 1;
|
||||
}
|
||||
|
|
||||
%erroneous
|
||||
IDENTIFIER
|
||||
{
|
||||
error("%s is not a type identifier", dot.tk_idf->id_text);
|
||||
@@ -154,6 +155,9 @@ single_decl_specifier /* non_empty */ (register struct decspecs *ds;)
|
||||
dot.tk_idf->id_def->df_sc = TYPEDEF;
|
||||
}
|
||||
}
|
||||
|
|
||||
%illegal
|
||||
IDENTIFIER
|
||||
|
|
||||
struct_or_union_specifier(&ds->ds_type)
|
||||
|
|
||||
|
||||
@@ -12,7 +12,7 @@ SRC_DIR = \
|
||||
TABGEN= $(UTIL_BIN)/tabgen
|
||||
LLGEN = $(UTIL_BIN)/LLgen
|
||||
LLGENOPTIONS = \
|
||||
-v
|
||||
-n
|
||||
|
||||
SRC_G = $(SRC_DIR)/program.g $(SRC_DIR)/declar.g \
|
||||
$(SRC_DIR)/expression.g $(SRC_DIR)/statement.g $(SRC_DIR)/ival.g
|
||||
@@ -64,7 +64,7 @@ SRC_C = \
|
||||
$(SRC_DIR)/type.c \
|
||||
$(SRC_DIR)/util.c
|
||||
GEN_C = tokenfile.c program.c declar.c expression.c statement.c ival.c \
|
||||
symbol2str.c char.c Lpars.c next.c
|
||||
symbol2str.c char.c Lpars.c next.c Lncor.c
|
||||
CFILES= $(SRC_C) $(GEN_C)
|
||||
|
||||
SRC_H = \
|
||||
@@ -196,6 +196,7 @@ clean:
|
||||
LLfiles: $(GFILES)
|
||||
$(LLGEN) $(LLGENOPTIONS) $(GFILES)
|
||||
@touch LLfiles
|
||||
@if [ -f Lncor.c ] ; then : ; else touch Lncor.c ; fi
|
||||
|
||||
hfiles: Parameters $(SRC_DIR)/make.hfiles
|
||||
$(SRC_DIR)/make.hfiles Parameters
|
||||
|
||||
@@ -20,11 +20,17 @@ LLmessage(tk) {
|
||||
error("end of file expected");
|
||||
}
|
||||
else if (tk) {
|
||||
#ifndef LLNONCORR
|
||||
error("%s missing before %s", symbol2str(tk), symbol2str(DOT));
|
||||
#endif
|
||||
insert_token(tk);
|
||||
}
|
||||
else {
|
||||
#ifndef LLNONCORR
|
||||
error("%s deleted", symbol2str(DOT));
|
||||
#else
|
||||
error("%s not expected", symbol2str(DOT));
|
||||
#endif
|
||||
}
|
||||
tk_nmb_at_last_syn_err = token_nmb;
|
||||
}
|
||||
|
||||
@@ -134,6 +134,7 @@ single_type_specifier(register struct decspecs *ds;):
|
||||
%default TYPE_IDENTIFIER /* this includes INT, CHAR, etc. */
|
||||
{idf2type(dot.tk_idf, &ds->ds_type);}
|
||||
|
|
||||
%erroneous
|
||||
IDENTIFIER
|
||||
{
|
||||
error("%s is not a type identifier", dot.tk_idf->id_text);
|
||||
@@ -143,6 +144,9 @@ single_type_specifier(register struct decspecs *ds;):
|
||||
dot.tk_idf->id_def->df_sc = TYPEDEF;
|
||||
}
|
||||
}
|
||||
|
|
||||
%illegal
|
||||
IDENTIFIER
|
||||
|
|
||||
struct_or_union_specifier(&ds->ds_type)
|
||||
|
|
||||
|
||||
@@ -23,6 +23,8 @@ extern struct expr *intexpr();
|
||||
primary(register struct expr **expp;) :
|
||||
IDENTIFIER
|
||||
{dot2expr(expp);}
|
||||
|
|
||||
%illegal TYPE_IDENTIFIER
|
||||
|
|
||||
constant(expp)
|
||||
|
|
||||
|
||||
@@ -12,7 +12,7 @@ SRC_DIR = \
|
||||
TABGEN= $(UTIL_BIN)/tabgen
|
||||
LLGEN = $(UTIL_BIN)/LLgen
|
||||
LLGENOPTIONS = \
|
||||
-v
|
||||
-n
|
||||
|
||||
SRC_G = $(SRC_DIR)/program.g $(SRC_DIR)/declar.g \
|
||||
$(SRC_DIR)/expression.g $(SRC_DIR)/statement.g $(SRC_DIR)/ival.g
|
||||
@@ -64,7 +64,7 @@ SRC_C = \
|
||||
$(SRC_DIR)/stab.c
|
||||
|
||||
GEN_C = tokenfile.c program.c declar.c expression.c statement.c ival.c \
|
||||
symbol2str.c char.c Lpars.c next.c
|
||||
symbol2str.c char.c Lpars.c next.c Lncor.c
|
||||
CFILES= $(SRC_C) $(GEN_C)
|
||||
|
||||
SRC_H = \
|
||||
@@ -193,6 +193,7 @@ clean:
|
||||
LLfiles: $(GFILES)
|
||||
$(LLGEN) $(LLGENOPTIONS) $(GFILES)
|
||||
@touch LLfiles
|
||||
@if [ -f Lncor.c ] ; then : ; else touch Lncor.c ; fi
|
||||
|
||||
hfiles: Parameters $(SRC_DIR)/make.hfiles
|
||||
$(SRC_DIR)/make.hfiles Parameters
|
||||
|
||||
Reference in New Issue
Block a user