From bcb25537d02b50ce26678defcf4f39d0c89f5b3b Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Mon, 28 Jul 2008 23:04:34 +0000 Subject: hush: implement break and continue function old new delta bltins 252 276 +24 builtin_continue - 12 +12 builtin_break - 12 +12 static.version_str 18 17 -1 run_list 1984 1948 -36 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 1/2 up/down: 48/-27) Total: 11 bytes --- shell/hush_doc.txt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'shell/hush_doc.txt') diff --git a/shell/hush_doc.txt b/shell/hush_doc.txt index 39f7dcee5..c68dc2416 100644 --- a/shell/hush_doc.txt +++ b/shell/hush_doc.txt @@ -2,9 +2,10 @@ Command parsing -Command parsing results in "pipe" structures. "Pipe" structure -does not always correspond to what sh language calls "pipe", -it also controls execution of if, while, etc statements. +Command parsing results in a list of "pipe" structures. +This list correspond not only to usual "pipe1 || pipe2 && pipe3" +lists, but it also controls execution of if, while, etc statements. +Every such statement is a list for hush. List consists of pipes. struct pipe fields: smallint res_word - "none" for normal commands, @@ -18,7 +19,7 @@ Blocks of commands { pipe; pipe; } and (pipe; pipe) are represented as one pipe struct with one progs[0] element which is a "group" - struct child_prog can contain a list of pipes. Sometimes these "groups" are created implicitly, e.g. every control -statement (if, while, etc) sits inside its own "pipe" struct). +statement (if, while, etc) sits inside its own group. res_word controls statement execution. Examples: @@ -41,6 +42,10 @@ res_word=NONE followup=SEQ pipe 4 res_word=NONE followup=(null) pipe 1 res_word=NONE followup=SEQ +Above you see that if is a list, and it sits in a {} group +implicitly created by hush. Also note two THEN res_word's - +it is explained below. + "if true; then { echo Hello; true; }; fi" - pipe 0 res_word=NONE followup=SEQ prog 0 group {}: -- cgit v1.2.3