⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 prettier.pas

📁 一个Pascal语言分析器
💻 PAS
字号:
UNIT Prettier;
(* Pretty printing auxiliary functions for use with TASTE pretty printing
   program generated by COCO from an attributed grammar
   P.D. Terry, Rhodes University, 1995 *)

INTERFACE

  VAR
    results : TEXT;

  PROCEDURE Append (Str : STRING);
  (* Append Str to results file *)

  PROCEDURE IndentNextLine;
  (* Write line mark to results file and prepare to indent further lines
     by two spaces more than before *)

  PROCEDURE ExdentNextLine;
  (* Write line mark to results file and prepare to indent further lines
     by two spaces less *)

  PROCEDURE NewLine;
  (* Write line mark to results file but leave indentation as before *)

  PROCEDURE Indent;
  PROCEDURE Exdent;

IMPLEMENTATION

  VAR
    Indentation : INTEGER;

  PROCEDURE Append (Str : STRING);
    BEGIN
      Write(results, Str);
    END;

  PROCEDURE NewLine;
    VAR
      I : INTEGER;
    BEGIN
      WriteLn(results);
      FOR I := 1 TO Indentation DO Write(results, ' ');
    END;

  PROCEDURE IndentNextLine;
    BEGIN
      INC(Indentation, 2); NewLine
    END;

  PROCEDURE ExdentNextLine;
    BEGIN
      DEC(Indentation, 2); NewLine
    END;

  PROCEDURE Indent;
    BEGIN
      INC(Indentation, 2)
    END;

  PROCEDURE Exdent;
    BEGIN
      DEC(Indentation, 2)
    END;

  BEGIN
    Indentation := 0
  END.

⌨️ 快捷键说明

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