home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / compcomp / tpyacc / yacclib.pas < prev    next >
Pascal/Delphi Source File  |  1991-06-17  |  2KB  |  83 lines

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