yacclib.pas 1.7 KB

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