-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathdebug-re.frt
35 lines (24 loc) · 1.16 KB
/
debug-re.frt
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
: (EMIT) DUP 32 < IF &\ EMIT BASE @ SWAP 8 BASE ! 0 <# # # # #> TYPE BASE ! ELSE EMIT THEN ;
: .s 128 0 DO I OVER BIT? IF I (EMIT) THEN LOOP DROP ;
: .FOR DUP RE-COMPILED = IF
@+ 'FORTRACK-DUMMY = IF CR "^ : MATCHING AT START" TYPE THEN
THEN ;
: .DOLLAR DUP @ 'CHECK$ = IF CELL+ CR "$ : MATCHING AT END" TYPE THEN ;
: .EXACT DUP @ 'ADVANCE-EXACT = IF
CELL+ DUP $@ CR TYPE @+ + ALIGNED THEN ;
: .CHAR DUP @ 'ADVANCE-CHAR = IF CELL+ DUP "[ " TYPE .s " ]" TYPE MAX-SET + THEN ;
: .A? DUP @ 'ADVANCE? = IF CR "? OF " TYPE CELL+ .CHAR THEN ;
: .A* DUP @ 'ADVANCE* = IF CR "* OF " TYPE CELL+ .CHAR THEN ;
: .A+ DUP @ 'ADVANCE+ = IF CR "+ OF " TYPE CELL+ .CHAR THEN ;
: .A< DUP @ 'CHECK< = IF CR "START OF WORD" TYPE CELL+ THEN ;
: .A> DUP @ 'CHECK> = IF CR "END OF WORD" TYPE CELL+ THEN ;
: .A() DUP @ 'HANDLE() = IF CELL+ @+ DUP 2 < IF DROP EXIT THEN
1 AND IF "END" ELSE "START" THEN CR TYPE " OF SUBSTING" TYPE THEN ;
: .RE .FOR BEGIN DUP @ WHILE
.DOLLAR .EXACT .CHAR .A? .A* .A+ .A< .A> .A()
REPEAT DROP ;
: .Z BEGIN C@+ DUP WHILE EMIT REPEAT 2DROP ;
: .RE-COMPILED RE-COMPILED .RE ;
: .sm SET-MATCHED .s ;
'.RE IS .RE-C
'.Z IS .Zm