mini-support.fix 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. FLUID '(PromptString!* !*Break);
  2. % Error-print is called when the major loop returns a NIL.
  3. SYMBOLIC PROCEDURE ERROR!-PRINT;
  4. <<PRIN2 "ERROR in grammar, current token is ";
  5. PRIN2 !#TOK!#; PRIN2 " and stack is ";
  6. PRIN2 !#STACK!#; TERPRI() >>;
  7. % The following errs out if its argument is NIL
  8. SYMBOLIC PROCEDURE FAIL!-NOT U;
  9. IF U then T
  10. else begin scalar Promptstring!*;
  11. PRIN2T "FAIL-NOT called in a concatenation";
  12. ERROR!-PRINT();
  13. PromptString!*:="Mini-Error>";
  14. U:=ContinuableERROR(997,"Failure scanning a concatenation",'(QUOTE T));
  15. IF U AND SCAN!-TERM() THEN RETURN T;
  16. return begin scalar !*Break;
  17. return Error(997, "Could not Recover from FAIL-NOT");
  18. end;
  19. end;
  20. % Invoke starts execution of a previously defined grammar.
  21. SYMBOLIC PROCEDURE INVOKE U;
  22. BEGIN SCALAR X,PromptString!*;
  23. PromptString!*:=Concat(Id2String U,">");
  24. !#IDTYPE!# := 0;
  25. !#NUMTYPE!# := 2;
  26. !#STRTYPE!# := 1;
  27. FLAG (GET (U, 'KEYS), 'KEY);
  28. DIPBLD (GET (U, 'DIPS));
  29. !#RTNOW!# := GET (U, 'RTS);
  30. !#GTNOW!# := GET (U, 'GTS);
  31. !#DIP!# := !#KEY!# := !#RT!# := !#GT!# := !#GENLABLIST!# := NIL;
  32. L: !#STACK!# := NIL;
  33. NEXT!-TOK();
  34. X := APPLY (U, NIL);
  35. IF NULL X THEN
  36. << ERROR!-PRINT();
  37. IF SCAN!-TERM() THEN <<PRIN2 ("Resuming scan"); TERPRI(); GOTO L>> >>;
  38. REMFLAG (GET (U, 'KEYS), 'KEY)
  39. END;