h2pyacclib.pas 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. {
  2. Yacc Library Unit for TP Yacc
  3. Copyright (c) 1990-92 Albert Graef <[email protected]>
  4. Copyright (C) 1996 Berend de Boer <[email protected]>
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. $Revision: 1.2 $
  17. $Modtime: 96-08-01 14:04 $
  18. $History: YACCLIB.PAS $
  19. *
  20. * ***************** Version 2 *****************
  21. * User: Berend Date: 96-10-10 Time: 21:16
  22. * Updated in $/Lex and Yacc/tply
  23. * Updated for protected mode, windows and Delphi 1.X and 2.X.
  24. }
  25. {$I-}
  26. {$H+}
  27. unit h2pYaccLib;
  28. (* Yacc Library Unit for TP Yacc Version 3.0, 6-17-91 AG *)
  29. interface
  30. const yymaxdepth = 10000;
  31. (* default stack size of parser *)
  32. type YYSType = Integer;
  33. (* default value type, may be redefined in Yacc output file *)
  34. var
  35. yychar : Integer; (* current lookahead character *)
  36. yynerrs : Integer; (* current number of syntax errors reported by the
  37. parser *)
  38. yydebug : Boolean; (* set to true to enable debugging output of parser *)
  39. line_no : longint;
  40. procedure yyerror ( msg : String );
  41. (* error message printing routine used by the parser *)
  42. procedure yyclearin;
  43. (* delete the current lookahead token *)
  44. procedure yyaccept;
  45. (* trigger accept action of the parser; yyparse accepts returning 0, as if
  46. it reached end of input *)
  47. procedure yyabort;
  48. (* like yyaccept, but causes parser to return with value 1, as if an
  49. unrecoverable syntax error had been encountered *)
  50. procedure yyerrlab;
  51. (* causes error recovery to be started, as if a syntax error had been
  52. encountered *)
  53. procedure yyerrok;
  54. (* when in error mode, resets the parser to its normal mode of
  55. operation *)
  56. (* Flags used internally by the parser routine: *)
  57. var
  58. yyflag : ( yyfnone, yyfaccept, yyfabort, yyferror );
  59. yyerrflag : Integer;
  60. implementation
  61. procedure yyerror ( msg : String );
  62. begin
  63. writeln('at line ',line_no,' error : ',msg);
  64. end(*yyerrmsg*);
  65. procedure yyclearin;
  66. begin
  67. yychar := -1;
  68. end(*yyclearin*);
  69. procedure yyaccept;
  70. begin
  71. yyflag := yyfaccept;
  72. end(*yyaccept*);
  73. procedure yyabort;
  74. begin
  75. yyflag := yyfabort;
  76. end(*yyabort*);
  77. procedure yyerrlab;
  78. begin
  79. yyflag := yyferror;
  80. end(*yyerrlab*);
  81. procedure yyerrok;
  82. begin
  83. yyerrflag := 0;
  84. end(*yyerrork*);
  85. end(*YaccLib*).