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. unit h2pYaccLib;
  27. (* Yacc Library Unit for TP Yacc Version 3.0, 6-17-91 AG *)
  28. interface
  29. const yymaxdepth = 10000;
  30. (* default stack size of parser *)
  31. type YYSType = Integer;
  32. (* default value type, may be redefined in Yacc output file *)
  33. var
  34. yychar : Integer; (* current lookahead character *)
  35. yynerrs : Integer; (* current number of syntax errors reported by the
  36. parser *)
  37. yydebug : Boolean; (* set to true to enable debugging output of parser *)
  38. line_no : longint;
  39. procedure yyerror ( msg : String );
  40. (* error message printing routine used by the parser *)
  41. procedure yyclearin;
  42. (* delete the current lookahead token *)
  43. procedure yyaccept;
  44. (* trigger accept action of the parser; yyparse accepts returning 0, as if
  45. it reached end of input *)
  46. procedure yyabort;
  47. (* like yyaccept, but causes parser to return with value 1, as if an
  48. unrecoverable syntax error had been encountered *)
  49. procedure yyerrlab;
  50. (* causes error recovery to be started, as if a syntax error had been
  51. encountered *)
  52. procedure yyerrok;
  53. (* when in error mode, resets the parser to its normal mode of
  54. operation *)
  55. (* Flags used internally by the parser routine: *)
  56. var
  57. yyflag : ( yyfnone, yyfaccept, yyfabort, yyferror );
  58. yyerrflag : Integer;
  59. implementation
  60. procedure yyerror ( msg : String );
  61. begin
  62. writeln('at line ',line_no,' error : ',msg);
  63. end(*yyerrmsg*);
  64. procedure yyclearin;
  65. begin
  66. yychar := -1;
  67. end(*yyclearin*);
  68. procedure yyaccept;
  69. begin
  70. yyflag := yyfaccept;
  71. end(*yyaccept*);
  72. procedure yyabort;
  73. begin
  74. yyflag := yyfabort;
  75. end(*yyabort*);
  76. procedure yyerrlab;
  77. begin
  78. yyflag := yyferror;
  79. end(*yyerrlab*);
  80. procedure yyerrok;
  81. begin
  82. yyerrflag := 0;
  83. end(*yyerrork*);
  84. end(*YaccLib*).