From 2416a8654e3c1a4b74fcc0379dac5294670a1f46 Mon Sep 17 00:00:00 2001 From: Nicholas Noll Date: Tue, 26 Oct 2021 12:35:22 -0700 Subject: feat(rc): keywords now recognized. for and while loop Prototypes for loops sketched. This required recognizing keywords and returning from yylex. Debugging/testing will be required. --- sys/cmd/rc/exec.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'sys/cmd/rc/exec.c') diff --git a/sys/cmd/rc/exec.c b/sys/cmd/rc/exec.c index fbcfb9b..5f3c6d6 100644 --- a/sys/cmd/rc/exec.c +++ b/sys/cmd/rc/exec.c @@ -656,6 +656,31 @@ Xfalse(void) runner->code.i = runner->code.exe[runner->code.i].i; } +void +Xgoto(void) +{ + runner->code.i = runner->code.exe[runner->code.i].i; +} + +void +Xfor(void) +{ + if(!runner->args->word){ + poplist(); + runner->code.i = runner->code.exe[runner->code.i].i; + }else{ + freelist(runner->local->val); + + runner->local->val = runner->args->word; + runner->local->new = 1; + runner->args->word = runner->args->word->link; + + runner->local->val->link = nil; + runner->code.i++; + } + +} + static Word* catlist(Word *l, Word *r, Word *tail) -- cgit v1.2.1