diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-28 23:04:34 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-28 23:04:34 +0000 |
commit | bcb25537d02b50ce26678defcf4f39d0c89f5b3b (patch) | |
tree | 4a8a8068c8078d893fb1036e5e5d33634f26cb7d /shell/hush_doc.txt | |
parent | cf22c89f9a7d19166fa038d3bb2bac3011f946fd (diff) | |
download | busybox-w32-bcb25537d02b50ce26678defcf4f39d0c89f5b3b.tar.gz busybox-w32-bcb25537d02b50ce26678defcf4f39d0c89f5b3b.tar.bz2 busybox-w32-bcb25537d02b50ce26678defcf4f39d0c89f5b3b.zip |
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
Diffstat (limited to 'shell/hush_doc.txt')
-rw-r--r-- | shell/hush_doc.txt | 13 |
1 files changed, 9 insertions, 4 deletions
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 @@ | |||
2 | 2 | ||
3 | Command parsing | 3 | Command parsing |
4 | 4 | ||
5 | Command parsing results in "pipe" structures. "Pipe" structure | 5 | Command parsing results in a list of "pipe" structures. |
6 | does not always correspond to what sh language calls "pipe", | 6 | This list correspond not only to usual "pipe1 || pipe2 && pipe3" |
7 | it also controls execution of if, while, etc statements. | 7 | lists, but it also controls execution of if, while, etc statements. |
8 | Every such statement is a list for hush. List consists of pipes. | ||
8 | 9 | ||
9 | struct pipe fields: | 10 | struct pipe fields: |
10 | smallint res_word - "none" for normal commands, | 11 | smallint res_word - "none" for normal commands, |
@@ -18,7 +19,7 @@ Blocks of commands { pipe; pipe; } and (pipe; pipe) are represented | |||
18 | as one pipe struct with one progs[0] element which is a "group" - | 19 | as one pipe struct with one progs[0] element which is a "group" - |
19 | struct child_prog can contain a list of pipes. Sometimes these | 20 | struct child_prog can contain a list of pipes. Sometimes these |
20 | "groups" are created implicitly, e.g. every control | 21 | "groups" are created implicitly, e.g. every control |
21 | statement (if, while, etc) sits inside its own "pipe" struct). | 22 | statement (if, while, etc) sits inside its own group. |
22 | 23 | ||
23 | res_word controls statement execution. Examples: | 24 | res_word controls statement execution. Examples: |
24 | 25 | ||
@@ -41,6 +42,10 @@ res_word=NONE followup=SEQ | |||
41 | pipe 4 res_word=NONE followup=(null) | 42 | pipe 4 res_word=NONE followup=(null) |
42 | pipe 1 res_word=NONE followup=SEQ | 43 | pipe 1 res_word=NONE followup=SEQ |
43 | 44 | ||
45 | Above you see that if is a list, and it sits in a {} group | ||
46 | implicitly created by hush. Also note two THEN res_word's - | ||
47 | it is explained below. | ||
48 | |||
44 | "if true; then { echo Hello; true; }; fi" - | 49 | "if true; then { echo Hello; true; }; fi" - |
45 | pipe 0 res_word=NONE followup=SEQ | 50 | pipe 0 res_word=NONE followup=SEQ |
46 | prog 0 group {}: | 51 | prog 0 group {}: |