Depending on the condition either the [IFDEF] foo or the [ELSE] would get compiled as an [IF], eating words until [ELSE] or [THEN] respectively. While doing so, [IFDEF] does not get compiled to [IF], so we need to handle nested [IFDEF] to account for its [ELSE] or [THEN].
This fixes [IFDEF] not disabling the full section of code.
Thanks to Segher for pointing me in the right direction.
Cc: Segher Boessenkool segher@kernel.crashing.org Signed-off-by: Andreas Färber andreas.faerber@web.de
Signed-off-by: Segher Boessenkool segher@kernel.crashing.org
forth/lib/preprocessor.fs | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/forth/lib/preprocessor.fs b/forth/lib/preprocessor.fs index ac88885..89d478c 100644 --- a/forth/lib/preprocessor.fs +++ b/forth/lib/preprocessor.fs @@ -19,6 +19,7 @@ repeat
2dup " [IF]" strcmp 0= if 1 throw then
- 2dup " [IFDEF]" strcmp 0= if 1 throw then 2dup " [ELSE]" strcmp 0= if 2 throw then 2dup " [THEN]" strcmp 0= if 3 throw then " \" strcmp 0= if linefeed parse 2drop then
-- 1.7.3