Commit | Line | Data |
---|---|---|
9b18046c | 1 | # |
69edccc9 KB |
2 | # Copyright (c) 1991, 1993 |
3 | # The Regents of the University of California. All rights reserved. | |
9b18046c KB |
4 | # |
5 | # This code is derived from software contributed to Berkeley by | |
6 | # Kenneth Almquist. | |
7 | # | |
8 | # %sccs.include.redist.sh% | |
9 | # | |
f920886d | 10 | # @(#)nodetypes 8.2 (Berkeley) %G% |
9b18046c KB |
11 | |
12 | # This file describes the nodes used in parse trees. Unindented lines | |
13 | # contain a node type followed by a structure tag. Subsequent indented | |
14 | # lines specify the fields of the structure. Several node types can share | |
15 | # the same structure, in which case the fields of the structure should be | |
16 | # specified only once. | |
17 | # | |
18 | # A field of a structure is described by the name of the field followed | |
19 | # by a type. The currently implemented types are: | |
20 | # nodeptr - a pointer to a node | |
21 | # nodelist - a pointer to a list of nodes | |
22 | # string - a pointer to a nul terminated string | |
23 | # int - an integer | |
24 | # other - any type that can be copied by assignment | |
25 | # temp - a field that doesn't have to be copied when the node is copied | |
26 | # The last two types should be followed by the text of a C declaration for | |
27 | # the field. | |
28 | ||
29 | NSEMI nbinary # two commands separated by a semicolon | |
30 | type int | |
31 | ch1 nodeptr # the first child | |
32 | ch2 nodeptr # the second child | |
33 | ||
34 | NCMD ncmd # a simple command | |
35 | type int | |
36 | backgnd int # set to run command in background | |
37 | args nodeptr # the arguments | |
38 | redirect nodeptr # list of file redirections | |
39 | ||
40 | NPIPE npipe # a pipeline | |
41 | type int | |
42 | backgnd int # set to run pipeline in background | |
43 | cmdlist nodelist # the commands in the pipeline | |
44 | ||
45 | NREDIR nredir # redirection (of a compex command) | |
46 | type int | |
47 | n nodeptr # the command | |
48 | redirect nodeptr # list of file redirections | |
49 | ||
50 | NBACKGND nredir # run command in background | |
51 | NSUBSHELL nredir # run command in a subshell | |
52 | ||
53 | NAND nbinary # the && operator | |
54 | NOR nbinary # the || operator | |
55 | ||
56 | NIF nif # the if statement. Elif clauses are handled | |
57 | type int # using multiple if nodes. | |
58 | test nodeptr # if test | |
59 | ifpart nodeptr # then ifpart | |
60 | elsepart nodeptr # else elsepart | |
61 | ||
62 | NWHILE nbinary # the while statement. First child is the test | |
63 | NUNTIL nbinary # the until statement | |
64 | ||
65 | NFOR nfor # the for statement | |
66 | type int | |
67 | args nodeptr # for var in args | |
68 | body nodeptr # do body; done | |
69 | var string # the for variable | |
70 | ||
71 | NCASE ncase # a case statement | |
72 | type int | |
73 | expr nodeptr # the word to switch on | |
74 | cases nodeptr # the list of cases (NCLIST nodes) | |
75 | ||
76 | NCLIST nclist # a case | |
77 | type int | |
78 | next nodeptr # the next case in list | |
79 | pattern nodeptr # list of patterns for this case | |
80 | body nodeptr # code to execute for this case | |
81 | ||
82 | ||
83 | NDEFUN narg # define a function. The "next" field contains | |
84 | # the body of the function. | |
85 | ||
86 | NARG narg # represents a word | |
87 | type int | |
88 | next nodeptr # next word in list | |
89 | text string # the text of the word | |
90 | backquote nodelist # list of commands in back quotes | |
91 | ||
92 | NTO nfile # fd> fname | |
93 | NFROM nfile # fd< fname | |
94 | NAPPEND nfile # fd>> fname | |
95 | type int | |
96 | next nodeptr # next redirection in list | |
97 | fd int # file descriptor being redirected | |
98 | fname nodeptr # file name, in a NARG node | |
99 | expfname temp char *expfname # actual file name | |
100 | ||
101 | NTOFD ndup # fd<&dupfd | |
102 | NFROMFD ndup # fd>&dupfd | |
103 | type int | |
104 | next nodeptr # next redirection in list | |
105 | fd int # file descriptor being redirected | |
106 | dupfd int # file descriptor to duplicate | |
f920886d CZ |
107 | vname nodeptr # file name if fd>&$var |
108 | ||
9b18046c KB |
109 | |
110 | NHERE nhere # fd<<\! | |
111 | NXHERE nhere # fd<<! | |
112 | type int | |
113 | next nodeptr # next redirection in list | |
114 | fd int # file descriptor being redirected | |
115 | doc nodeptr # input to command (NARG node) | |
1545e6b2 MT |
116 | |
117 | NNOT nnot # ! command (actually pipeline) | |
118 | type int | |
119 | com nodeptr |