-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.a68
executable file
·60 lines (47 loc) · 1.26 KB
/
main.a68
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
PR include "var.a68" PR;
PR include "types.a68" PR;
PR include "themes.a68" PR;
PR include "ops.a68" PR;
PR include "funcs.a68" PR;
PR include "term.a68" PR;
PR include "lexer.a68" PR;
PR include "file.a68" PR;
PR include "print.a68" PR;
BEGIN
STRING
title y := "0",
title w := "0";
BOOL
started params := FALSE;
PROC set title pos = VOID: VOID(system("tput cup " + title y + " " + title w));
print(new line);
FOR i TO argc DO
STRING arg = argv(i);
IF NOT started params THEN
IF arg = "--" THEN
started params := TRUE
FI;
GO TO done
FI;
RES file = read file(arg);
IF status OF file /= 0 THEN
print(( bold red cl, "✗ ", arg, ": ", red cl, "Doesn't exist", reset cl, new line ));
GO TO done
FI;
title y := whole(y OF get cursor pos - 2, 0);
title w := whole(2 + UPB arg + 2, 0);
print(( bold green cl, "✔ ", arg, ":", reset cl, new line ));
[] TOKEN tokens = lexer(
source OF file,
(INT counter, BOOL skip) VOID: (
set title pos;
print(( fixed(counter / UPB source OF file * 100, -0, 3), " %" ))
)
);
set title pos;
print(( " ", new line ));
print tokens(tokens);
print( new line );
done: ~
OD
END