2
0

yacclib.pas 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. {$I-}
  2. unit YaccLib;
  3. (* Yacc Library Unit for TP Yacc Version 3.0, 6-17-91 AG *)
  4. interface
  5. const yymaxdepth = 1024;
  6. (* default stack size of parser *)
  7. type YYSType = Integer;
  8. (* default value type, may be redefined in Yacc output file *)
  9. var
  10. yychar : Integer; (* current lookahead character *)
  11. yynerrs : Integer; (* current number of syntax errors reported by the
  12. parser *)
  13. yydebug : Boolean; (* set to true to enable debugging output of parser *)
  14. procedure yyerror ( msg : String );
  15. (* error message printing routine used by the parser *)
  16. procedure yyclearin;
  17. (* delete the current lookahead token *)
  18. procedure yyaccept;
  19. (* trigger accept action of the parser; yyparse accepts returning 0, as if
  20. it reached end of input *)
  21. procedure yyabort;
  22. (* like yyaccept, but causes parser to return with value 1, as if an
  23. unrecoverable syntax error had been encountered *)
  24. procedure yyerrlab;
  25. (* causes error recovery to be started, as if a syntax error had been
  26. encountered *)
  27. procedure yyerrok;
  28. (* when in error mode, resets the parser to its normal mode of
  29. operation *)
  30. (* Flags used internally by the parser routine: *)
  31. var
  32. yyflag : ( yyfnone, yyfaccept, yyfabort, yyferror );
  33. yyerrflag : Integer;
  34. implementation
  35. procedure yyerror ( msg : String );
  36. begin
  37. writeln(msg);
  38. end(*yyerrmsg*);
  39. procedure yyclearin;
  40. begin
  41. yychar := -1;
  42. end(*yyclearin*);
  43. procedure yyaccept;
  44. begin
  45. yyflag := yyfaccept;
  46. end(*yyaccept*);
  47. procedure yyabort;
  48. begin
  49. yyflag := yyfabort;
  50. end(*yyabort*);
  51. procedure yyerrlab;
  52. begin
  53. yyflag := yyferror;
  54. end(*yyerrlab*);
  55. procedure yyerrok;
  56. begin
  57. yyerrflag := 0;
  58. end(*yyerrork*);
  59. end(*YaccLib*).