mirror of
https://github.com/dschmenk/PLASMA.git
synced 2025-04-04 11:32:41 +00:00
Force compile of [ELSE] inside of [IF]
This commit is contained in:
parent
29498dc6e7
commit
a818dec4aa
@ -5,29 +5,7 @@ SRC" conio.4th"
|
||||
DEFER [ELSE] ( SKIP UNTIL [THEN] IF EXECUTED )
|
||||
: [IF] ( F -- )
|
||||
NOT IF ( SKIP CODE IN BETWEEN [ELSE] OR [THEN] )
|
||||
1 >R
|
||||
BEGIN
|
||||
BL WORD FIND IF
|
||||
CASE
|
||||
' [ELSE] OF
|
||||
R@ 1 = IF ( RESUME EXECUTING AT MATCHING [ELSE] )
|
||||
R> DROP DROP EXIT
|
||||
THEN
|
||||
ENDOF
|
||||
' [THEN] OF
|
||||
R> 1- ?DUP 0= IF ( EXIT AT FINAL [THEN] )
|
||||
DROP EXIT
|
||||
THEN
|
||||
>R
|
||||
ENDOF
|
||||
[ LATEST ] LITERAL OF ( CHECK FOR NESTED [IF] )
|
||||
R> 1+ >R
|
||||
ENDOF
|
||||
ENDCASE
|
||||
ELSE
|
||||
DROP
|
||||
THEN
|
||||
AGAIN
|
||||
[COMPILE] [ELSE]
|
||||
THEN
|
||||
; IMMEDIATE
|
||||
:NONAME ( [ELSE] )
|
||||
@ -35,6 +13,11 @@ DEFER [ELSE] ( SKIP UNTIL [THEN] IF EXECUTED )
|
||||
BEGIN
|
||||
BL WORD FIND IF
|
||||
CASE
|
||||
' [ELSE] OF
|
||||
R@ 1 = IF ( RESUME EXECUTING AT MATCHING [ELSE] )
|
||||
R> DROP DROP EXIT
|
||||
THEN
|
||||
ENDOF
|
||||
' [THEN] OF
|
||||
R> 1- ?DUP 0= IF ( EXIT AT FINAL [THEN] )
|
||||
DROP EXIT
|
||||
|
@ -2,28 +2,37 @@ SRC" plasma.4th"
|
||||
SRC" conio.4th"
|
||||
|
||||
: [THEN] ; IMMEDIATE ( PLACE HOLDER TO RESUME EXECUTION )
|
||||
DEFER [ELSE] ( SKIP UNTIL [THEN] IF EXECUTED )
|
||||
: [IF] ( F -- )
|
||||
NOT IF ( SKIP CODE IN BETWEEN [ELSE] OR [THEN] )
|
||||
1 >R
|
||||
BEGIN
|
||||
BL WORD FIND IF
|
||||
CASE
|
||||
' [THEN] OF
|
||||
R> 1- ?DUP 0= IF ( EXIT AT FINAL [THEN] )
|
||||
DROP EXIT
|
||||
THEN
|
||||
>R
|
||||
ENDOF
|
||||
[ LATEST ] LITERAL OF ( CHECK FOR NESTED [IF] )
|
||||
R> 1+ >R
|
||||
ENDOF
|
||||
ENDCASE
|
||||
ELSE
|
||||
DROP
|
||||
THEN
|
||||
AGAIN
|
||||
[COMPILE] [ELSE]
|
||||
THEN
|
||||
; IMMEDIATE
|
||||
:NONAME ( [ELSE] )
|
||||
1 >R
|
||||
BEGIN
|
||||
BL WORD FIND IF
|
||||
CASE
|
||||
' [ELSE] OF
|
||||
R@ 1 = IF ( RESUME EXECUTING AT MATCHING [ELSE] )
|
||||
R> DROP DROP EXIT
|
||||
THEN
|
||||
ENDOF
|
||||
' [THEN] OF
|
||||
R> 1- ?DUP 0= IF ( EXIT AT FINAL [THEN] )
|
||||
DROP EXIT
|
||||
THEN
|
||||
>R
|
||||
ENDOF
|
||||
' [IF] OF ( CHECK FOR NESTED [IF] )
|
||||
R> 1+ >R
|
||||
ENDOF
|
||||
ENDCASE
|
||||
ELSE
|
||||
DROP
|
||||
THEN
|
||||
AGAIN
|
||||
; IMMEDIATE IS [ELSE]
|
||||
: STRING CREATE 256 ALLOT DOES> ; ( JUST ALLOCATE THE BIGGEST STRING POSSIBLE )
|
||||
|
||||
: CONFIRM" ( -- F )
|
||||
|
Loading…
x
Reference in New Issue
Block a user