* reordered a little bit
[mascara-docs.git] / i86 / elks / elkscmd / ash / nodetypes
blobb7c680c7ec8a8d19275b7a9fe1d74647f283982a
1 #!/bin/sh -
3 # Copyright (c) 1991 The Regents of the University of California.
4 # All rights reserved.
6 # This code is derived from software contributed to Berkeley by
7 # Kenneth Almquist.
9 # Redistribution and use in source and binary forms, with or without
10 # modification, are permitted provided that the following conditions
11 # are met:
12 # 1. Redistributions of source code must retain the above copyright
13 # notice, this list of conditions and the following disclaimer.
14 # 2. Redistributions in binary form must reproduce the above copyright
15 # notice, this list of conditions and the following disclaimer in the
16 # documentation and/or other materials provided with the distribution.
17 # 3. All advertising materials mentioning features or use of this software
18 # must display the following acknowledgement:
19 # This product includes software developed by the University of
20 # California, Berkeley and its contributors.
21 # 4. Neither the name of the University nor the names of its contributors
22 # may be used to endorse or promote products derived from this software
23 # without specific prior written permission.
25 # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 # SUCH DAMAGE.
37 # @(#)nodetypes 5.1 (Berkeley) 3/7/91
39 # This file describes the nodes used in parse trees. Unindented lines
40 # contain a node type followed by a structure tag. Subsequent indented
41 # lines specify the fields of the structure. Several node types can share
42 # the same structure, in which case the fields of the structure should be
43 # specified only once.
45 # A field of a structure is described by the name of the field followed
46 # by a type. The currently implemented types are:
47 # nodeptr - a pointer to a node
48 # nodelist - a pointer to a list of nodes
49 # string - a pointer to a nul terminated string
50 # int - an integer
51 # other - any type that can be copied by assignment
52 # temp - a field that doesn't have to be copied when the node is copied
53 # The last two types should be followed by the text of a C declaration for
54 # the field.
56 NSEMI nbinary # two commands separated by a semicolon
57 type int
58 ch1 nodeptr # the first child
59 ch2 nodeptr # the second child
61 NCMD ncmd # a simple command
62 type int
63 backgnd int # set to run command in background
64 args nodeptr # the arguments
65 redirect nodeptr # list of file redirections
67 NPIPE npipe # a pipeline
68 type int
69 backgnd int # set to run pipeline in background
70 cmdlist nodelist # the commands in the pipeline
72 NREDIR nredir # redirection (of a compex command)
73 type int
74 n nodeptr # the command
75 redirect nodeptr # list of file redirections
77 NBACKGND nredir # run command in background
78 NSUBSHELL nredir # run command in a subshell
80 NAND nbinary # the && operator
81 NOR nbinary # the || operator
83 NIF nif # the if statement. Elif clauses are handled
84 type int # using multiple if nodes.
85 test nodeptr # if test
86 ifpart nodeptr # then ifpart
87 elsepart nodeptr # else elsepart
89 NWHILE nbinary # the while statement. First child is the test
90 NUNTIL nbinary # the until statement
92 NFOR nfor # the for statement
93 type int
94 args nodeptr # for var in args
95 body nodeptr # do body; done
96 var string # the for variable
98 NCASE ncase # a case statement
99 type int
100 expr nodeptr # the word to switch on
101 cases nodeptr # the list of cases (NCLIST nodes)
103 NCLIST nclist # a case
104 type int
105 next nodeptr # the next case in list
106 pattern nodeptr # list of patterns for this case
107 body nodeptr # code to execute for this case
110 NDEFUN narg # define a function. The "next" field contains
111 # the body of the function.
113 NARG narg # represents a word
114 type int
115 next nodeptr # next word in list
116 text string # the text of the word
117 backquote nodelist # list of commands in back quotes
119 NTO nfile # fd> fname
120 NFROM nfile # fd< fname
121 NAPPEND nfile # fd>> fname
122 type int
123 next nodeptr # next redirection in list
124 fd int # file descriptor being redirected
125 fname nodeptr # file name, in a NARG node
126 expfname temp char *expfname # actual file name
128 NTOFD ndup # fd<&dupfd
129 NFROMFD ndup # fd>&dupfd
130 type int
131 next nodeptr # next redirection in list
132 fd int # file descriptor being redirected
133 dupfd int # file descriptor to duplicate
135 NHERE nhere # fd<<\!
136 NXHERE nhere # fd<<!
137 type int
138 next nodeptr # next redirection in list
139 fd int # file descriptor being redirected
140 doc nodeptr # input to command (NARG node)