Changeset: 9bf1ca817353 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9bf1ca817353
Modified Files:
        monetdb5/mal/mal_parser.c
Branch: headless
Log Message:

Recovery from errors
REstore the back-up administration after an error to enable continuation.


diffs (110 lines):

diff --git a/monetdb5/mal/mal_parser.c b/monetdb5/mal/mal_parser.c
--- a/monetdb5/mal/mal_parser.c
+++ b/monetdb5/mal/mal_parser.c
@@ -373,7 +373,7 @@
 static inline void
 skipToEnd(Client cntxt)
 {      char c;
-       while( (c= *CURRENT(cntxt)) != ';' && c && c !='\n') nextChar(cntxt);
+       while( (c= *CURRENT(cntxt)) != ';' && c ) nextChar(cntxt);
        if(c && c != '\n') nextChar(cntxt);
 }
 /*
@@ -1184,8 +1184,14 @@
        setModuleId(curInstr, modnme?putName(modnme,strlen(modnme)):
                        putName(cntxt->nspace->name, 
strlen(cntxt->nspace->name)));
 
-       if(isModuleDefined(cntxt->nspace,getModuleId(curInstr)) == FALSE)
-               parseError(cntxt, "<module> not defined\n");
+       if(isModuleDefined(cntxt->nspace,getModuleId(curInstr)) == FALSE) {
+               if( cntxt->backup){
+                       cntxt->curprg = cntxt->backup;
+                       cntxt->backup = 0;
+               }
+               return (MalBlkPtr) parseError(cntxt, "<module> not defined\n");
+       }
+       
 
        /* get calling parameters */
        ch= currChar(cntxt);
@@ -1200,6 +1206,10 @@
                if ((ch = currChar(cntxt)) != ',') {
                        if (ch == ')')
                                break;
+                       if( cntxt->backup){
+                               cntxt->curprg = cntxt->backup;
+                               cntxt->backup = 0;
+                       }
                        return (MalBlkPtr) parseError(cntxt,"',' expected\n");
                } else
                        nextChar(cntxt); /* skip ',' */
@@ -1244,6 +1254,10 @@
                        }
                        if( (ch=currChar(cntxt)) != ',') {
                                 if( ch==')') break;
+                               if( cntxt->backup){
+                                       cntxt->curprg = cntxt->backup;
+                                       cntxt->backup = 0;
+                               }
                                 return (MalBlkPtr) parseError(cntxt, "',' 
expected\n");
                        } else {
                                nextChar(cntxt); /* skip ',' */
@@ -1268,6 +1282,10 @@
                GDKfree(newarg);
                if (currChar(cntxt) != ')') {
                        freeInstruction(curInstr);
+                       if( cntxt->backup){
+                               cntxt->curprg = cntxt->backup;
+                               cntxt->backup = 0;
+                       }
                        return (MalBlkPtr) parseError(cntxt, "')' expected\n");
                }
                nextChar(cntxt); /* skip ')' */
@@ -1330,8 +1348,10 @@
        str modnme= NULL;
 
        curBlk= fcnHeader(cntxt,kind);
-       if( curBlk == NULL)
+       if( curBlk == NULL){
+               skipToEnd(cntxt);
                return curBlk;
+       }
        getInstrPtr(curBlk,0)->token= kind;
        curPrg = cntxt->curprg;
        curPrg->kind = kind;
@@ -1371,6 +1391,7 @@
                i = idLength(cntxt);
                if( i==0){
                        parseError(cntxt,"<identifier> expected\n");
+                       skipToEnd(cntxt);
                        return 0;
                }
                cntxt->blkmode=0;
@@ -1384,6 +1405,7 @@
                if( cntxt->nspace->isAtomModule) {
                        if (curInstr->fcn == NULL) {
                                parseError(cntxt, "<address> not found\n");
+                               skipToEnd(cntxt);
                                return 0;
                        }
                        malAtomProperty(curBlk, curInstr);
@@ -1391,6 +1413,7 @@
                skipSpace(cntxt);
        } else {
                parseError(cntxt,"'address' expected\n");
+               skipToEnd(cntxt);
                return 0;
        }
        helpInfo(cntxt, &curBlk->help);
@@ -1404,8 +1427,10 @@
        MalBlkPtr curBlk = 0;
 
        curBlk= fcnHeader(cntxt,kind);
-       if( curBlk == NULL)
+       if( curBlk == NULL){
+               skipToEnd(cntxt);
                return curBlk;
+       }
        if( MALkeyword(cntxt,"address",7)){
                str nme;
                int i;
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to