1: /* 2: ** This is the QUEL syntax-error diagnostic routine. Yyerror() is 3: ** called whenever the parser is unable to recognize the syntax of a 4: ** user query, or the scanner discovers a lexical error. 5: ** It returns via reset(); 6: */ 7: 8: /* 9: ** The vector following is used to map error numbers for 10: ** incomplete commands. The partial command is identified 11: ** by 'Opflag' and is used to index the vector. The contents 12: ** of the vector location is the error number. The 0 entries 13: ** are for those command which can never be incomplete without 14: ** generating a syntax error from the yacc parser. In other 15: ** words, they should never happen. 16: */ 17: int Messages[] = 18: { 19: 0, /* mdRETTERM */ 20: 2502, /* mdRETR */ 21: 2503, /* mdAPP */ 22: 2504, /* mdREPL */ 23: 2505, /* mdDEL */ 24: 0, /* mdCOPY */ 25: 0, /* mdCREATE */ 26: 2506, /* mdDESTROY */ 27: 2507, /* mdHELP */ 28: 0, /* mdINDEX */ 29: 2508, /* mdMODIFY */ 30: 2509, /* mdPRINT */ 31: 0, /* mdRANGE */ 32: 0, /* mdSAVE */ 33: 0, /* mdDEFINE, not user specifiable */ 34: 2510, /* mdRET_UNI */ 35: 2511, /* mdVIEW */ 36: 0, /* mdUPDATE, not user specifiable */ 37: 0, /* mdRESETREL, not user specifiable */ 38: 2512, /* mdDISPLAY, help view, help integrity, help permit */ 39: 0, /* mdNETQRY, reserved for distr ingres */ 40: 0, /* mdMOVEREL, reserved for distr ingres */ 41: 2513, /* mdPROT */ 42: 2514, /* mdINTEG */ 43: 0, /* mdDCREATE, reserved for distr ingres */ 44: 0, /* mdWAITQRY, reserved for distr ingres */ 45: 2515 /* mdREMQM, destroy permit, destroy integrity */ 46: }; 47: 48: yyerror(num, a, b, c) 49: int num; 50: char *a, *b, *c; 51: { 52: char buff[30]; 53: register char *buf; 54: 55: buf = buff; 56: if (num == SYMERR || num == NXTCMDERR) 57: { 58: /* syntax error */ 59: a = buf; 60: b = 0; 61: switch (Lastok.toktyp) 62: { 63: case I2CONST: 64: itoa(i2deref(Lastok.tok), buf); 65: break; 66: 67: case I4CONST: 68: smove(locv(i4deref(Lastok.tok)), buf); 69: break; 70: 71: case F4CONST: 72: ftoa(f4deref(Lastok.tok), buf, 10, 3, 'n'); 73: break; 74: 75: case F8CONST: 76: ftoa(f8deref(Lastok.tok), buf, 10, 3, 'n'); 77: break; 78: 79: case SCONST: 80: smove(Lastok.tok, buf); 81: break; 82: 83: case 0: 84: a = "EOF"; 85: break; 86: 87: default: 88: syserr("bad Lastok format"); 89: } 90: } 91: # ifdef xPTR3 92: tTfp(13, 0, "yyerror: %d\n", num); 93: # endif 94: if (num == NXTCMDERR) 95: { 96: num = Messages[Opflag]; 97: b = 0; 98: } 99: error(num, iocv(yyline), a, b, c, 0); 100: 101: /* clean up and sync with monitor */ 102: endgo(); 103: 104: /* execute non-local goto */ 105: reset(); 106: } 107: int 108: neederr(errnum) 109: int errnum; 110: { 111: yyerror(errnum, 0); 112: }