cast 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,8 @@
1
+ /*.gem
2
+ /Gemfile.lock
3
+ /ext/Makefile
4
+ /ext/*.bundle
5
+ /ext/*.o
6
+ /ext/yylex.c
7
+ /lib/cast/c.tab.rb
8
+ /lib/cast/cast.bundle
@@ -0,0 +1,50 @@
1
+ == 0.2.0 2012-05-14
2
+
3
+ * Works with Ruby 1.8.6, 1.8.7, 1.9.2, 1.9.3.
4
+ * MIT License.
5
+ * Friendlier changelog.
6
+ * Added C::Preprocessor, which wraps Config::CONFIG['CPP']. Assumes
7
+ POSIX-style -D and -I options.
8
+ * IntLiteral suffixes are parsed correctly for things like 2e-2.
9
+ * Newlines are allowed in StringLiterals and CharLiterals.
10
+ * Added StringLiteral and CharLiteral #prefix. #wide? and #wide are
11
+ now methods, not fields.
12
+ * IntLiteral and FloatLiteral #format is now the first field.
13
+ * More meaningful parse error messages.
14
+ * Printing (#to_s):
15
+ * FunctionDef#no_prototype? is now honored.
16
+ * ':' is now printed for labels.
17
+ * Consequetive unary operators no longer conflict with other
18
+ operators (e.g. "+ +" instead of "++").
19
+ * Sizeof is printed with parentheses (not mandated by C99, but
20
+ conventional).
21
+ * Signedness qualifier is always printed for char.
22
+ * Longness is printed correctly for Bool, Complex, Imaginary.
23
+ * Nested Conditionals are handled correctly.
24
+ * MemberInit#member is printed correctly.
25
+ * Parsing (#parse):
26
+ * Member now works.
27
+ * Expression now supports CompoundLiterals without types (as
28
+ allowed in declarators only).
29
+ * Declarator allows specification of #num_bits.
30
+
31
+ == 0.1.0 2006-04-25
32
+
33
+ * Faster lexer (written in C).
34
+ * Renamed Node#to_debug to Node#inspect.
35
+ * Allow type names in Call#args. (Not C99, but useful for macros.)
36
+ * Added node fields:
37
+ * StringLiteral#wide?
38
+ * CharLiteral#wide?
39
+ * IntLiteral#suffix
40
+ * FloatLiteral#format
41
+ * FloatLiteral#suffix
42
+ * Fixed CompoundLiteral#to_s.
43
+ * Fixed AssignmentExpression#to_s when #lval is a Comma.
44
+ * Fixed Parameter#to_s when #type is nil.
45
+ * Cleaned up load path.
46
+ * Install with rake task.
47
+
48
+ == 0.0.1 2005-02-21
49
+
50
+ * Hi.
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source :rubygems
2
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License
2
+
3
+ Copyright (c) George Ogata
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,1948 @@
1
+ # CAST
2
+
3
+ C parser and abstract syntax tree for Ruby.
4
+
5
+ ## Example
6
+
7
+ require 'cast'
8
+
9
+ source = File.read('file.c')
10
+ ast = C.parse(source)
11
+ ast.entities.each do |declaration|
12
+ declaration.declarator.each do |declarator|
13
+ puts "#{declarator.name}: declarator.type"
14
+ end
15
+ end
16
+
17
+ Or in irb:
18
+
19
+ irb> ast = C.parse('int main(void) { return 0; }')
20
+ => TranslationUnit
21
+ entities:
22
+ - FunctionDef
23
+ type: Function
24
+ type: Int
25
+ params: []
26
+ name: "main"
27
+ def: Block
28
+ stmts:
29
+ - Return
30
+ expr: IntLiteral
31
+ val: 0
32
+
33
+ irb> puts ast
34
+ int main(void) {
35
+ return 0;
36
+ }
37
+ => nil
38
+
39
+ ## Nodes
40
+
41
+ `C.parse` returns a tree of `Node` objects. Here's the class hierarchy:
42
+
43
+ <div class="node_classes">
44
+ <style scoped="scoped">
45
+ div.node_classes .node_class_abstract {
46
+ font-weight: bold;
47
+ }
48
+ div.node_classes .column {
49
+ line-height: 120%;
50
+ float: left;
51
+ color: #222;
52
+ }
53
+ div.node_classes .spacer {
54
+ display: float;
55
+ clear: both;
56
+ }
57
+ </style>
58
+ <ul class="column">
59
+ <li class="node_class"><span class="node_class_abstract">Node</span><ul>
60
+ <li class="node_class"><span class="node_class_concrete">TranslationUnit</span></li>
61
+ <li class="node_class"><span class="node_class_concrete">Comment</span></li>
62
+ <li class="node_class"><span class="node_class_concrete">Declaration</span></li>
63
+ <li class="node_class"><span class="node_class_concrete">Declarator</span></li>
64
+ <li class="node_class"><span class="node_class_concrete">FunctionDef</span></li>
65
+ <li class="node_class"><span class="node_class_concrete">Parameter</span></li>
66
+ <li class="node_class"><span class="node_class_concrete">Enumerator</span></li>
67
+ <li class="node_class"><span class="node_class_concrete">MemberInit</span></li>
68
+ <li class="node_class"><span class="node_class_concrete">Member</span></li>
69
+ <li class="node_class"><span class="node_class_abstract">Statement</span><ul>
70
+ <li class="node_class"><span class="node_class_concrete">Block</span></li>
71
+ <li class="node_class"><span class="node_class_concrete">If</span></li>
72
+ <li class="node_class"><span class="node_class_concrete">Switch</span></li>
73
+ <li class="node_class"><span class="node_class_concrete">While</span></li>
74
+ <li class="node_class"><span class="node_class_concrete">For</span></li>
75
+ <li class="node_class"><span class="node_class_concrete">Goto</span></li>
76
+ <li class="node_class"><span class="node_class_concrete">Continue</span></li>
77
+ <li class="node_class"><span class="node_class_concrete">Break</span></li>
78
+ <li class="node_class"><span class="node_class_concrete">Return</span></li>
79
+ <li class="node_class"><span class="node_class_concrete">ExpressionStatement</span></li>
80
+ </ul></li>
81
+ <li class="node_class"><span class="node_class_abstract">Label</span><ul>
82
+ <li class="node_class"><span class="node_class_concrete">PlainLabel</span></li>
83
+ <li class="node_class"><span class="node_class_concrete">Default</span></li>
84
+ <li class="node_class"><span class="node_class_concrete">Case</span></li>
85
+ </ul></li>
86
+ <li class="node_class"><span class="node_class_abstract">Type</span><ul>
87
+ <li class="node_class"><span class="node_class_abstract">IndirectType</span><ul>
88
+ <li class="node_class"><span class="node_class_concrete">Pointer</span></li>
89
+ <li class="node_class"><span class="node_class_concrete">Array</span></li>
90
+ <li class="node_class"><span class="node_class_concrete">Function</span></li>
91
+ </ul></li>
92
+ <li class="node_class"><span class="node_class_abstract">DirectType</span><ul>
93
+ <li class="node_class"><span class="node_class_concrete">Struct</span></li>
94
+ <li class="node_class"><span class="node_class_concrete">Union</span></li>
95
+ <li class="node_class"><span class="node_class_concrete">Enum</span></li>
96
+ <li class="node_class"><span class="node_class_concrete">CustomType</span></li>
97
+ <li class="node_class"><span class="node_class_abstract">PrimitiveType</span><ul>
98
+ <li class="node_class"><span class="node_class_concrete">Void</span></li>
99
+ <li class="node_class"><span class="node_class_concrete">Int</span></li>
100
+ <li class="node_class"><span class="node_class_concrete">Float</span></li>
101
+ <li class="node_class"><span class="node_class_concrete">Char</span></li>
102
+ <li class="node_class"><span class="node_class_concrete">Bool</span></li>
103
+ <li class="node_class"><span class="node_class_concrete">Complex</span></li>
104
+ <li class="node_class"><span class="node_class_concrete">Imaginary</span></li>
105
+ </ul></li>
106
+ </ul></li>
107
+ </ul></li>
108
+ </ul></li>
109
+ </ul>
110
+ <ul class="column">
111
+ <li class="node_class"><span class="node_class_abstract">Node</span><ul>
112
+ <li class="node_class"><span class="node_class_abstract">Expression</span><ul>
113
+ <li class="node_class"><span class="node_class_concrete">Comma</span></li>
114
+ <li class="node_class"><span class="node_class_concrete">Conditional</span></li>
115
+ <li class="node_class"><span class="node_class_concrete">Variable</span></li>
116
+ <li class="node_class"><span class="node_class_abstract">UnaryExpression</span><ul>
117
+ <li class="node_class"><span class="node_class_abstract">PostfixExpression</span><ul>
118
+ <li class="node_class"><span class="node_class_concrete">Index</span></li>
119
+ <li class="node_class"><span class="node_class_concrete">Call</span></li>
120
+ <li class="node_class"><span class="node_class_concrete">Dot</span></li>
121
+ <li class="node_class"><span class="node_class_concrete">Arrow</span></li>
122
+ <li class="node_class"><span class="node_class_concrete">PostInc</span></li>
123
+ <li class="node_class"><span class="node_class_concrete">PostDec</span></li>
124
+ </ul></li>
125
+ <li class="node_class"><span class="node_class_abstract">PrefixExpression</span><ul>
126
+ <li class="node_class"><span class="node_class_concrete">Cast</span></li>
127
+ <li class="node_class"><span class="node_class_concrete">Address</span></li>
128
+ <li class="node_class"><span class="node_class_concrete">Dereference</span></li>
129
+ <li class="node_class"><span class="node_class_concrete">Sizeof</span></li>
130
+ <li class="node_class"><span class="node_class_concrete">Plus</span></li>
131
+ <li class="node_class"><span class="node_class_concrete">Minus</span></li>
132
+ <li class="node_class"><span class="node_class_concrete">PreInc</span></li>
133
+ <li class="node_class"><span class="node_class_concrete">PreDec</span></li>
134
+ <li class="node_class"><span class="node_class_concrete">BitNot</span></li>
135
+ <li class="node_class"><span class="node_class_concrete">Not</span></li>
136
+ </ul></li>
137
+ </ul></li>
138
+ <li class="node_class"><span class="node_class_abstract">BinaryExpression</span><ul>
139
+ <li class="node_class"><span class="node_class_concrete">Add</span></li>
140
+ <li class="node_class"><span class="node_class_concrete">Subtract</span></li>
141
+ <li class="node_class"><span class="node_class_concrete">Multiply</span></li>
142
+ <li class="node_class"><span class="node_class_concrete">Divide</span></li>
143
+ <li class="node_class"><span class="node_class_concrete">Mod</span></li>
144
+ <li class="node_class"><span class="node_class_concrete">Equal</span></li>
145
+ <li class="node_class"><span class="node_class_concrete">NotEqual</span></li>
146
+ <li class="node_class"><span class="node_class_concrete">Less</span></li>
147
+ <li class="node_class"><span class="node_class_concrete">More</span></li>
148
+ <li class="node_class"><span class="node_class_concrete">LessOrEqual</span></li>
149
+ <li class="node_class"><span class="node_class_concrete">MoreOrEqual</span></li>
150
+ <li class="node_class"><span class="node_class_concrete">BitAnd</span></li>
151
+ <li class="node_class"><span class="node_class_concrete">BitOr</span></li>
152
+ <li class="node_class"><span class="node_class_concrete">BitXor</span></li>
153
+ <li class="node_class"><span class="node_class_concrete">ShiftLeft</span></li>
154
+ <li class="node_class"><span class="node_class_concrete">ShiftRight</span></li>
155
+ <li class="node_class"><span class="node_class_concrete">And</span></li>
156
+ <li class="node_class"><span class="node_class_concrete">Or</span></li>
157
+ </ul></li>
158
+ </ul></li>
159
+ </ul></li>
160
+ </ul>
161
+ <ul class="column">
162
+ <li class="node_class"><span class="node_class_abstract">Node</span><ul>
163
+ <li class="node_class"><span class="node_class_abstract">Expression</span><ul>
164
+ <li class="node_class"><span class="node_class_abstract">AssignmentExpression</span><ul>
165
+ <li class="node_class"><span class="node_class_concrete">Assign</span></li>
166
+ <li class="node_class"><span class="node_class_concrete">MultiplyAssign</span></li>
167
+ <li class="node_class"><span class="node_class_concrete">DivideAssign</span></li>
168
+ <li class="node_class"><span class="node_class_concrete">ModAssign</span></li>
169
+ <li class="node_class"><span class="node_class_concrete">AddAssign</span></li>
170
+ <li class="node_class"><span class="node_class_concrete">SubtractAssign</span></li>
171
+ <li class="node_class"><span class="node_class_concrete">ShiftLeftAssign</span></li>
172
+ <li class="node_class"><span class="node_class_concrete">ShiftRightAssign</span></li>
173
+ <li class="node_class"><span class="node_class_concrete">BitAndAssign</span></li>
174
+ <li class="node_class"><span class="node_class_concrete">BitXorAssign</span></li>
175
+ <li class="node_class"><span class="node_class_concrete">BitOrAssign</span></li>
176
+ </ul></li>
177
+ <li class="node_class"><span class="node_class_abstract">Literal</span><ul>
178
+ <li class="node_class"><span class="node_class_concrete">StringLiteral</span></li>
179
+ <li class="node_class"><span class="node_class_concrete">CharLiteral</span></li>
180
+ <li class="node_class"><span class="node_class_concrete">CompoundLiteral</span></li>
181
+ <li class="node_class"><span class="node_class_concrete">IntLiteral</span></li>
182
+ <li class="node_class"><span class="node_class_concrete">FloatLiteral</span></li>
183
+ </ul></li>
184
+ </ul></li>
185
+ <li class="node_class"><span class="node_class_abstract">NodeList</span><ul>
186
+ <li class="node_class"><span class="node_class_concrete">NodeArray</span></li>
187
+ <li class="node_class"><span class="node_class_concrete">NodeChain</span></li>
188
+ </ul></li>
189
+ </ul></li>
190
+ </ul>
191
+ <div class="spacer"></div>
192
+ </div>
193
+
194
+ The <span class="node_class_abstract">highlighted</span> ones are abstract.
195
+
196
+ The last 2 (`NodeList`s) represent lists of `Node`s. They quack like
197
+ standard ruby `Arrays`. `NodeChain` is a doubly linked list;
198
+ `NodeArray` is an array.
199
+
200
+ ### Node Methods
201
+
202
+ * `parent`: return the parent in the tree (a `Node` or nil).
203
+ * `pos`, `pos=`: the position in the source file (a `Node::Pos`).
204
+ * `to_s`: return the code for the tree (a `String`).
205
+ * `inspect`: return a pretty string for inspection, makes irb fun.
206
+ * `match?(str)`, `=~(str)`: return true iff str parses as a `Node`
207
+ equal to this one.
208
+ * `detach`: remove this node from the tree (parent becomes nil) and
209
+ return it.
210
+ * `detached?`, `attached?`: return true if parent is nil or non-nil
211
+ respectively.
212
+ * `replace_with(node)`: replace this node with node in the tree.
213
+ * `swap_with(node)`: exchange this node with node in their trees.
214
+ * `insert_prev(*nodes)`, `insert_next(*nodes)`: insert nodes before
215
+ this node in the parent list. Parent must be a `NodeList`! Useful
216
+ for adding statements before a node in a block, for example.
217
+ * `Foo?`: (where `Foo` is a module name) return `self.is_a?(Foo)`.
218
+ This is a convienience for a common need. Example:
219
+
220
+ <pre>
221
+ \# print all global variables
222
+ ast.entities.each do |node|
223
+ node.Declaration? or next
224
+ node.declarators.each do |decl|
225
+ unless decl.type.Function?
226
+ puts "#{decl.name}: #{decl.type}"
227
+ end
228
+ end
229
+ end
230
+ </pre>
231
+
232
+ The `=~` method lets you do:
233
+
234
+ if declarator.type =~ 'const int *'
235
+ puts "Ooh, a const int pointer!"
236
+ end
237
+
238
+ This is not the same as `declarator.type.to_s == 'const int *'`;
239
+ that'd require you to guess how `to_s` formats its strings (most
240
+ notably, the whitespace).
241
+
242
+ ### Fields and Children
243
+
244
+ The big table down below lists the *fields* of each `Node`. A field is
245
+ an attribute which:
246
+
247
+ * is used in equality checks (`==` and `eql?`).
248
+ * are copied recursively by `dup` and `clone`.
249
+
250
+ Fields listed as *children* form the tree structure. They only have a
251
+ `Node` or `nil` value, and are yielded/returned/affected by the
252
+ traversal methods:
253
+
254
+ * `next`, `prev`: return the next/prev sibling.
255
+ * `list_next`, `list_prev`: like `next`/`prev`, but also requires the
256
+ parent to be `NodeList`. I'll be honest; I don't remember why I
257
+ added these methods. They may well suddenly disappear.
258
+ * `each`, `reverse_each`: Yield all (non-nil) children. `Node`
259
+ includes `Enumerable`, so, you know.
260
+ * `depth_first`, `reverse_depth_first`: Walk the tree in that order,
261
+ yielding two args (event, node) at each node. event is `:down` on
262
+ the way down, `:up` on the way up. If the block throws `:prune`, it
263
+ won't descend any further.
264
+ * `preorder`, `reverse_preorder`, `postorder`, `reverse_postorder`:
265
+ Walk the tree depth first, yielding nodes in the given order. For
266
+ the preorders, if the block throws `:prune`, it won't descend any
267
+ further.
268
+ * `node_after(child)`, `node_before(child)`: return the node
269
+ before/after child (same as `child.next`).
270
+ * `remove_node(child)`: remove child from this node (same as
271
+ `child.detach`).
272
+ * `replace_node(child, new_child)`: replace child with yeah you
273
+ guessed it (same as `child.replace_with(newchild)`).
274
+
275
+ Note: don't modify the tree during traversal!
276
+
277
+ Other notes about the table:
278
+
279
+ * Field names that end in '?' are always true-or-false.
280
+ * If no default is listed:
281
+ * it is false if the field name ends in a '?'
282
+ * it is a `NodeArray` if it is a `NodeList`.
283
+ * it is `nil` otherwise.
284
+
285
+ <table class="node_desc" cellspacing="0">
286
+ <style>
287
+ table.node_desc tr.first_field td {
288
+ border-top: 1px solid black;
289
+ }
290
+
291
+ table.node_desc tr.first_field table td {
292
+ border: none;
293
+ }
294
+
295
+ table.node_desc td {
296
+ padding: 3px;
297
+ vertical-align: top;
298
+ {
299
+
300
+ table.node_desc table td {
301
+ padding: 0px;
302
+ {
303
+ </style>
304
+
305
+ <tr>
306
+ <th align="center">Class</th>
307
+ <th align="center">Field</th>
308
+ <th align="center">Type / values</th>
309
+ <th align="center">Default</th>
310
+ <th align="center">Comments</th>
311
+ </tr>
312
+
313
+ <tr class="first_field">
314
+ <td class="nd_class" rowspan="1"><tt>TranslationUnit</tt></td>
315
+ <td class="nd_field"><tt>entities *</tt></td>
316
+ <td class="nd_values"><tt>NodeList</tt></td>
317
+ <td class="nd_default"><tt>NodeChain[]</tt></td>
318
+ <td class="nd_comments" rowspan="1">
319
+ The root of a parsed file.
320
+ </td>
321
+ </tr>
322
+
323
+ <tr class="first_field">
324
+ <td class="nd_class" rowspan="4"><tt>Declaration</tt></td>
325
+ <td class="nd_field"><tt>storage</tt></td>
326
+ <td class="nd_values"><tt>:typedef</tt>, <tt>:extern</tt>, <tt>:static</tt>, <tt>:auto</tt>, <tt>:register</tt></td>
327
+ <td class="nd_default"></td>
328
+ <td class="nd_comments" rowspan="4">
329
+ Also:
330
+ <ul>
331
+ <li><tt>#typedef? </tt> -- true iff <tt>storage == :typedef </tt></li>
332
+ <li><tt>#extern? </tt> -- true iff <tt>storage == :extern </tt></li>
333
+ <li><tt>#static? </tt> -- true iff <tt>storage == :static </tt></li>
334
+ <li><tt>#auto? </tt> -- true iff <tt>storage == :auto </tt></li>
335
+ <li><tt>#register?</tt> -- true iff <tt>storage == :register</tt></li>
336
+ </ul>
337
+ </td>
338
+ </tr>
339
+ <tr>
340
+ <td class="nd_field"><tt>type *</tt></td>
341
+ <td class="nd_values"><tt>DirectType</tt></td>
342
+ <td class="nd_default"></td>
343
+ </tr>
344
+ <tr>
345
+ <td class="nd_field"><tt>declarators *</tt></td>
346
+ <td class="nd_values"><tt>NodeList</tt></td>
347
+ <td class="nd_default"><tt>NodeArray[]</tt></td>
348
+ </tr>
349
+ <tr>
350
+ <td class="nd_field"><tt>inline?</tt></td>
351
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
352
+ <td class="nd_default"></td>
353
+ </tr>
354
+
355
+ <tr class="first_field">
356
+ <td class="nd_class" rowspan="4"><tt>Declarator</tt></td>
357
+ <td class="nd_field"><tt>indirect_type *</tt></td>
358
+ <td class="nd_values"><tt>IndirectType</tt></td>
359
+ <td class="nd_default"></td>
360
+ <td class="nd_comments" rowspan="4">
361
+ What's a "declarator?" Consider "<tt>int i, *ip;</tt>". This is
362
+ a <tt>Declaration</tt> with two <tt>Declarator</tt>s:
363
+ <pre>
364
+ Declaration
365
+ type: Int
366
+ declarators:
367
+ - Declarator
368
+ name: "i"
369
+ - Declarator
370
+ indirect_type: Pointer
371
+ name: "ip"
372
+ </pre>
373
+ The <tt>indirect_type</tt> of the <tt>ip</tt>
374
+ <tt>Declarator</tt> is a <tt>Pointer</tt> to <tt>nil</tt>.
375
+ To get the complete type of the variable use:
376
+ <ul>
377
+ <li>
378
+ <tt>#type</tt> -- return the complete type. This is a clone;
379
+ modifying it won't modify the tree.
380
+ </li>
381
+ </ul>
382
+ So calling <tt>#type</tt> on the <tt>ip</tt> <tt>Declarator</tt>
383
+ gives:
384
+ <pre>
385
+ Pointer
386
+ type: Int
387
+ </pre>
388
+ </td>
389
+ </tr>
390
+ <tr>
391
+ <td class="nd_field"><tt>name</tt></td>
392
+ <td class="nd_values"><tt>String</tt></td>
393
+ <td class="nd_default"></td>
394
+ </tr>
395
+ <tr>
396
+ <td class="nd_field"><tt>init *</tt></td>
397
+ <td class="nd_values"><tt>Expression</tt></td>
398
+ <td class="nd_default"></td>
399
+ </tr>
400
+ <tr>
401
+ <td class="nd_field"><tt>num_bits *</tt></td>
402
+ <td class="nd_values"><tt>Integer</tt></td>
403
+ <td class="nd_default"></td>
404
+ </tr>
405
+
406
+ <tr class="first_field">
407
+ <td class="nd_class" rowspan="6"><tt>FunctionDef</tt></td>
408
+ <td class="nd_field"><tt>storage</tt></td>
409
+ <td class="nd_values"><tt>:extern</tt>, <tt>:static</tt></td>
410
+ <td class="nd_default"></td>
411
+ <td class="nd_comments" rowspan="6">
412
+ Also:
413
+ <ul>
414
+ <li><tt>#extern?</tt> -- return true iff <tt>storage == :extern</tt></li>
415
+ <li><tt>#static?</tt> -- return true iff <tt>storage == :static</tt></li>
416
+ <li><tt>#prototype?</tt> -- same as !no_prototype?</li>
417
+ <li><tt>#prototype=(val)</tt> -- same as no_prototype = !val</li>
418
+ </ul>
419
+ <tt>no_prototype?</tt> means that no prototype was given. That means parameter types weren't given in the parens, but in the "old-style" declaration list. Example:
420
+ <table>
421
+ <tr><td style="padding: 0px 25px">
422
+ <pre>
423
+ int main(argc, argv)
424
+ int argc;
425
+ char **argv;
426
+ {
427
+ return 0;
428
+ }</pre>
429
+ </td><td style="padding: 0px 25px">
430
+ <pre>
431
+ int main(int argc, char **argv) {
432
+ return 0;
433
+ }</pre>
434
+ </td></tr>
435
+ <tr>
436
+ <th>No prototype</th>
437
+ <th>Prototype</th>
438
+ </tr>
439
+ </table>
440
+ Everyone tells you to use prototypes. That's because no type
441
+ checking is done when calling a function declared without a
442
+ prototype.
443
+ </td>
444
+ </tr>
445
+ <tr>
446
+ <td class="nd_field"><tt>inline?</tt></td>
447
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
448
+ <td class="nd_default"></td>
449
+ </tr>
450
+ <tr>
451
+ <td class="nd_field"><tt>type *</tt></td>
452
+ <td class="nd_values"><tt>Type</tt></td>
453
+ <td class="nd_default"></td>
454
+ </tr>
455
+ <tr>
456
+ <td class="nd_field"><tt>name</tt></td>
457
+ <td class="nd_values"><tt>String</tt></td>
458
+ <td class="nd_default"></td>
459
+ </tr>
460
+ <tr>
461
+ <td class="nd_field"><tt>def *</tt></td>
462
+ <td class="nd_values"><tt>Block</tt></td>
463
+ <td class="nd_default"><tt>Block.new</tt></td>
464
+ </tr>
465
+ <tr>
466
+ <td class="nd_field"><tt>no_prototype?</tt></td>
467
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
468
+ <td class="nd_default"></td>
469
+ </tr>
470
+
471
+ <tr class="first_field">
472
+ <td class="nd_class" rowspan="3"><tt>Parameter</tt></td>
473
+ <td class="nd_field"><tt>register?</tt></td>
474
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
475
+ <td class="nd_default"></td>
476
+ <td class="nd_comments" rowspan="3">
477
+ Used in <tt>Function</tt>s.
478
+ </td>
479
+ </tr>
480
+ <tr>
481
+ <td class="nd_field"><tt>type *</tt></td>
482
+ <td class="nd_values"><tt>Type</tt></td>
483
+ <td class="nd_default"></td>
484
+ </tr>
485
+ <tr>
486
+ <td class="nd_field"><tt>name</tt></td>
487
+ <td class="nd_values"><tt>String</tt></td>
488
+ <td class="nd_default"></td>
489
+ </tr>
490
+
491
+ <tr class="first_field">
492
+ <td class="nd_class" rowspan="2"><tt>Enumerator</tt></td>
493
+ <td class="nd_field"><tt>name</tt></td>
494
+ <td class="nd_values"><tt>String</tt></td>
495
+ <td class="nd_default"></td>
496
+ <td class="nd_comments" rowspan="2">
497
+ Used in <tt>Enum</tt>s.
498
+ </td>
499
+ </tr>
500
+ <tr>
501
+ <td class="nd_field"><tt>val *</tt></td>
502
+ <td class="nd_values"><tt>Expression</tt></td>
503
+ <td class="nd_default"></td>
504
+ </tr>
505
+
506
+ <tr class="first_field">
507
+ <td class="nd_class" rowspan="2"><tt>MemberInit</tt></td>
508
+ <td class="nd_field"><tt>member *</tt></td>
509
+ <td class="nd_values"><tt>NodeList</tt> of (<tt>Member</tt> or <tt>Expression</tt>)</td>
510
+ <td class="nd_default"></td>
511
+ <td class="nd_comments" rowspan="2">
512
+ Used in <tt>CompoundLiteral</tt>s.
513
+ </td>
514
+ </tr>
515
+ <tr>
516
+ <td class="nd_field"><tt>init *</tt></td>
517
+ <td class="nd_values"><tt>Expression</tt></td>
518
+ <td class="nd_default"></td>
519
+ </tr>
520
+
521
+ <tr class="first_field">
522
+ <td class="nd_class" rowspan="1"><tt>Member</tt></td>
523
+ <td class="nd_field"><tt>name</tt></td>
524
+ <td class="nd_values"><tt>String</tt></td>
525
+ <td class="nd_default"></td>
526
+ <td class="nd_comments" rowspan="1">
527
+ Used in <tt>MemberInit</tt>s.
528
+ </td>
529
+ </tr>
530
+
531
+ <tr class="first_field">
532
+ <td class="nd_class" rowspan="2"><tt>Block</tt></td>
533
+ <td class="nd_field"><tt>labels *</tt></td>
534
+ <td class="nd_values"><tt>NodeList</tt> of <tt>Label</tt></td>
535
+ <td class="nd_default"><tt>NodeArray[]</tt></td>
536
+ <td class="nd_comments" rowspan="2">
537
+ </td>
538
+ </tr>
539
+ <tr>
540
+ <td class="nd_field"><tt>stmts *</tt></td>
541
+ <td class="nd_values"><tt>NodeList</tt> of (<tt>Statement</tt> or <tt>Declaration</tt> or <tt>Comment</tt>)</td>
542
+ <td class="nd_default"><tt>NodeArray[]</tt></td>
543
+ </tr>
544
+
545
+ <tr class="first_field">
546
+ <td class="nd_class" rowspan="4"><tt>If</tt></td>
547
+ <td class="nd_field"><tt>labels *</tt></td>
548
+ <td class="nd_values"><tt>NodeList</tt> of <tt>Label</tt></td>
549
+ <td class="nd_default"><tt>NodeArray[]</tt></td>
550
+ <td class="nd_comments" rowspan="4">
551
+ </td>
552
+ </tr>
553
+ <tr>
554
+ <td class="nd_field"><tt>cond *</tt></td>
555
+ <td class="nd_values"><tt>Expression</tt></td>
556
+ <td class="nd_default"></td>
557
+ </tr>
558
+ <tr>
559
+ <td class="nd_field"><tt>then *</tt></td>
560
+ <td class="nd_values"><tt>Statement</tt></td>
561
+ <td class="nd_default"></td>
562
+ </tr>
563
+ <tr>
564
+ <td class="nd_field"><tt>else *</tt></td>
565
+ <td class="nd_values"><tt>Statement</tt></td>
566
+ <td class="nd_default"></td>
567
+ </tr>
568
+
569
+ <tr class="first_field">
570
+ <td class="nd_class" rowspan="3"><tt>Switch</tt></td>
571
+ <td class="nd_field"><tt>labels *</tt></td>
572
+ <td class="nd_values"><tt>NodeList</tt> of <tt>Label</tt></td>
573
+ <td class="nd_default"><tt>NodeArray[]</tt></td>
574
+ <td class="nd_comments" rowspan="3">
575
+ </td>
576
+ </tr>
577
+ <tr>
578
+ <td class="nd_field"><tt>cond *</tt></td>
579
+ <td class="nd_values"><tt>Expression</tt></td>
580
+ <td class="nd_default"></td>
581
+ </tr>
582
+ <tr>
583
+ <td class="nd_field"><tt>stmt *</tt></td>
584
+ <td class="nd_values"><tt>Statement</tt></td>
585
+ <td class="nd_default"></td>
586
+ </tr>
587
+
588
+ <tr class="first_field">
589
+ <td class="nd_class" rowspan="4"><tt>While</tt></td>
590
+ <td class="nd_field"><tt>labels *</tt></td>
591
+ <td class="nd_values"><tt>NodeList</tt> of <tt>Label</tt></td>
592
+ <td class="nd_default"><tt>NodeArray[]</tt></td>
593
+ <td class="nd_comments" rowspan="4">
594
+ <tt>do?</tt> means it's a do-while loop.
595
+ </td>
596
+ </tr>
597
+ <tr>
598
+ <td class="nd_field"><tt>do?</tt></td>
599
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
600
+ <td class="nd_default"></td>
601
+ </tr>
602
+ <tr>
603
+ <td class="nd_field"><tt>cond *</tt></td>
604
+ <td class="nd_values"><tt>Expression</tt></td>
605
+ <td class="nd_default"></td>
606
+ </tr>
607
+ <tr>
608
+ <td class="nd_field"><tt>stmt *</tt></td>
609
+ <td class="nd_values"><tt>Statement</tt></td>
610
+ <td class="nd_default"></td>
611
+ </tr>
612
+
613
+ <tr class="first_field">
614
+ <td class="nd_class" rowspan="5"><tt>For</tt></td>
615
+ <td class="nd_field"><tt>labels *</tt></td>
616
+ <td class="nd_values"><tt>NodeList</tt> of <tt>Label</tt></td>
617
+ <td class="nd_default"><tt>NodeArray[]</tt></td>
618
+ <td class="nd_comments" rowspan="5">
619
+ </td>
620
+ </tr>
621
+ <tr>
622
+ <td class="nd_field"><tt>init *</tt></td>
623
+ <td class="nd_values"><tt>Expression</tt> or <tt>Declaration</tt></td>
624
+ <td class="nd_default"></td>
625
+ </tr>
626
+ <tr>
627
+ <td class="nd_field"><tt>cond *</tt></td>
628
+ <td class="nd_values"><tt>Expression</tt></td>
629
+ <td class="nd_default"></td>
630
+ </tr>
631
+ <tr>
632
+ <td class="nd_field"><tt>iter *</tt></td>
633
+ <td class="nd_values"><tt>Expression</tt></td>
634
+ <td class="nd_default"></td>
635
+ </tr>
636
+ <tr>
637
+ <td class="nd_field"><tt>stmt *</tt></td>
638
+ <td class="nd_values"><tt>Statement</tt></td>
639
+ <td class="nd_default"></td>
640
+ </tr>
641
+
642
+ <tr class="first_field">
643
+ <td class="nd_class" rowspan="2"><tt>Goto</tt></td>
644
+ <td class="nd_field"><tt>labels *</tt></td>
645
+ <td class="nd_values"><tt>NodeList</tt> of <tt>Label</tt></td>
646
+ <td class="nd_default"><tt>NodeArray[]</tt></td>
647
+ <td class="nd_comments" rowspan="2">
648
+ </td>
649
+ </tr>
650
+ <tr>
651
+ <td class="nd_field"><tt>target</tt></td>
652
+ <td class="nd_values"><tt>String</tt></td>
653
+ <td class="nd_default"></td>
654
+ </tr>
655
+
656
+ <tr class="first_field">
657
+ <td class="nd_class" rowspan="1"><tt>Continue</tt></td>
658
+ <td class="nd_field"><tt>labels *</tt></td>
659
+ <td class="nd_values"><tt>NodeList</tt> of <tt>Label</tt></td>
660
+ <td class="nd_default"><tt>NodeArray[]</tt></td>
661
+ <td class="nd_comments" rowspan="1">
662
+ </td>
663
+ </tr>
664
+
665
+ <tr class="first_field">
666
+ <td class="nd_class" rowspan="1"><tt>Break</tt></td>
667
+ <td class="nd_field"><tt>labels *</tt></td>
668
+ <td class="nd_values"><tt>NodeList</tt> of <tt>Label</tt></td>
669
+ <td class="nd_default"><tt>NodeArray[]</tt></td>
670
+ <td class="nd_comments" rowspan="1">
671
+ </td>
672
+ </tr>
673
+
674
+ <tr class="first_field">
675
+ <td class="nd_class" rowspan="2"><tt>Return</tt></td>
676
+ <td class="nd_field"><tt>labels *</tt></td>
677
+ <td class="nd_values"><tt>NodeList</tt> of <tt>Label</tt></td>
678
+ <td class="nd_default"><tt>NodeArray[]</tt></td>
679
+ <td class="nd_comments" rowspan="2">
680
+ </td>
681
+ </tr>
682
+ <tr>
683
+ <td class="nd_field"><tt>expr *</tt></td>
684
+ <td class="nd_values"><tt>Expression</tt></td>
685
+ <td class="nd_default"></td>
686
+ </tr>
687
+
688
+ <tr class="first_field">
689
+ <td class="nd_class" rowspan="2"><tt>ExpressionStatement</tt></td>
690
+ <td class="nd_field"><tt>labels *</tt></td>
691
+ <td class="nd_values"><tt>NodeList</tt> of <tt>Label</tt></td>
692
+ <td class="nd_default"><tt>NodeArray[]</tt></td>
693
+ <td class="nd_comments" rowspan="2">
694
+ </td>
695
+ </tr>
696
+ <tr>
697
+ <td class="nd_field"><tt>expr *</tt></td>
698
+ <td class="nd_values"><tt>Expression</tt></td>
699
+ <td class="nd_default"></td>
700
+ </tr>
701
+
702
+ <tr class="first_field">
703
+ <td class="nd_class" rowspan="1"><tt>PlainLabel</tt></td>
704
+ <td class="nd_field"><tt>name</tt></td>
705
+ <td class="nd_values"><tt>String</tt></td>
706
+ <td class="nd_default"></td>
707
+ <td class="nd_comments" rowspan="1">
708
+ </td>
709
+ </tr>
710
+
711
+ <tr class="first_field">
712
+ <td class="nd_class" rowspan="1"><tt>Default</tt></td>
713
+ <td class="nd_field"></td>
714
+ <td class="nd_values"></td>
715
+ <td class="nd_default"></td>
716
+ <td class="nd_comments" rowspan="1">
717
+ </td>
718
+ </tr>
719
+
720
+ <tr class="first_field">
721
+ <td class="nd_class" rowspan="1"><tt>Case</tt></td>
722
+ <td class="nd_field"><tt>expr *</tt></td>
723
+ <td class="nd_values"><tt>Expression</tt></td>
724
+ <td class="nd_default"></td>
725
+ <td class="nd_comments" rowspan="1">
726
+ </td>
727
+ </tr>
728
+
729
+ <tr class="first_field">
730
+ <td class="nd_class" rowspan="1"><tt>Comma</tt></td>
731
+ <td class="nd_field"><tt>exprs *</tt></td>
732
+ <td class="nd_values"><tt>NodeList</tt> of <tt>Expression</tt></td>
733
+ <td class="nd_default"></td>
734
+ <td class="nd_comments" rowspan="1">
735
+ </td>
736
+ </tr>
737
+
738
+ <tr class="first_field">
739
+ <td class="nd_class" rowspan="3"><tt>Conditional</tt></td>
740
+ <td class="nd_field"><tt>cond *</tt></td>
741
+ <td class="nd_values"><tt>Expression</tt></td>
742
+ <td class="nd_default"></td>
743
+ <td class="nd_comments" rowspan="3">
744
+ </td>
745
+ </tr>
746
+ <tr>
747
+ <td class="nd_field"><tt>then *</tt></td>
748
+ <td class="nd_values"><tt>Expression</tt></td>
749
+ <td class="nd_default"></td>
750
+ </tr>
751
+ <tr>
752
+ <td class="nd_field"><tt>else *</tt></td>
753
+ <td class="nd_values"><tt>Expression</tt></td>
754
+ <td class="nd_default"></td>
755
+ </tr>
756
+
757
+ <tr class="first_field">
758
+ <td class="nd_class" rowspan="1"><tt>Variable</tt></td>
759
+ <td class="nd_field"><tt>name</tt></td>
760
+ <td class="nd_values"><tt>String</tt></td>
761
+ <td class="nd_default"></td>
762
+ <td class="nd_comments" rowspan="1">
763
+ </td>
764
+ </tr>
765
+
766
+ <tr class="first_field">
767
+ <td class="nd_class" rowspan="2"><tt>Index</tt></td>
768
+ <td class="nd_field"><tt>expr *</tt></td>
769
+ <td class="nd_values"><tt>Expression</tt></td>
770
+ <td class="nd_default"></td>
771
+ <td class="nd_comments" rowspan="2">
772
+ </td>
773
+ </tr>
774
+ <tr>
775
+ <td class="nd_field"><tt>index *</tt></td>
776
+ <td class="nd_values"><tt>Expression</tt></td>
777
+ <td class="nd_default"></td>
778
+ </tr>
779
+
780
+ <tr class="first_field">
781
+ <td class="nd_class" rowspan="2"><tt>Call</tt></td>
782
+ <td class="nd_field"><tt>expr *</tt></td>
783
+ <td class="nd_values"><tt>Expression</tt></td>
784
+ <td class="nd_default"></td>
785
+ <td class="nd_comments" rowspan="2">
786
+ </td>
787
+ </tr>
788
+ <tr>
789
+ <td class="nd_field"><tt>args *</tt></td>
790
+ <td class="nd_values"><tt>NodeList</tt> of (<tt>Expression</tt> or <tt>Type</tt>)</td>
791
+ <td class="nd_default"></td>
792
+ </tr>
793
+
794
+ <tr class="first_field">
795
+ <td class="nd_class" rowspan="2"><tt>Dot</tt></td>
796
+ <td class="nd_field"><tt>expr *</tt></td>
797
+ <td class="nd_values"><tt>Expression</tt></td>
798
+ <td class="nd_default"></td>
799
+ <td class="nd_comments" rowspan="2">
800
+ </td>
801
+ </tr>
802
+ <tr>
803
+ <td class="nd_field"><tt>member *</tt></td>
804
+ <td class="nd_values"><tt>String</tt></td>
805
+ <td class="nd_default"></td>
806
+ </tr>
807
+
808
+ <tr class="first_field">
809
+ <td class="nd_class" rowspan="2"><tt>Arrow</tt></td>
810
+ <td class="nd_field"><tt>expr *</tt></td>
811
+ <td class="nd_values"><tt>Expression</tt></td>
812
+ <td class="nd_default"></td>
813
+ <td class="nd_comments" rowspan="2">
814
+ </td>
815
+ </tr>
816
+ <tr>
817
+ <td class="nd_field"><tt>member *</tt></td>
818
+ <td class="nd_values"><tt>String</tt></td>
819
+ <td class="nd_default"></td>
820
+ </tr>
821
+
822
+ <tr class="first_field">
823
+ <td class="nd_class" rowspan="1"><tt>PostInc</tt></td>
824
+ <td class="nd_field"><tt>expr *</tt></td>
825
+ <td class="nd_values"><tt>Expression</tt></td>
826
+ <td class="nd_default"></td>
827
+ <td class="nd_comments" rowspan="1">
828
+ </td>
829
+ </tr>
830
+
831
+ <tr class="first_field">
832
+ <td class="nd_class" rowspan="1"><tt>PostDec</tt></td>
833
+ <td class="nd_field"><tt>expr *</tt></td>
834
+ <td class="nd_values"><tt>Expression</tt></td>
835
+ <td class="nd_default"></td>
836
+ <td class="nd_comments" rowspan="1">
837
+ </td>
838
+ </tr>
839
+
840
+ <tr class="first_field">
841
+ <td class="nd_class" rowspan="2"><tt>Cast</tt></td>
842
+ <td class="nd_field"><tt>type *</tt></td>
843
+ <td class="nd_values"><tt>Type</tt></td>
844
+ <td class="nd_default"></td>
845
+ <td class="nd_comments" rowspan="2">
846
+ </td>
847
+ </tr>
848
+ <tr>
849
+ <td class="nd_field"><tt>expr *</tt></td>
850
+ <td class="nd_values"><tt>Expression</tt></td>
851
+ <td class="nd_default"></td>
852
+ </tr>
853
+
854
+ <tr class="first_field">
855
+ <td class="nd_class" rowspan="1"><tt>Address</tt></td>
856
+ <td class="nd_field"><tt>expr *</tt></td>
857
+ <td class="nd_values"><tt>Expression</tt></td>
858
+ <td class="nd_default"></td>
859
+ <td class="nd_comments" rowspan="1">
860
+ </td>
861
+ </tr>
862
+
863
+ <tr class="first_field">
864
+ <td class="nd_class" rowspan="1"><tt>Dereference</tt></td>
865
+ <td class="nd_field"><tt>expr *</tt></td>
866
+ <td class="nd_values"><tt>Expression</tt></td>
867
+ <td class="nd_default"></td>
868
+ <td class="nd_comments" rowspan="1">
869
+ </td>
870
+ </tr>
871
+
872
+ <tr class="first_field">
873
+ <td class="nd_class" rowspan="1"><tt>Sizeof</tt></td>
874
+ <td class="nd_field"><tt>expr *</tt></td>
875
+ <td class="nd_values"><tt>Type</tt> or <tt>Expression</tt></td>
876
+ <td class="nd_default"></td>
877
+ <td class="nd_comments" rowspan="1">
878
+ </td>
879
+ </tr>
880
+
881
+ <tr class="first_field">
882
+ <td class="nd_class" rowspan="1"><tt>Positive</tt></td>
883
+ <td class="nd_field"><tt>expr *</tt></td>
884
+ <td class="nd_values"><tt>Expression</tt></td>
885
+ <td class="nd_default"></td>
886
+ <td class="nd_comments" rowspan="1">
887
+ </td>
888
+ </tr>
889
+
890
+ <tr class="first_field">
891
+ <td class="nd_class" rowspan="1"><tt>Negative</tt></td>
892
+ <td class="nd_field"><tt>expr *</tt></td>
893
+ <td class="nd_values"><tt>Expression</tt></td>
894
+ <td class="nd_default"></td>
895
+ <td class="nd_comments" rowspan="1">
896
+ </td>
897
+ </tr>
898
+
899
+ <tr class="first_field">
900
+ <td class="nd_class" rowspan="1"><tt>PreInc</tt></td>
901
+ <td class="nd_field"><tt>expr *</tt></td>
902
+ <td class="nd_values"><tt>Expression</tt></td>
903
+ <td class="nd_default"></td>
904
+ <td class="nd_comments" rowspan="1">
905
+ </td>
906
+ </tr>
907
+
908
+ <tr class="first_field">
909
+ <td class="nd_class" rowspan="1"><tt>PreDec</tt></td>
910
+ <td class="nd_field"><tt>expr *</tt></td>
911
+ <td class="nd_values"><tt>Expression</tt></td>
912
+ <td class="nd_default"></td>
913
+ <td class="nd_comments" rowspan="1">
914
+ </td>
915
+ </tr>
916
+
917
+ <tr class="first_field">
918
+ <td class="nd_class" rowspan="1"><tt>BitNot</tt></td>
919
+ <td class="nd_field"><tt>expr *</tt></td>
920
+ <td class="nd_values"><tt>Expression</tt></td>
921
+ <td class="nd_default"></td>
922
+ <td class="nd_comments" rowspan="1">
923
+ </td>
924
+ </tr>
925
+
926
+ <tr class="first_field">
927
+ <td class="nd_class" rowspan="1"><tt>Not</tt></td>
928
+ <td class="nd_field"><tt>expr *</tt></td>
929
+ <td class="nd_values"><tt>Expression</tt></td>
930
+ <td class="nd_default"></td>
931
+ <td class="nd_comments" rowspan="1">
932
+ </td>
933
+ </tr>
934
+
935
+ <tr class="first_field">
936
+ <td class="nd_class" rowspan="2"><tt>Add</tt></td>
937
+ <td class="nd_field"><tt>expr1 *</tt></td>
938
+ <td class="nd_values"><tt>Expression</tt></td>
939
+ <td class="nd_default"></td>
940
+ <td class="nd_comments" rowspan="2">
941
+ </td>
942
+ </tr>
943
+ <tr>
944
+ <td class="nd_field"><tt>expr2 *</tt></td>
945
+ <td class="nd_values"><tt>Expression</tt></td>
946
+ <td class="nd_default"></td>
947
+ </tr>
948
+
949
+ <tr class="first_field">
950
+ <td class="nd_class" rowspan="2"><tt>Subtract</tt></td>
951
+ <td class="nd_field"><tt>expr1 *</tt></td>
952
+ <td class="nd_values"><tt>Expression</tt></td>
953
+ <td class="nd_default"></td>
954
+ <td class="nd_comments" rowspan="2">
955
+ </td>
956
+ </tr>
957
+ <tr>
958
+ <td class="nd_field"><tt>expr2 *</tt></td>
959
+ <td class="nd_values"><tt>Expression</tt></td>
960
+ <td class="nd_default"></td>
961
+ </tr>
962
+
963
+ <tr class="first_field">
964
+ <td class="nd_class" rowspan="2"><tt>Multiply</tt></td>
965
+ <td class="nd_field"><tt>expr1 *</tt></td>
966
+ <td class="nd_values"><tt>Expression</tt></td>
967
+ <td class="nd_default"></td>
968
+ <td class="nd_comments" rowspan="2">
969
+ </td>
970
+ </tr>
971
+ <tr>
972
+ <td class="nd_field"><tt>expr2 *</tt></td>
973
+ <td class="nd_values"><tt>Expression</tt></td>
974
+ <td class="nd_default"></td>
975
+ </tr>
976
+
977
+ <tr class="first_field">
978
+ <td class="nd_class" rowspan="2"><tt>Divide</tt></td>
979
+ <td class="nd_field"><tt>expr1 *</tt></td>
980
+ <td class="nd_values"><tt>Expression</tt></td>
981
+ <td class="nd_default"></td>
982
+ <td class="nd_comments" rowspan="2">
983
+ </td>
984
+ </tr>
985
+ <tr>
986
+ <td class="nd_field"><tt>expr2 *</tt></td>
987
+ <td class="nd_values"><tt>Expression</tt></td>
988
+ <td class="nd_default"></td>
989
+ </tr>
990
+
991
+ <tr class="first_field">
992
+ <td class="nd_class" rowspan="2"><tt>Mod</tt></td>
993
+ <td class="nd_field"><tt>expr1 *</tt></td>
994
+ <td class="nd_values"><tt>Expression</tt></td>
995
+ <td class="nd_default"></td>
996
+ <td class="nd_comments" rowspan="2">
997
+ </td>
998
+ </tr>
999
+ <tr>
1000
+ <td class="nd_field"><tt>expr2 *</tt></td>
1001
+ <td class="nd_values"><tt>Expression</tt></td>
1002
+ <td class="nd_default"></td>
1003
+ </tr>
1004
+
1005
+ <tr class="first_field">
1006
+ <td class="nd_class" rowspan="2"><tt>Equal</tt></td>
1007
+ <td class="nd_field"><tt>expr1 *</tt></td>
1008
+ <td class="nd_values"><tt>Expression</tt></td>
1009
+ <td class="nd_default"></td>
1010
+ <td class="nd_comments" rowspan="2">
1011
+ </td>
1012
+ </tr>
1013
+ <tr>
1014
+ <td class="nd_field"><tt>expr2 *</tt></td>
1015
+ <td class="nd_values"><tt>Expression</tt></td>
1016
+ <td class="nd_default"></td>
1017
+ </tr>
1018
+
1019
+ <tr class="first_field">
1020
+ <td class="nd_class" rowspan="2"><tt>NotEqual</tt></td>
1021
+ <td class="nd_field"><tt>expr1 *</tt></td>
1022
+ <td class="nd_values"><tt>Expression</tt></td>
1023
+ <td class="nd_default"></td>
1024
+ <td class="nd_comments" rowspan="2">
1025
+ </td>
1026
+ </tr>
1027
+ <tr>
1028
+ <td class="nd_field"><tt>expr2 *</tt></td>
1029
+ <td class="nd_values"><tt>Expression</tt></td>
1030
+ <td class="nd_default"></td>
1031
+ </tr>
1032
+
1033
+ <tr class="first_field">
1034
+ <td class="nd_class" rowspan="2"><tt>Less</tt></td>
1035
+ <td class="nd_field"><tt>expr1 *</tt></td>
1036
+ <td class="nd_values"><tt>Expression</tt></td>
1037
+ <td class="nd_default"></td>
1038
+ <td class="nd_comments" rowspan="2">
1039
+ </td>
1040
+ </tr>
1041
+ <tr>
1042
+ <td class="nd_field"><tt>expr2 *</tt></td>
1043
+ <td class="nd_values"><tt>Expression</tt></td>
1044
+ <td class="nd_default"></td>
1045
+ </tr>
1046
+
1047
+ <tr class="first_field">
1048
+ <td class="nd_class" rowspan="2"><tt>More</tt></td>
1049
+ <td class="nd_field"><tt>expr1 *</tt></td>
1050
+ <td class="nd_values"><tt>Expression</tt></td>
1051
+ <td class="nd_default"></td>
1052
+ <td class="nd_comments" rowspan="2">
1053
+ </td>
1054
+ </tr>
1055
+ <tr>
1056
+ <td class="nd_field"><tt>expr2 *</tt></td>
1057
+ <td class="nd_values"><tt>Expression</tt></td>
1058
+ <td class="nd_default"></td>
1059
+ </tr>
1060
+
1061
+ <tr class="first_field">
1062
+ <td class="nd_class" rowspan="2"><tt>LessOrEqual</tt></td>
1063
+ <td class="nd_field"><tt>expr1 *</tt></td>
1064
+ <td class="nd_values"><tt>Expression</tt></td>
1065
+ <td class="nd_default"></td>
1066
+ <td class="nd_comments" rowspan="2">
1067
+ </td>
1068
+ </tr>
1069
+ <tr>
1070
+ <td class="nd_field"><tt>expr2 *</tt></td>
1071
+ <td class="nd_values"><tt>Expression</tt></td>
1072
+ <td class="nd_default"></td>
1073
+ </tr>
1074
+
1075
+ <tr class="first_field">
1076
+ <td class="nd_class" rowspan="2"><tt>MoreOrEqual</tt></td>
1077
+ <td class="nd_field"><tt>expr1 *</tt></td>
1078
+ <td class="nd_values"><tt>Expression</tt></td>
1079
+ <td class="nd_default"></td>
1080
+ <td class="nd_comments" rowspan="2">
1081
+ </td>
1082
+ </tr>
1083
+ <tr>
1084
+ <td class="nd_field"><tt>expr2 *</tt></td>
1085
+ <td class="nd_values"><tt>Expression</tt></td>
1086
+ <td class="nd_default"></td>
1087
+ </tr>
1088
+
1089
+ <tr class="first_field">
1090
+ <td class="nd_class" rowspan="2"><tt>BitAnd</tt></td>
1091
+ <td class="nd_field"><tt>expr1 *</tt></td>
1092
+ <td class="nd_values"><tt>Expression</tt></td>
1093
+ <td class="nd_default"></td>
1094
+ <td class="nd_comments" rowspan="2">
1095
+ </td>
1096
+ </tr>
1097
+ <tr>
1098
+ <td class="nd_field"><tt>expr2 *</tt></td>
1099
+ <td class="nd_values"><tt>Expression</tt></td>
1100
+ <td class="nd_default"></td>
1101
+ </tr>
1102
+
1103
+ <tr class="first_field">
1104
+ <td class="nd_class" rowspan="2"><tt>BitOr</tt></td>
1105
+ <td class="nd_field"><tt>expr1 *</tt></td>
1106
+ <td class="nd_values"><tt>Expression</tt></td>
1107
+ <td class="nd_default"></td>
1108
+ <td class="nd_comments" rowspan="2">
1109
+ </td>
1110
+ </tr>
1111
+ <tr>
1112
+ <td class="nd_field"><tt>expr2 *</tt></td>
1113
+ <td class="nd_values"><tt>Expression</tt></td>
1114
+ <td class="nd_default"></td>
1115
+ </tr>
1116
+
1117
+ <tr class="first_field">
1118
+ <td class="nd_class" rowspan="2"><tt>BitXor</tt></td>
1119
+ <td class="nd_field"><tt>expr1 *</tt></td>
1120
+ <td class="nd_values"><tt>Expression</tt></td>
1121
+ <td class="nd_default"></td>
1122
+ <td class="nd_comments" rowspan="2">
1123
+ </td>
1124
+ </tr>
1125
+ <tr>
1126
+ <td class="nd_field"><tt>expr2 *</tt></td>
1127
+ <td class="nd_values"><tt>Expression</tt></td>
1128
+ <td class="nd_default"></td>
1129
+ </tr>
1130
+
1131
+ <tr class="first_field">
1132
+ <td class="nd_class" rowspan="2"><tt>ShiftLeft</tt></td>
1133
+ <td class="nd_field"><tt>expr1 *</tt></td>
1134
+ <td class="nd_values"><tt>Expression</tt></td>
1135
+ <td class="nd_default"></td>
1136
+ <td class="nd_comments" rowspan="2">
1137
+ </td>
1138
+ </tr>
1139
+ <tr>
1140
+ <td class="nd_field"><tt>expr2 *</tt></td>
1141
+ <td class="nd_values"><tt>Expression</tt></td>
1142
+ <td class="nd_default"></td>
1143
+ </tr>
1144
+
1145
+ <tr class="first_field">
1146
+ <td class="nd_class" rowspan="2"><tt>ShiftRight</tt></td>
1147
+ <td class="nd_field"><tt>expr1 *</tt></td>
1148
+ <td class="nd_values"><tt>Expression</tt></td>
1149
+ <td class="nd_default"></td>
1150
+ <td class="nd_comments" rowspan="2">
1151
+ </td>
1152
+ </tr>
1153
+ <tr>
1154
+ <td class="nd_field"><tt>expr2 *</tt></td>
1155
+ <td class="nd_values"><tt>Expression</tt></td>
1156
+ <td class="nd_default"></td>
1157
+ </tr>
1158
+
1159
+ <tr class="first_field">
1160
+ <td class="nd_class" rowspan="2"><tt>And</tt></td>
1161
+ <td class="nd_field"><tt>expr1 *</tt></td>
1162
+ <td class="nd_values"><tt>Expression</tt></td>
1163
+ <td class="nd_default"></td>
1164
+ <td class="nd_comments" rowspan="2">
1165
+ </td>
1166
+ </tr>
1167
+ <tr>
1168
+ <td class="nd_field"><tt>expr2 *</tt></td>
1169
+ <td class="nd_values"><tt>Expression</tt></td>
1170
+ <td class="nd_default"></td>
1171
+ </tr>
1172
+
1173
+ <tr class="first_field">
1174
+ <td class="nd_class" rowspan="2"><tt>Or</tt></td>
1175
+ <td class="nd_field"><tt>expr1 *</tt></td>
1176
+ <td class="nd_values"><tt>Expression</tt></td>
1177
+ <td class="nd_default"></td>
1178
+ <td class="nd_comments" rowspan="2">
1179
+ </td>
1180
+ </tr>
1181
+ <tr>
1182
+ <td class="nd_field"><tt>expr2 *</tt></td>
1183
+ <td class="nd_values"><tt>Expression</tt></td>
1184
+ <td class="nd_default"></td>
1185
+ </tr>
1186
+
1187
+ <tr class="first_field">
1188
+ <td class="nd_class" rowspan="2"><tt>Assign</tt></td>
1189
+ <td class="nd_field"><tt>lval *</tt></td>
1190
+ <td class="nd_values"><tt>Expression</tt></td>
1191
+ <td class="nd_default"></td>
1192
+ <td class="nd_comments" rowspan="2">
1193
+ </td>
1194
+ </tr>
1195
+ <tr>
1196
+ <td class="nd_field"><tt>rval *</tt></td>
1197
+ <td class="nd_values"><tt>Expression</tt></td>
1198
+ <td class="nd_default"></td>
1199
+ </tr>
1200
+
1201
+ <tr class="first_field">
1202
+ <td class="nd_class" rowspan="2"><tt>MultiplyAssign</tt></td>
1203
+ <td class="nd_field"><tt>lval *</tt></td>
1204
+ <td class="nd_values"><tt>Expression</tt></td>
1205
+ <td class="nd_default"></td>
1206
+ <td class="nd_comments" rowspan="2">
1207
+ </td>
1208
+ </tr>
1209
+ <tr>
1210
+ <td class="nd_field"><tt>rval *</tt></td>
1211
+ <td class="nd_values"><tt>Expression</tt></td>
1212
+ <td class="nd_default"></td>
1213
+ </tr>
1214
+
1215
+ <tr class="first_field">
1216
+ <td class="nd_class" rowspan="2"><tt>DivideAssign</tt></td>
1217
+ <td class="nd_field"><tt>lval *</tt></td>
1218
+ <td class="nd_values"><tt>Expression</tt></td>
1219
+ <td class="nd_default"></td>
1220
+ <td class="nd_comments" rowspan="2">
1221
+ </td>
1222
+ </tr>
1223
+ <tr>
1224
+ <td class="nd_field"><tt>rval *</tt></td>
1225
+ <td class="nd_values"><tt>Expression</tt></td>
1226
+ <td class="nd_default"></td>
1227
+ </tr>
1228
+
1229
+ <tr class="first_field">
1230
+ <td class="nd_class" rowspan="2"><tt>ModAssign</tt></td>
1231
+ <td class="nd_field"><tt>lval *</tt></td>
1232
+ <td class="nd_values"><tt>Expression</tt></td>
1233
+ <td class="nd_default"></td>
1234
+ <td class="nd_comments" rowspan="2">
1235
+ </td>
1236
+ </tr>
1237
+ <tr>
1238
+ <td class="nd_field"><tt>rval *</tt></td>
1239
+ <td class="nd_values"><tt>Expression</tt></td>
1240
+ <td class="nd_default"></td>
1241
+ </tr>
1242
+
1243
+ <tr class="first_field">
1244
+ <td class="nd_class" rowspan="2"><tt>AddAssign</tt></td>
1245
+ <td class="nd_field"><tt>lval *</tt></td>
1246
+ <td class="nd_values"><tt>Expression</tt></td>
1247
+ <td class="nd_default"></td>
1248
+ <td class="nd_comments" rowspan="2">
1249
+ </td>
1250
+ </tr>
1251
+ <tr>
1252
+ <td class="nd_field"><tt>rval *</tt></td>
1253
+ <td class="nd_values"><tt>Expression</tt></td>
1254
+ <td class="nd_default"></td>
1255
+ </tr>
1256
+
1257
+ <tr class="first_field">
1258
+ <td class="nd_class" rowspan="2"><tt>SubtractAssign</tt></td>
1259
+ <td class="nd_field"><tt>lval *</tt></td>
1260
+ <td class="nd_values"><tt>Expression</tt></td>
1261
+ <td class="nd_default"></td>
1262
+ <td class="nd_comments" rowspan="2">
1263
+ </td>
1264
+ </tr>
1265
+ <tr>
1266
+ <td class="nd_field"><tt>rval *</tt></td>
1267
+ <td class="nd_values"><tt>Expression</tt></td>
1268
+ <td class="nd_default"></td>
1269
+ </tr>
1270
+
1271
+ <tr class="first_field">
1272
+ <td class="nd_class" rowspan="2"><tt>ShiftLeftAssign</tt></td>
1273
+ <td class="nd_field"><tt>lval *</tt></td>
1274
+ <td class="nd_values"><tt>Expression</tt></td>
1275
+ <td class="nd_default"></td>
1276
+ <td class="nd_comments" rowspan="2">
1277
+ </td>
1278
+ </tr>
1279
+ <tr>
1280
+ <td class="nd_field"><tt>rval *</tt></td>
1281
+ <td class="nd_values"><tt>Expression</tt></td>
1282
+ <td class="nd_default"></td>
1283
+ </tr>
1284
+
1285
+ <tr class="first_field">
1286
+ <td class="nd_class" rowspan="2"><tt>ShiftRightAssign</tt></td>
1287
+ <td class="nd_field"><tt>lval *</tt></td>
1288
+ <td class="nd_values"><tt>Expression</tt></td>
1289
+ <td class="nd_default"></td>
1290
+ <td class="nd_comments" rowspan="2">
1291
+ </td>
1292
+ </tr>
1293
+ <tr>
1294
+ <td class="nd_field"><tt>rval *</tt></td>
1295
+ <td class="nd_values"><tt>Expression</tt></td>
1296
+ <td class="nd_default"></td>
1297
+ </tr>
1298
+
1299
+ <tr class="first_field">
1300
+ <td class="nd_class" rowspan="2"><tt>BitAndAssign</tt></td>
1301
+ <td class="nd_field"><tt>lval *</tt></td>
1302
+ <td class="nd_values"><tt>Expression</tt></td>
1303
+ <td class="nd_default"></td>
1304
+ <td class="nd_comments" rowspan="2">
1305
+ </td>
1306
+ </tr>
1307
+ <tr>
1308
+ <td class="nd_field"><tt>rval *</tt></td>
1309
+ <td class="nd_values"><tt>Expression</tt></td>
1310
+ <td class="nd_default"></td>
1311
+ </tr>
1312
+
1313
+ <tr class="first_field">
1314
+ <td class="nd_class" rowspan="2"><tt>BitXorAssign</tt></td>
1315
+ <td class="nd_field"><tt>lval *</tt></td>
1316
+ <td class="nd_values"><tt>Expression</tt></td>
1317
+ <td class="nd_default"></td>
1318
+ <td class="nd_comments" rowspan="2">
1319
+ </td>
1320
+ </tr>
1321
+ <tr>
1322
+ <td class="nd_field"><tt>rval *</tt></td>
1323
+ <td class="nd_values"><tt>Expression</tt></td>
1324
+ <td class="nd_default"></td>
1325
+ </tr>
1326
+
1327
+ <tr class="first_field">
1328
+ <td class="nd_class" rowspan="2"><tt>BitOrAssign</tt></td>
1329
+ <td class="nd_field"><tt>lval *</tt></td>
1330
+ <td class="nd_values"><tt>Expression</tt></td>
1331
+ <td class="nd_default"></td>
1332
+ <td class="nd_comments" rowspan="2">
1333
+ </td>
1334
+ </tr>
1335
+ <tr>
1336
+ <td class="nd_field"><tt>rval *</tt></td>
1337
+ <td class="nd_values"><tt>Expression</tt></td>
1338
+ <td class="nd_default"></td>
1339
+ </tr>
1340
+
1341
+ <tr class="first_field">
1342
+ <td class="nd_class" rowspan="1"><tt>StringLiteral</tt></td>
1343
+ <td class="nd_field"><tt>val</tt></td>
1344
+ <td class="nd_values"><tt>String</tt></td>
1345
+ <td class="nd_default"></td>
1346
+ <td class="nd_comments" rowspan="1">
1347
+ The <tt>String</tt> in <tt>val</tt> is the literal string entered. <tt>"\n"</tt>
1348
+ isn't converted to a newline, for instance.
1349
+ </td>
1350
+ </tr>
1351
+
1352
+ <tr class="first_field">
1353
+ <td class="nd_class" rowspan="1"><tt>CharLiteral</tt></td>
1354
+ <td class="nd_field"><tt>val</tt></td>
1355
+ <td class="nd_values"><tt>String</tt></td>
1356
+ <td class="nd_default"></td>
1357
+ <td class="nd_comments" rowspan="1">
1358
+ The <tt>String</tt> in <tt>val</tt> is the literal string entered. <tt>'\n'</tt>
1359
+ isn't converted to a newline, for instance.
1360
+ </td>
1361
+ </tr>
1362
+
1363
+ <tr class="first_field">
1364
+ <td class="nd_class" rowspan="2"><tt>CompoundLiteral</tt></td>
1365
+ <td class="nd_field"><tt>type *</tt></td>
1366
+ <td class="nd_values"><tt>Type</tt></td>
1367
+ <td class="nd_default"></td>
1368
+ <td class="nd_comments" rowspan="2">
1369
+ <p>Here's an example:</p>
1370
+ <pre>(struct S){1, .x = 2, .y [3] .z = 4}</pre>
1371
+ <p>parses as:</p>
1372
+ <pre>CompoundLiteral
1373
+ type: Struct
1374
+ name: "S"
1375
+ member_inits:
1376
+ - MemberInit
1377
+ init: IntLiteral
1378
+ val: 1
1379
+ - MemberInit
1380
+ member:
1381
+ - Member
1382
+ name: "x"
1383
+ init: IntLiteral
1384
+ val: 2
1385
+ - MemberInit
1386
+ member:
1387
+ - Member
1388
+ name: "y"
1389
+ - IntLiteral
1390
+ val: 3
1391
+ - Member
1392
+ name: "z"
1393
+ init: IntLiteral
1394
+ val: 4</pre>
1395
+ </td>
1396
+ </tr>
1397
+ <tr>
1398
+ <td class="nd_field"><tt>member_inits *</tt></td>
1399
+ <td class="nd_values"><tt>NodeList</tt> of <tt>MemberInit</tt></td>
1400
+ <td class="nd_default"><tt>NodeArray[]</tt></td>
1401
+ </tr>
1402
+
1403
+ <tr class="first_field">
1404
+ <td class="nd_class" rowspan="2"><tt>IntLiteral</tt></td>
1405
+ <td class="nd_field"><tt>val</tt></td>
1406
+ <td class="nd_values"><tt>Integer</tt></td>
1407
+ <td class="nd_default"></td>
1408
+ <td class="nd_comments" rowspan="2">
1409
+ <p>Also:</p>
1410
+ <ul>
1411
+ <li><tt>#dec?</tt> -- return true iff <tt>format == :dec</tt></li>
1412
+ <li><tt>#hex?</tt> -- return true iff <tt>format == :hex</tt></li>
1413
+ <li><tt>#oct?</tt> -- return true iff <tt>format == :oct</tt></li>
1414
+ </ul>
1415
+ </td>
1416
+ </tr>
1417
+ <tr>
1418
+ <td class="nd_field"><tt>format</tt></td>
1419
+ <td class="nd_values"><tt>:dec</tt>, <tt>:hex</tt>, <tt>:oct</tt></td>
1420
+ <td class="nd_default"><tt>:dec</tt></td>
1421
+ </tr>
1422
+
1423
+ <tr class="first_field">
1424
+ <td class="nd_class" rowspan="1"><tt>FloatLiteral</tt></td>
1425
+ <td class="nd_field"><tt>val</tt></td>
1426
+ <td class="nd_values"><tt>Float</tt></td>
1427
+ <td class="nd_default"></td>
1428
+ <td class="nd_comments" rowspan="1">
1429
+ </td>
1430
+ </tr>
1431
+
1432
+ <tr class="first_field">
1433
+ <td class="nd_class" rowspan="4"><tt>Pointer</tt></td>
1434
+ <td class="nd_field"><tt>const?</tt></td>
1435
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1436
+ <td class="nd_default"></td>
1437
+ <td class="nd_comments" rowspan="4">
1438
+ </td>
1439
+ </tr>
1440
+ <tr>
1441
+ <td class="nd_field"><tt>restrict?</tt></td>
1442
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1443
+ <td class="nd_default"></td>
1444
+ </tr>
1445
+ <tr>
1446
+ <td class="nd_field"><tt>volatile?</tt></td>
1447
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1448
+ <td class="nd_default"></td>
1449
+ </tr>
1450
+ <tr>
1451
+ <td class="nd_field"><tt>type *</tt></td>
1452
+ <td class="nd_values"><tt>Type</tt></td>
1453
+ <td class="nd_default"></td>
1454
+ </tr>
1455
+
1456
+ <tr class="first_field">
1457
+ <td class="nd_class" rowspan="5"><tt>Array</tt></td>
1458
+ <td class="nd_field"><tt>const?</tt></td>
1459
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1460
+ <td class="nd_default"></td>
1461
+ <td class="nd_comments" rowspan="5">
1462
+ </td>
1463
+ </tr>
1464
+ <tr>
1465
+ <td class="nd_field"><tt>restrict?</tt></td>
1466
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1467
+ <td class="nd_default"></td>
1468
+ </tr>
1469
+ <tr>
1470
+ <td class="nd_field"><tt>volatile?</tt></td>
1471
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1472
+ <td class="nd_default"></td>
1473
+ </tr>
1474
+ <tr>
1475
+ <td class="nd_field"><tt>type *</tt></td>
1476
+ <td class="nd_values"><tt>Type</tt></td>
1477
+ <td class="nd_default"></td>
1478
+ </tr>
1479
+ <tr>
1480
+ <td class="nd_field"><tt>length *</tt></td>
1481
+ <td class="nd_values"><tt>Expression</tt></td>
1482
+ <td class="nd_default"></td>
1483
+ </tr>
1484
+
1485
+ <tr class="first_field">
1486
+ <td class="nd_class" rowspan="6"><tt>Function</tt></td>
1487
+ <td class="nd_field"><tt>const?</tt></td>
1488
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1489
+ <td class="nd_default"></td>
1490
+ <td class="nd_comments" rowspan="6">
1491
+ </td>
1492
+ </tr>
1493
+ <tr>
1494
+ <td class="nd_field"><tt>restrict?</tt></td>
1495
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1496
+ <td class="nd_default"></td>
1497
+ </tr>
1498
+ <tr>
1499
+ <td class="nd_field"><tt>volatile?</tt></td>
1500
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1501
+ <td class="nd_default"></td>
1502
+ </tr>
1503
+ <tr>
1504
+ <td class="nd_field"><tt>type *</tt></td>
1505
+ <td class="nd_values"><tt>Type</tt></td>
1506
+ <td class="nd_default"></td>
1507
+ </tr>
1508
+ <tr>
1509
+ <td class="nd_field"><tt>params *</tt></td>
1510
+ <td class="nd_values"><tt>NodeList</tt> of <tt>Parameter</tt></td>
1511
+ <td class="nd_default"><tt>NodeArray[]</tt></td>
1512
+ </tr>
1513
+ <tr>
1514
+ <td class="nd_field"><tt>var_args?</tt></td>
1515
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1516
+ <td class="nd_default"></td>
1517
+ </tr>
1518
+
1519
+ <tr class="first_field">
1520
+ <td class="nd_class" rowspan="5"><tt>Struct</tt></td>
1521
+ <td class="nd_field"><tt>const?</tt></td>
1522
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1523
+ <td class="nd_default"></td>
1524
+ <td class="nd_comments" rowspan="5">
1525
+ </td>
1526
+ </tr>
1527
+ <tr>
1528
+ <td class="nd_field"><tt>restrict?</tt></td>
1529
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1530
+ <td class="nd_default"></td>
1531
+ </tr>
1532
+ <tr>
1533
+ <td class="nd_field"><tt>volatile?</tt></td>
1534
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1535
+ <td class="nd_default"></td>
1536
+ </tr>
1537
+ <tr>
1538
+ <td class="nd_field"><tt>name</tt></td>
1539
+ <td class="nd_values"><tt>String</tt></td>
1540
+ <td class="nd_default"></td>
1541
+ </tr>
1542
+ <tr>
1543
+ <td class="nd_field"><tt>members *</tt></td>
1544
+ <td class="nd_values"><tt>NodeList</tt> of <tt>Member</tt></td>
1545
+ <td class="nd_default"><tt>NodeArray[]</tt></td>
1546
+ </tr>
1547
+
1548
+ <tr class="first_field">
1549
+ <td class="nd_class" rowspan="5"><tt>Union</tt></td>
1550
+ <td class="nd_field"><tt>const?</tt></td>
1551
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1552
+ <td class="nd_default"></td>
1553
+ <td class="nd_comments" rowspan="5">
1554
+ </td>
1555
+ </tr>
1556
+ <tr>
1557
+ <td class="nd_field"><tt>restrict?</tt></td>
1558
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1559
+ <td class="nd_default"></td>
1560
+ </tr>
1561
+ <tr>
1562
+ <td class="nd_field"><tt>volatile?</tt></td>
1563
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1564
+ <td class="nd_default"></td>
1565
+ </tr>
1566
+ <tr>
1567
+ <td class="nd_field"><tt>name</tt></td>
1568
+ <td class="nd_values"><tt>String</tt></td>
1569
+ <td class="nd_default"></td>
1570
+ </tr>
1571
+ <tr>
1572
+ <td class="nd_field"><tt>members *</tt></td>
1573
+ <td class="nd_values"><tt>NodeList</tt> of <tt>Member</tt></td>
1574
+ <td class="nd_default"><tt>NodeArray[]</tt></td>
1575
+ </tr>
1576
+
1577
+ <tr class="first_field">
1578
+ <td class="nd_class" rowspan="5"><tt>Enum</tt></td>
1579
+ <td class="nd_field"><tt>const?</tt></td>
1580
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1581
+ <td class="nd_default"></td>
1582
+ <td class="nd_comments" rowspan="5">
1583
+ </td>
1584
+ </tr>
1585
+ <tr>
1586
+ <td class="nd_field"><tt>restrict?</tt></td>
1587
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1588
+ <td class="nd_default"></td>
1589
+ </tr>
1590
+ <tr>
1591
+ <td class="nd_field"><tt>volatile?</tt></td>
1592
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1593
+ <td class="nd_default"></td>
1594
+ </tr>
1595
+ <tr>
1596
+ <td class="nd_field"><tt>name</tt></td>
1597
+ <td class="nd_values"><tt>String</tt></td>
1598
+ <td class="nd_default"></td>
1599
+ </tr>
1600
+ <tr>
1601
+ <td class="nd_field"><tt>members *</tt></td>
1602
+ <td class="nd_values"><tt>NodeList</tt> of <tt>Enumerator</tt></td>
1603
+ <td class="nd_default"></td>
1604
+ </tr>
1605
+
1606
+ <tr class="first_field">
1607
+ <td class="nd_class" rowspan="4"><tt>CustomType</tt></td>
1608
+ <td class="nd_field"><tt>const?</tt></td>
1609
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1610
+ <td class="nd_default"></td>
1611
+ <td class="nd_comments" rowspan="4">
1612
+ For <tt>typedef</tt>'d names.
1613
+ </td>
1614
+ </tr>
1615
+ <tr>
1616
+ <td class="nd_field"><tt>restrict?</tt></td>
1617
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1618
+ <td class="nd_default"></td>
1619
+ </tr>
1620
+ <tr>
1621
+ <td class="nd_field"><tt>volatile?</tt></td>
1622
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1623
+ <td class="nd_default"></td>
1624
+ </tr>
1625
+ <tr>
1626
+ <td class="nd_field"><tt>name</tt></td>
1627
+ <td class="nd_values"><tt>String</tt></td>
1628
+ <td class="nd_default"></td>
1629
+ </tr>
1630
+
1631
+ <tr class="first_field">
1632
+ <td class="nd_class" rowspan="3"><tt>Void</tt></td>
1633
+ <td class="nd_field"><tt>const?</tt></td>
1634
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1635
+ <td class="nd_default"></td>
1636
+ <td class="nd_comments" rowspan="3">
1637
+ <tt>const</tt> is for things like <tt>const void *</tt>.
1638
+ </td>
1639
+ </tr>
1640
+ <tr>
1641
+ <td class="nd_field"><tt>restrict?</tt></td>
1642
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1643
+ <td class="nd_default"></td>
1644
+ </tr>
1645
+ <tr>
1646
+ <td class="nd_field"><tt>volatile?</tt></td>
1647
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1648
+ <td class="nd_default"></td>
1649
+ </tr>
1650
+
1651
+ <tr class="first_field">
1652
+ <td class="nd_class" rowspan="5"><tt>Int</tt></td>
1653
+ <td class="nd_field"><tt>const?</tt></td>
1654
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1655
+ <td class="nd_default"></td>
1656
+ <td class="nd_comments" rowspan="5">
1657
+ Also:
1658
+ <ul>
1659
+ <li><tt>#short?</tt> -- return true iff <tt>longness == -1</tt></li>
1660
+ <li><tt>#plain?</tt> -- return true iff <tt>longness == 0</tt></li>
1661
+ <li><tt>#long?</tt> -- return true iff <tt>longness == 1</tt></li>
1662
+ <li><tt>#long_long?</tt> -- return true iff <tt>longness == 2</tt></li>
1663
+ <li><tt>#signed?</tt> -- same as <tt>!unsigned?</tt></li>
1664
+ <li><tt>#signed=(val)</tt> -- same as <tt>unsigned = !val</tt></li>
1665
+ </ul>
1666
+ </td>
1667
+ </tr>
1668
+ <tr>
1669
+ <td class="nd_field"><tt>restrict?</tt></td>
1670
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1671
+ <td class="nd_default"></td>
1672
+ </tr>
1673
+ <tr>
1674
+ <td class="nd_field"><tt>volatile?</tt></td>
1675
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1676
+ <td class="nd_default"></td>
1677
+ </tr>
1678
+ <tr>
1679
+ <td class="nd_field"><tt>longness</tt></td>
1680
+ <td class="nd_values"><tt>-1</tt>, <tt>0</tt>, <tt>1</tt>, <tt>2</tt></td>
1681
+ <td class="nd_default"><tt>0</tt></td>
1682
+ </tr>
1683
+ <tr>
1684
+ <td class="nd_field"><tt>unsigned?</tt></td>
1685
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1686
+ <td class="nd_default"></td>
1687
+ </tr>
1688
+
1689
+ <tr class="first_field">
1690
+ <td class="nd_class" rowspan="4"><tt>Float</tt></td>
1691
+ <td class="nd_field"><tt>const?</tt></td>
1692
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1693
+ <td class="nd_default"></td>
1694
+ <td class="nd_comments" rowspan="4">
1695
+ Also:
1696
+ <ul>
1697
+ <li><tt>#plain?</tt> -- return true iff <tt>longness == 0</tt></li>
1698
+ <li><tt>#double?</tt> -- return true iff <tt>longness == 1</tt></li>
1699
+ <li><tt>#long_double?</tt> -- return true iff <tt>longness == 2</tt></li>
1700
+ </ul>
1701
+ </td>
1702
+ </tr>
1703
+ <tr>
1704
+ <td class="nd_field"><tt>restrict?</tt></td>
1705
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1706
+ <td class="nd_default"></td>
1707
+ </tr>
1708
+ <tr>
1709
+ <td class="nd_field"><tt>volatile?</tt></td>
1710
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1711
+ <td class="nd_default"></td>
1712
+ </tr>
1713
+ <tr>
1714
+ <td class="nd_field"><tt>longness</tt></td>
1715
+ <td class="nd_values"><tt>0</tt>, <tt>1</tt>, <tt>2</tt></td>
1716
+ <td class="nd_default"><tt>0</tt></td>
1717
+ </tr>
1718
+
1719
+ <tr class="first_field">
1720
+ <td class="nd_class" rowspan="4"><tt>Char</tt></td>
1721
+ <td class="nd_field"><tt>const?</tt></td>
1722
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1723
+ <td class="nd_default"></td>
1724
+ <td class="nd_comments" rowspan="4">
1725
+ Also:
1726
+ <ul>
1727
+ <li><tt>#signed?</tt> -- return true iff <tt>signed == true</tt></li>
1728
+ <li><tt>#unsigned?</tt> -- return true iff <tt>signed == false</tt></li>
1729
+ <li><tt>#plain?</tt> -- return true iff <tt>signed == nil</tt></li>
1730
+ </ul>
1731
+ Yes, C99 says that <tt>char</tt>, <tt>signed char</tt>, and
1732
+ <tt>unsigned char</tt> are 3 distinct types (unlike with
1733
+ <tt>int</tt> -- go figure). Like Martian chalk and Venusian
1734
+ cheese: completely different, but you can fit 'em each in one
1735
+ byte.
1736
+ </td>
1737
+ </tr>
1738
+ <tr>
1739
+ <td class="nd_field"><tt>restrict?</tt></td>
1740
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1741
+ <td class="nd_default"></td>
1742
+ </tr>
1743
+ <tr>
1744
+ <td class="nd_field"><tt>volatile?</tt></td>
1745
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1746
+ <td class="nd_default"></td>
1747
+ </tr>
1748
+ <tr>
1749
+ <td class="nd_field"><tt>signed</tt></td>
1750
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt>, <tt>nil</tt></td>
1751
+ <td class="nd_default"></td>
1752
+ </tr>
1753
+
1754
+ <tr class="first_field">
1755
+ <td class="nd_class" rowspan="3"><tt>Bool</tt></td>
1756
+ <td class="nd_field"><tt>const?</tt></td>
1757
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1758
+ <td class="nd_default"></td>
1759
+ <td class="nd_comments" rowspan="3">
1760
+ This is the rarely seen <tt>_Bool</tt> type.
1761
+ </td>
1762
+ </tr>
1763
+ <tr>
1764
+ <td class="nd_field"><tt>restrict?</tt></td>
1765
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1766
+ <td class="nd_default"></td>
1767
+ </tr>
1768
+ <tr>
1769
+ <td class="nd_field"><tt>volatile?</tt></td>
1770
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1771
+ <td class="nd_default"></td>
1772
+ </tr>
1773
+
1774
+ <tr class="first_field">
1775
+ <td class="nd_class" rowspan="4"><tt>Complex</tt></td>
1776
+ <td class="nd_field"><tt>const?</tt></td>
1777
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1778
+ <td class="nd_default"></td>
1779
+ <td class="nd_comments" rowspan="4">
1780
+ <p>This is the rarely seen <tt>_Complex</tt> type.</p>
1781
+ <ul>
1782
+ <li><tt>#plain?</tt> -- return true iff <tt>longness == 0</tt></li>
1783
+ <li><tt>#double?</tt> -- return true iff <tt>longness == 1</tt></li>
1784
+ <li><tt>#long_double?</tt> -- return true iff <tt>longness == 2</tt></li>
1785
+ </ul>
1786
+ </td>
1787
+ </tr>
1788
+ <tr>
1789
+ <td class="nd_field"><tt>restrict?</tt></td>
1790
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1791
+ <td class="nd_default"></td>
1792
+ </tr>
1793
+ <tr>
1794
+ <td class="nd_field"><tt>volatile?</tt></td>
1795
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1796
+ <td class="nd_default"></td>
1797
+ </tr>
1798
+ <tr>
1799
+ <td class="nd_field"><tt>longness</tt></td>
1800
+ <td class="nd_values"><tt>0</tt>, <tt>1</tt>, <tt>2</tt></td>
1801
+ <td class="nd_default"><tt>0</tt></td>
1802
+ </tr>
1803
+
1804
+ <tr class="first_field">
1805
+ <td class="nd_class" rowspan="4"><tt>Imaginary</tt></td>
1806
+ <td class="nd_field"><tt>const?</tt></td>
1807
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1808
+ <td class="nd_default"></td>
1809
+ <td class="nd_comments" rowspan="4">
1810
+ <p>This is the rarely seen <tt>_Imaginary</tt> type.</p>
1811
+ <ul>
1812
+ <li><tt>#plain?</tt> -- return true iff <tt>longness == 0</tt></li>
1813
+ <li><tt>#double?</tt> -- return true iff <tt>longness == 1</tt></li>
1814
+ <li><tt>#long_double?</tt> -- return true iff <tt>longness == 2</tt></li>
1815
+ </ul>
1816
+ </td>
1817
+ </tr>
1818
+ <tr>
1819
+ <td class="nd_field"><tt>restrict?</tt></td>
1820
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1821
+ <td class="nd_default"></td>
1822
+ </tr>
1823
+ <tr>
1824
+ <td class="nd_field"><tt>volatile?</tt></td>
1825
+ <td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
1826
+ <td class="nd_default"></td>
1827
+ </tr>
1828
+ <tr>
1829
+ <td class="nd_field"><tt>longness</tt></td>
1830
+ <td class="nd_values"><tt>0</tt>, <tt>1</tt>, <tt>2</tt></td>
1831
+ <td class="nd_default"><tt>0</tt></td>
1832
+ </tr>
1833
+ <tr class="first_field">
1834
+ <td class="nd_class" rowspan="1"><tt>BlockExpression</tt></td>
1835
+ <td class="nd_field"><tt>block *</tt></td>
1836
+ <td class="nd_values"><tt>Block</tt></td>
1837
+ <td class="nd_default"><tt>Block.new</tt></td>
1838
+ <td class="nd_comments" rowspan="1">
1839
+ Only if the <tt>block_expressions</tt> extension is enabled.
1840
+ See "Extensions" section below.
1841
+ </td>
1842
+ </tr>
1843
+ </tbody></table>
1844
+
1845
+ ## Parser
1846
+
1847
+ `C.parse` will use the default parser (`C.default_parser`), but you
1848
+ can also manage your own parser(s) if you need finer control over
1849
+ state. Parser state consists of:
1850
+
1851
+ * `type_names`: a Set of Strings. As a parser eats `typedef`s, this
1852
+ grows.
1853
+ * `pos`: the `Node::Pos` this parser will start parsing at.
1854
+
1855
+ A `Node::Pos` has three read-write attributes: `filename`, `line_num`,
1856
+ `col_num`. Default is nil, 1, 0.
1857
+
1858
+ Note that the type names the parser has seen affects the parser! For
1859
+ example, consider:
1860
+
1861
+ a * b;
1862
+
1863
+ * If only `a` is a type, this is a declaration.
1864
+ * If neither `a` nor `b` are types, this is a multiplication
1865
+ statement.
1866
+ * Otherwise, it's a syntax error.
1867
+
1868
+ You may append type names implicitly, by parsing `typedef`s, or
1869
+ explicitly like this:
1870
+
1871
+ parser.type_names << 'Thing' << 'OtherThing'
1872
+
1873
+ ### Parsing Snippets
1874
+
1875
+ `C.parse` will parse the toplevel C construct, a `C::TranslationUnit`,
1876
+ but you can also parse other snippets of C:
1877
+
1878
+ C::Statement.parse('while (not_looking) { paint_car(); }')
1879
+ C::Type.parse('void *(*)(int *(*)[][2], ...)')
1880
+
1881
+ This works for both concrete and abstract `Node` subclasses. A
1882
+ `Parser` may be given as an optional second argument.
1883
+
1884
+ ### Extensions to C99
1885
+
1886
+ * `Type`s are allowed as function arguments. This is needed to parse
1887
+ C99 macros like `va_arg()`.
1888
+ * `Block`s in parentheses are allowed as expressions ([a gcc
1889
+ extension][gcc-block-expressions]). You need to call
1890
+ `parser.enable_block_expressions` first. They appear as
1891
+ `BlockExpression` nodes.
1892
+
1893
+ [gcc-block-expressions]: http://gcc.gnu.org/onlinedocs/gcc-4.2.1/gcc/Statement-Exprs.html#Statement-Exprs
1894
+
1895
+ ## Parsing Full Programs
1896
+
1897
+ This can be tricky for a number of reasons. Here are the issues you'll
1898
+ likely encounter.
1899
+
1900
+ ### Preprocessing
1901
+
1902
+ Directives that start with `#` are not handled by the `Parser`, as
1903
+ they're external to the C grammar. CAST ships with a `Preprocessor`,
1904
+ which wraps the preprocessor used to build your Ruby interpreter.
1905
+
1906
+ cpp = C::Preprocessor.new
1907
+ cpp.include_path << '/usr/include' << /usr/local/include'
1908
+ cpp.macros['DEBUG'] = '1'
1909
+ cpp.macros['max(a, b)'] = '((a) > (b) ? (a) : (b))'
1910
+ cpp.preprocess(code)
1911
+
1912
+ Note however, that preprocessors tend to leave vendor-specific
1913
+ extensions in their output. GNU `cpp`, for example, leaves
1914
+ "linemarkers" (lines that begin with `#`) in the output which you'll
1915
+ need to filter out manually before feeding it to a `Parser`.
1916
+
1917
+ ### Built-in types
1918
+
1919
+ Mac OS 10.5's system `cpp` for instance assumes the compiler will
1920
+ recognize types such as `__darwin_va_list`.
1921
+
1922
+ ### Syntactic Extensions
1923
+
1924
+ Some code may take advantage of compiler-specific extensions to the
1925
+ syntax. For example, `gcc` supports inline assembly via directives
1926
+ like:
1927
+
1928
+ asm("movl %1, %%eax;
1929
+ "movl %%eax, %0;"
1930
+ :"=r"(y)
1931
+ :"r"(x)
1932
+ :"%eax");
1933
+
1934
+ Such code is fairly rare, so there is no direct support in CAST for
1935
+ this. You'll need to manually massage such constructs out of the
1936
+ `Parser` input. Or send me patches. Delicious patches.
1937
+
1938
+ ## Contributing
1939
+
1940
+ * [Bug reports](http://github.com/oggy/cast/issues)
1941
+ * [Source](http://github.com/oggy/cast)
1942
+ * Patches: Fork on Github, send pull request.
1943
+ * Include tests where practical.
1944
+ * Leave the version alone, or bump it in a separate commit.
1945
+
1946
+ ## Copyright
1947
+
1948
+ Copyright (c) George Ogata. See LICENSE for details.