DEADSOFTWARE

Добавлены строки в отладочную информацию класса (быстрохак)
[dsw-obn.git] / tools / Coco / Scanner.FRM
1 (* scanner module generated by Coco-R *)
2 MODULE -->modulename;
4 IMPORT Texts, SYSTEM;
6 CONST
7 EOL = 0DX;
8 EOF = 0X;
9 maxLexLen = 127;
10 -->declarations
12 TYPE
13 ErrorProc* = PROCEDURE (n: INTEGER; pos: LONGINT);
14 StartTable = ARRAY 128 OF INTEGER;
16 VAR
17 src*: Texts.Text; (*source text. To be set by the main pgm*)
18 pos*: LONGINT; (*position of current symbol*)
19 line*, col*, len*: INTEGER; (*line, column, length of current symbol*)
20 nextPos*: LONGINT; (*position of lookahead symbol*)
21 nextLine*, nextCol*, nextLen*: INTEGER; (*line, column, length of lookahead symbol*)
22 errors*: INTEGER; (*number of errors detected*)
23 Error*: ErrorProc;
25 ch: CHAR; (*current input character*)
26 r: Texts.Reader; (*global reader*)
27 chPos: LONGINT; (*position of current character*)
28 chLine: INTEGER; (*current line number*)
29 lineStart: LONGINT; (*start position of current line*)
30 apx: INTEGER; (*length of appendix*)
31 oldEols: INTEGER; (*nr. of EOLs in a comment*)
33 start: StartTable; (*start state for every character*)
36 PROCEDURE NextCh; (*return global variable ch*)
37 BEGIN
38 Texts.Read(r, ch); INC(chPos);
39 IF ch = EOL THEN INC(chLine); lineStart := chPos + 1 END
40 END NextCh;
43 PROCEDURE Comment(): BOOLEAN;
44 VAR level, startLine: INTEGER; oldLineStart: LONGINT;
45 BEGIN (*Comment*)
46 level := 1; startLine := chLine; oldLineStart := lineStart;
47 -->comment
48 END Comment;
51 PROCEDURE Get*(VAR sym: INTEGER);
52 VAR state: INTEGER; lexeme: ARRAY maxLexLen+1 OF CHAR;
54 PROCEDURE CheckLiteral;
55 BEGIN
56 IF nextLen < maxLexLen THEN lexeme[nextLen] := 0X END;
57 -->literals
58 END CheckLiteral;
60 BEGIN
61 -->GetSy1
62 IF ch > 7FX THEN ch := " " END;
63 pos := nextPos; col := nextCol; line := nextLine; len := nextLen;
64 nextPos := chPos; nextCol := SHORT(chPos - lineStart); nextLine := chLine; nextLen := 0;
65 state := start[ORD(ch)]; apx := 0;
66 LOOP
67 IF nextLen < maxLexLen THEN lexeme[nextLen] := ch END;
68 INC(nextLen);
69 NextCh;
70 IF state > 0 THEN
71 CASE state OF
72 -->GetSy2
73 END (*CASE*)
74 ELSE sym := noSym; RETURN (*NextCh already done*)
75 END (*IF*)
76 END (*LOOP*)
77 END Get;
80 PROCEDURE GetName*(pos: LONGINT; len: INTEGER; VAR s: ARRAY OF CHAR);
81 VAR i: INTEGER; r: Texts.Reader;
82 BEGIN
83 Texts.OpenReader(r, src, pos);
84 IF len >= LEN(s) THEN len := SHORT(LEN(s)) - 1 END;
85 i := 0; WHILE i < len DO Texts.Read(r, s[i]); INC(i) END;
86 s[i] := 0X
87 END GetName;
89 PROCEDURE StdErrorProc* (n: INTEGER; pos: LONGINT);
90 BEGIN INC(errors) END StdErrorProc;
92 PROCEDURE Reset* (t: Texts.Text; pos: LONGINT; errProc: ErrorProc);
93 BEGIN
94 src := t; Error := errProc;
95 Texts.OpenReader(r, src, pos);
96 chPos := pos - 1; chLine := 1; lineStart := 0;
97 oldEols := 0; apx := 0; errors := 0;
98 NextCh
99 END Reset;
101 BEGIN
102 -->initialization
103 END -->modulename.