aboutsummaryrefslogtreecommitdiff
path: root/sys/cmd/rc/exec.c
diff options
context:
space:
mode:
authorNicholas Noll <nnoll523@gmail.com>2021-10-26 12:35:22 -0700
committerNicholas Noll <nnoll523@gmail.com>2021-10-26 12:35:22 -0700
commit2416a8654e3c1a4b74fcc0379dac5294670a1f46 (patch)
treeeb63703a92b035752674b9ab97a310fe58b2862a /sys/cmd/rc/exec.c
parent47e1e78da8eba4d755179d61a16f2c7920d2da39 (diff)
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.
Diffstat (limited to 'sys/cmd/rc/exec.c')
-rw-r--r--sys/cmd/rc/exec.c25
1 files changed, 25 insertions, 0 deletions
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)