yacclib.pas

来自「公式解析源码」· PAS 代码 · 共 64 行

PAS
64
字号

unit YaccLib;

(* Yacc Library Unit for TP Yacc Version 3.0, 6-17-91 AG *)
(* 24.3.98: repacked into an class to make code thread-safe *)

interface

const yymaxdepth = 1024;
  (* default stack size of parser *)

type YYSType = Integer;
  (* default value type, may be redefined in Yacc output file *)

  TYaccLib = class
    yychar   : Integer; (* current lookahead character *)
    yynerrs  : Integer; (* current number of syntax errors reported by the parser *)
    yydebug  : Boolean; (* set to true to enable debugging output of parser *)
    yyflag   : ( yyfnone, yyfaccept, yyfabort, yyferror );
    yyerrflag: Integer;

    procedure yyerror ( msg : String );
    procedure yyclearin;
    procedure yyaccept;
    procedure yyabort;
    procedure yyerrlab;
    procedure yyerrok;
  end; { TYaccLib }

implementation

procedure TYaccLib.yyerror ( msg : String );
  begin
{    writeln(yyoutput);
    writeln(yyoutput,msg);}
  end(*yyerrmsg*);

procedure TYaccLib.yyclearin;
  begin
    yychar := -1;
  end(*yyclearin*);

procedure TYaccLib.yyaccept;
  begin
    yyflag := yyfaccept;
  end(*yyaccept*);

procedure TYaccLib.yyabort;
  begin
    yyflag := yyfabort;
  end(*yyabort*);

procedure TYaccLib.yyerrlab;
  begin
    yyflag := yyferror;
  end(*yyerrlab*);

procedure TYaccLib.yyerrok;
  begin
    yyerrflag := 0;
  end(*yyerrork*);

end(*YaccLib*).

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?