2 # Copyright (c) 1991, 1993
3 # The Regents of the University of California. All rights reserved.
5 # This code is derived from software contributed to Berkeley by
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions
11 # 1. Redistributions of source code must retain the above copyright
12 # notice, this list of conditions and the following disclaimer.
13 # 2. Redistributions in binary form must reproduce the above copyright
14 # notice, this list of conditions and the following disclaimer in the
15 # documentation and/or other materials provided with the distribution.
16 # 3. All advertising materials mentioning features or use of this software
17 # must display the following acknowledgement:
18 # This product includes software developed by the University of
19 # California, Berkeley and its contributors.
20 # 4. Neither the name of the University nor the names of its contributors
21 # may be used to endorse or promote products derived from this software
22 # without specific prior written permission.
24 # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 # @(#)nodetypes 8.2 (Berkeley) 5/4/95
37 # $FreeBSD: src/bin/sh/nodetypes,v 1.6.2.2 2002/07/19 04:38:52 tjr Exp $
38 # $DragonFly: src/bin/sh/nodetypes,v 1.2 2003/06/17 04:22:50 dillon Exp $
40 # This file describes the nodes used in parse trees. Unindented lines
41 # contain a node type followed by a structure tag. Subsequent indented
42 # lines specify the fields of the structure. Several node types can share
43 # the same structure, in which case the fields of the structure should be
44 # specified only once.
46 # A field of a structure is described by the name of the field followed
47 # by a type. The currently implemented types are:
48 # nodeptr - a pointer to a node
49 # nodelist - a pointer to a list of nodes
50 # string - a pointer to a nul terminated string
52 # other - any type that can be copied by assignment
53 # temp - a field that doesn't have to be copied when the node is copied
54 # The last two types should be followed by the text of a C declaration for
57 NSEMI nbinary # two commands separated by a semicolon
59 ch1 nodeptr # the first child
60 ch2 nodeptr # the second child
62 NCMD ncmd # a simple command
64 backgnd int # set to run command in background
65 args nodeptr # the arguments
66 redirect nodeptr # list of file redirections
68 NPIPE npipe # a pipeline
70 backgnd int # set to run pipeline in background
71 cmdlist nodelist # the commands in the pipeline
73 NREDIR nredir # redirection (of a compex command)
75 n nodeptr # the command
76 redirect nodeptr # list of file redirections
78 NBACKGND nredir # run command in background
79 NSUBSHELL nredir # run command in a subshell
81 NAND nbinary # the && operator
82 NOR nbinary # the || operator
84 NIF nif # the if statement. Elif clauses are handled
85 type int # using multiple if nodes.
86 test nodeptr # if test
87 ifpart nodeptr # then ifpart
88 elsepart nodeptr # else elsepart
90 NWHILE nbinary # the while statement. First child is the test
91 NUNTIL nbinary # the until statement
93 NFOR nfor # the for statement
95 args nodeptr # for var in args
96 body nodeptr # do body; done
97 var string # the for variable
99 NCASE ncase # a case statement
101 expr nodeptr # the word to switch on
102 cases nodeptr # the list of cases (NCLIST nodes)
104 NCLIST nclist # a case
106 next nodeptr # the next case in list
107 pattern nodeptr # list of patterns for this case
108 body nodeptr # code to execute for this case
111 NDEFUN narg # define a function. The "next" field contains
112 # the body of the function.
114 NARG narg # represents a word
116 next nodeptr # next word in list
117 text string # the text of the word
118 backquote nodelist # list of commands in back quotes
120 NTO nfile # fd> fname
121 NFROM nfile # fd< fname
122 NFROMTO nfile # fd<> fname
123 NAPPEND nfile # fd>> fname
124 NCLOBBER nfile # fd>| fname
126 next nodeptr # next redirection in list
127 fd int # file descriptor being redirected
128 fname nodeptr # file name, in a NARG node
129 expfname temp char *expfname # actual file name
131 NTOFD ndup # fd<&dupfd
132 NFROMFD ndup # fd>&dupfd
134 next nodeptr # next redirection in list
135 fd int # file descriptor being redirected
136 dupfd int # file descriptor to duplicate
137 vname nodeptr # file name if fd>&$var
143 next nodeptr # next redirection in list
144 fd int # file descriptor being redirected
145 doc nodeptr # input to command (NARG node)
147 NNOT nnot # ! command (actually pipeline)