From 33a3155409982b2aa10274e05c0f53691038e870 Mon Sep 17 00:00:00 2001 From: Tim Vaughan Date: Tue, 5 Jul 2016 23:24:42 +0200 Subject: [PATCH] Character parsing works. --- scheme.4th | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/scheme.4th b/scheme.4th index a4e2d07..c4d5d4c 100644 --- a/scheme.4th +++ b/scheme.4th @@ -1,5 +1,3 @@ -\ Scheme interpreter - vocabulary scheme scheme definitions @@ -165,9 +163,9 @@ parse-idx-stack parse-idx-sp ! inc-parse-idx - S" newline" str-equiv? if true exit then - S" space" str-equiv? if true exit then - S" tab" str-equiv? if true exit then + S" newline" str-equiv? if pop-parse-idx true exit then + S" space" str-equiv? if pop-parse-idx true exit then + S" tab" str-equiv? if pop-parse-idx true exit then charavailable? false = if pop-parse-idx false exit then @@ -209,9 +207,9 @@ parse-idx-stack parse-idx-sp ! inc-parse-idx inc-parse-idx - S" newline" str-equiv? if '\n' character-type exit then - S" space" str-equiv? if bl character-type exit then - S" tab" str-equiv? if 9 character-type exit then + S" newline" str-equiv? if 7 parse-idx +! '\n' character-type exit then + S" space" str-equiv? if 5 parse-idx +! bl character-type exit then + S" tab" str-equiv? if 3 parse-idx +! 9 character-type exit then nextchar character-type @@ -285,10 +283,8 @@ parse-idx-stack parse-idx-sp ! bl of ." #\space" endof '\n' of ." #\newline" endof - ." #\" emit + dup ." #\" emit endcase - - trace ; : print ( obj -- ) -- 2.20.1