mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-06 04:02:25 +00:00
added dump text functions to beautifier.
This commit is contained in:
parent
9f6c788219
commit
886c18303e
1 changed files with 27 additions and 1 deletions
|
|
@ -662,6 +662,31 @@ BEGIN
|
||||||
END
|
END
|
||||||
END SpaceOps;
|
END SpaceOps;
|
||||||
|
|
||||||
|
PROCEDURE TextToString(VAR T : Texts.Text; VAR string : ARRAY OF CHAR);
|
||||||
|
VAR R : Texts.Reader;
|
||||||
|
ch : CHAR;
|
||||||
|
i : LONGINT;
|
||||||
|
BEGIN
|
||||||
|
COPY("", string);
|
||||||
|
Texts.OpenReader(R, T, 0);
|
||||||
|
i := 0;
|
||||||
|
WHILE Texts.Pos(R) < T.len DO
|
||||||
|
Texts.Read(R, ch);
|
||||||
|
IF ch # 0DX THEN string[i] := ch ELSE string[i] := 0AX END;
|
||||||
|
INC(i);
|
||||||
|
END;
|
||||||
|
(*string[i] := 0X;*)
|
||||||
|
END TextToString;
|
||||||
|
|
||||||
|
PROCEDURE DumpText(VAR t: Texts.Text);
|
||||||
|
VAR s : POINTER TO ARRAY OF CHAR;
|
||||||
|
BEGIN
|
||||||
|
NEW(s, t.len + 1);
|
||||||
|
COPY("", s^);
|
||||||
|
TextToString(t, s^);
|
||||||
|
Out.String(s^); Out.Ln;
|
||||||
|
END DumpText;
|
||||||
|
|
||||||
PROCEDURE Beautify*;
|
PROCEDURE Beautify*;
|
||||||
VAR bText: Texts.Text; oldNotifier: Texts.Notifier; (*expNamFnt, cmtFnt: Fonts.Font;*)
|
VAR bText: Texts.Text; oldNotifier: Texts.Notifier; (*expNamFnt, cmtFnt: Fonts.Font;*)
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
@ -680,7 +705,8 @@ BEGIN
|
||||||
SpaceFormParms(bText);
|
SpaceFormParms(bText);
|
||||||
(*FoldElems.CollapseAll(bText, {FoldElems.tempLeft});*)
|
(*FoldElems.CollapseAll(bText, {FoldElems.tempLeft});*)
|
||||||
UpdateText(bText, oldNotifier);
|
UpdateText(bText, oldNotifier);
|
||||||
Texts.CloseAscii(bText, 'test');
|
(*Texts.CloseAscii(bText, 'test');*)
|
||||||
|
DumpText(bText)
|
||||||
END
|
END
|
||||||
END Beautify;
|
END Beautify;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue