cast 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +8 -0
- data/CHANGELOG +50 -0
- data/Gemfile +2 -0
- data/LICENSE +22 -0
- data/README.markdown +1948 -0
- data/Rakefile +22 -0
- data/cast.gemspec +20 -0
- data/ext/cast.c +6 -0
- data/ext/extconf.rb +1 -1
- data/ext/parser.c +2 -2
- data/ext/yylex.c +2592 -4171
- data/ext/yylex.re +20 -26
- data/lib/cast.rb +11 -16
- data/lib/cast/c.tab.rb +2252 -2231
- data/lib/cast/c.y +185 -161
- data/lib/cast/c_nodes.rb +181 -391
- data/lib/cast/inspect.rb +8 -10
- data/lib/cast/node.rb +362 -365
- data/lib/cast/node_list.rb +156 -165
- data/lib/cast/parse.rb +86 -65
- data/lib/cast/preprocessor.rb +72 -0
- data/lib/cast/tempfile.rb +33 -0
- data/lib/cast/to_s.rb +83 -75
- data/lib/cast/version.rb +11 -0
- data/test/all.rb +5 -0
- data/test/{test_c_nodes.rb → c_nodes_test.rb} +91 -23
- data/test/lexer_test.rb +323 -0
- data/test/{test_node_list.rb → node_list_test.rb} +367 -396
- data/test/{test_node.rb → node_test.rb} +142 -160
- data/test/{test_parse.rb → parse_test.rb} +63 -17
- data/test/{test_parser.rb → parser_test.rb} +62 -22
- data/test/preprocessor_test.rb +87 -0
- data/test/render_test.rb +2086 -0
- data/test/{run.rb → test_helper.rb} +76 -88
- metadata +100 -54
- data/README +0 -6
- data/doc/index.html +0 -2505
- data/ext/cast_ext.c +0 -10
@@ -1,22 +1,22 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
ROOT = File.expand_path('..', File.dirname(__FILE__))
|
4
|
+
$:.unshift "#{ROOT}/lib"
|
5
|
+
|
3
6
|
require 'test/unit'
|
4
7
|
require 'stringio'
|
8
|
+
require 'fileutils'
|
9
|
+
require 'cast'
|
5
10
|
|
6
|
-
#
|
7
|
-
|
8
|
-
ENV['CAST_EXTDIR'] = "#{CAST_ROOT}/ext"
|
9
|
-
ENV['CAST_LIBDIR'] = "#{CAST_ROOT}/lib/cast"
|
10
|
-
require "#{CAST_ROOT}/lib/cast.rb"
|
11
|
+
# a dir to cd into for creating files and such
|
12
|
+
TEST_DIR = "#{File.dirname(__FILE__)}/var"
|
11
13
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
### ------------------------------------------------------------------
|
16
|
-
###
|
14
|
+
# --------------------------------------------------------------------
|
15
|
+
# Helpers for testing
|
16
|
+
# --------------------------------------------------------------------
|
17
17
|
|
18
18
|
class Array
|
19
|
-
def same_list?
|
19
|
+
def same_list?(other)
|
20
20
|
self.length == other.length or
|
21
21
|
return false
|
22
22
|
self.zip(other).all? do |mine, yours|
|
@@ -27,60 +27,60 @@ class Array
|
|
27
27
|
end
|
28
28
|
|
29
29
|
class Integer
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
def of
|
30
|
+
#
|
31
|
+
# Return a `self'-element array containing the result of the given
|
32
|
+
# block.
|
33
|
+
#
|
34
|
+
def of(&blk)
|
35
35
|
Array.new(self, &blk)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
39
|
module Test::Unit::Assertions
|
40
40
|
INDENT = ' '
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
def check_ast
|
41
|
+
#
|
42
|
+
# Assert that the given string is parsed as expected. The given
|
43
|
+
# string is of the format:
|
44
|
+
#
|
45
|
+
# <program>
|
46
|
+
# ----
|
47
|
+
# <expected inspect string>
|
48
|
+
#
|
49
|
+
# The <program> part is yielded to obtain the AST.
|
50
|
+
#
|
51
|
+
def check_ast(test_data)
|
52
52
|
inp, exp = test_data.split(/^----+\n/)
|
53
53
|
ast = yield(inp)
|
54
54
|
assert_tree(ast)
|
55
55
|
assert(ast.is_a?(C::Node))
|
56
56
|
assert_equal_inspect_strs(exp, ast.inspect)
|
57
57
|
end
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
def assert_equal_inspect_strs
|
62
|
-
|
58
|
+
#
|
59
|
+
# Assert that the given Node#inspect strings are equal.
|
60
|
+
#
|
61
|
+
def assert_equal_inspect_strs(exp, out)
|
62
|
+
# remove EOL space
|
63
63
|
out = out.gsub(/ *$/, '')
|
64
64
|
exp = exp.gsub(/ *$/, '')
|
65
65
|
|
66
|
-
|
66
|
+
# normalize BOL space
|
67
67
|
exp.gsub!(%r'^#{INDENT}*') do |s|
|
68
68
|
levels = s.length / INDENT.length
|
69
69
|
C::Node::INSPECT_TAB*levels
|
70
70
|
end
|
71
71
|
|
72
|
-
|
72
|
+
# compare
|
73
73
|
msg = "Debug strings unequal:\n#{juxtapose('Expected', exp, 'Output', out)}"
|
74
74
|
assert_block(msg){out == exp}
|
75
75
|
end
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
def juxtapose
|
82
|
-
s1 = s1.
|
83
|
-
s2 = s2.
|
76
|
+
#
|
77
|
+
# Return a string of `s1' and `s2' side by side with a dividing line
|
78
|
+
# in between indicating differences. `h1' and `h2' are the column
|
79
|
+
# headings.
|
80
|
+
#
|
81
|
+
def juxtapose(h1, s1, h2, s2)
|
82
|
+
s1 = s1.split("\n")
|
83
|
+
s2 = s2.split("\n")
|
84
84
|
rows = [s1.length, s2.length].max
|
85
85
|
wl = s1.map{|line| line.length}.max
|
86
86
|
wr = s2.map{|line| line.length}.max
|
@@ -102,11 +102,11 @@ module Test::Unit::Assertions
|
|
102
102
|
ret << "#{('-'*wl)}----#{'-'*wr}\n"
|
103
103
|
return ret
|
104
104
|
end
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
def assert_error
|
105
|
+
#
|
106
|
+
# Assert that an exception of the given class is raised, and that
|
107
|
+
# the message matches the given regex.
|
108
|
+
#
|
109
|
+
def assert_error(klass, re)
|
110
110
|
ex = nil
|
111
111
|
assert_raise(klass) do
|
112
112
|
begin
|
@@ -117,11 +117,11 @@ module Test::Unit::Assertions
|
|
117
117
|
end
|
118
118
|
assert_match(re, ex.message)
|
119
119
|
end
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
def assert_tree
|
120
|
+
#
|
121
|
+
# Assert that the given ast's nodes' parents are correct, and there
|
122
|
+
# aren't non-Nodes where there shouldn't be.
|
123
|
+
#
|
124
|
+
def assert_tree(ast)
|
125
125
|
meth = 'unknown method'
|
126
126
|
caller.each do |line|
|
127
127
|
if line =~ /in `(test_.*?)'/ #`
|
@@ -139,8 +139,8 @@ module Test::Unit::Assertions
|
|
139
139
|
flunk("#{e.message}. Output dumped to `#{filename}'.")
|
140
140
|
end
|
141
141
|
end
|
142
|
-
|
143
|
-
def assert_tree1
|
142
|
+
#
|
143
|
+
def assert_tree1(x, parent)
|
144
144
|
if x.is_a? C::Node
|
145
145
|
parent.equal? x.parent or
|
146
146
|
raise BadTreeError, "#{x.class}:0x#{(x.id << 1).to_s(16)} has #{x.parent ? 'wrong' : 'no'} parent"
|
@@ -155,53 +155,41 @@ module Test::Unit::Assertions
|
|
155
155
|
end
|
156
156
|
end
|
157
157
|
class BadTreeError < StandardError; end
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
def assert_list
|
158
|
+
#
|
159
|
+
# Assert that `arg' is a C::NodeList.
|
160
|
+
#
|
161
|
+
def assert_list(arg)
|
162
162
|
assert_kind_of(C::NodeList, arg)
|
163
163
|
end
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
def assert_empty_list
|
164
|
+
#
|
165
|
+
# Assert that `arg' is an empty C::NodeList.
|
166
|
+
#
|
167
|
+
def assert_empty_list(arg)
|
168
168
|
assert_list arg
|
169
169
|
assert(arg.empty?)
|
170
170
|
end
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
def assert_same_list
|
171
|
+
#
|
172
|
+
# Assert that the elements of exp are the same as those of out, and
|
173
|
+
# are in the same order.
|
174
|
+
#
|
175
|
+
def assert_same_list(exp, out)
|
176
176
|
assert_equal(exp.length, out.length, "Checking length")
|
177
177
|
(0...exp.length).each do |i|
|
178
178
|
assert_same(exp[i], out[i], "At index #{i} (of 0...#{exp.length})")
|
179
179
|
end
|
180
180
|
end
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
def assert_copy
|
181
|
+
#
|
182
|
+
# Assert that out is ==, but not the same as exp (i.e., it is a
|
183
|
+
# copy).
|
184
|
+
#
|
185
|
+
def assert_copy(exp, out)
|
186
186
|
assert_not_same exp, out
|
187
187
|
assert_equal exp, out
|
188
188
|
end
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
def assert_invariants
|
189
|
+
#
|
190
|
+
# Assert the invariants of `node'.
|
191
|
+
#
|
192
|
+
def assert_invariants(node)
|
193
193
|
node.assert_invariants(self)
|
194
194
|
end
|
195
195
|
end
|
196
|
-
|
197
|
-
###
|
198
|
-
### ------------------------------------------------------------------
|
199
|
-
### Main
|
200
|
-
### ------------------------------------------------------------------
|
201
|
-
###
|
202
|
-
|
203
|
-
if $0 == __FILE__
|
204
|
-
Dir.new(Dir.pwd).grep(/^test_/) do |filename|
|
205
|
-
require "#{Dir.pwd}/#{filename}"
|
206
|
-
end
|
207
|
-
end
|
metadata
CHANGED
@@ -1,68 +1,114 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.8.11
|
3
|
-
specification_version: 1
|
1
|
+
--- !ruby/object:Gem::Specification
|
4
2
|
name: cast
|
5
|
-
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
|
8
|
-
summary: C parser and AST constructor.
|
9
|
-
require_paths:
|
10
|
-
- lib
|
11
|
-
email: george.ogata@gmail.com
|
12
|
-
homepage: http://cast.rubyforge.org
|
13
|
-
rubyforge_project: cast
|
14
|
-
description:
|
15
|
-
autorequire: cast
|
16
|
-
default_executable:
|
17
|
-
bindir: bin
|
18
|
-
has_rdoc: false
|
19
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">"
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 0.0.0
|
24
|
-
version:
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
prerelease:
|
25
6
|
platform: ruby
|
26
|
-
|
27
|
-
cert_chain:
|
28
|
-
authors:
|
7
|
+
authors:
|
29
8
|
- George Ogata
|
30
|
-
|
31
|
-
|
32
|
-
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-05-14 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: ritual
|
16
|
+
requirement: &70254348936800 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.4.0
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70254348936800
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: racc
|
27
|
+
requirement: &70254349108160 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.4.8
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70254349108160
|
36
|
+
description:
|
37
|
+
email:
|
38
|
+
- george.ogata@gmail.com
|
39
|
+
executables: []
|
40
|
+
extensions:
|
41
|
+
- ext/extconf.rb
|
42
|
+
extra_rdoc_files: []
|
43
|
+
files:
|
44
|
+
- .gitignore
|
45
|
+
- CHANGELOG
|
46
|
+
- Gemfile
|
47
|
+
- LICENSE
|
48
|
+
- README.markdown
|
49
|
+
- Rakefile
|
50
|
+
- cast.gemspec
|
51
|
+
- ext/cast.c
|
52
|
+
- ext/cast.h
|
53
|
+
- ext/extconf.rb
|
54
|
+
- ext/parser.c
|
55
|
+
- ext/yylex.re
|
33
56
|
- lib/cast.rb
|
34
|
-
- lib/cast/node.rb
|
35
57
|
- lib/cast/c.y
|
36
58
|
- lib/cast/c_nodes.rb
|
37
59
|
- lib/cast/inspect.rb
|
60
|
+
- lib/cast/node.rb
|
38
61
|
- lib/cast/node_list.rb
|
39
62
|
- lib/cast/parse.rb
|
63
|
+
- lib/cast/preprocessor.rb
|
64
|
+
- lib/cast/tempfile.rb
|
40
65
|
- lib/cast/to_s.rb
|
41
|
-
-
|
42
|
-
-
|
43
|
-
-
|
44
|
-
-
|
45
|
-
-
|
46
|
-
-
|
47
|
-
- test/
|
48
|
-
- test/
|
49
|
-
- test/
|
50
|
-
- test/
|
51
|
-
- test/
|
52
|
-
- test/test_parser.rb
|
66
|
+
- lib/cast/version.rb
|
67
|
+
- test/all.rb
|
68
|
+
- test/c_nodes_test.rb
|
69
|
+
- test/lexer_test.rb
|
70
|
+
- test/node_list_test.rb
|
71
|
+
- test/node_test.rb
|
72
|
+
- test/parse_test.rb
|
73
|
+
- test/parser_test.rb
|
74
|
+
- test/preprocessor_test.rb
|
75
|
+
- test/render_test.rb
|
76
|
+
- test/test_helper.rb
|
53
77
|
- ext/yylex.c
|
54
78
|
- lib/cast/c.tab.rb
|
55
|
-
|
56
|
-
|
79
|
+
homepage: http://github.com/oggy/cast
|
80
|
+
licenses: []
|
81
|
+
post_install_message:
|
57
82
|
rdoc_options: []
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
-
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ! '>='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
65
97
|
requirements: []
|
66
|
-
|
67
|
-
|
68
|
-
|
98
|
+
rubyforge_project:
|
99
|
+
rubygems_version: 1.8.10
|
100
|
+
signing_key:
|
101
|
+
specification_version: 3
|
102
|
+
summary: C parser and AST constructor.
|
103
|
+
test_files:
|
104
|
+
- test/all.rb
|
105
|
+
- test/c_nodes_test.rb
|
106
|
+
- test/lexer_test.rb
|
107
|
+
- test/node_list_test.rb
|
108
|
+
- test/node_test.rb
|
109
|
+
- test/parse_test.rb
|
110
|
+
- test/parser_test.rb
|
111
|
+
- test/preprocessor_test.rb
|
112
|
+
- test/render_test.rb
|
113
|
+
- test/test_helper.rb
|
114
|
+
has_rdoc:
|
data/README
DELETED
data/doc/index.html
DELETED
@@ -1,2505 +0,0 @@
|
|
1
|
-
<!-- Whoa, hand-written HTML? How 1995! -->
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>CAST -- Ruby's C parsing dog. Woof.</title>
|
5
|
-
</head>
|
6
|
-
<body>
|
7
|
-
<style>
|
8
|
-
body {
|
9
|
-
}
|
10
|
-
ul {
|
11
|
-
line-height: 1.5em;
|
12
|
-
list-style-type: square;
|
13
|
-
margin: 0.3em 0 0 1.5em;
|
14
|
-
padding:0;
|
15
|
-
list-style-image: url("bullet.gif");
|
16
|
-
}
|
17
|
-
li { margin-bottom: 0.1em; }
|
18
|
-
li.node_classes {
|
19
|
-
color: #447744;
|
20
|
-
}
|
21
|
-
span.node_classes_abstract {
|
22
|
-
color: #447744;
|
23
|
-
font-weight: bolder;
|
24
|
-
}
|
25
|
-
span.node_classes_concrete {
|
26
|
-
color: #447744;
|
27
|
-
}
|
28
|
-
tt {
|
29
|
-
}
|
30
|
-
h1 {
|
31
|
-
color: #447744;
|
32
|
-
text-align: center;
|
33
|
-
}
|
34
|
-
h2 {
|
35
|
-
color: #447744;
|
36
|
-
border-bottom-style: solid;
|
37
|
-
border-bottom-width: 1;
|
38
|
-
border-bottom-color: #447744;
|
39
|
-
}
|
40
|
-
h3 {
|
41
|
-
color: #447744;
|
42
|
-
}
|
43
|
-
pre.code_snippet {
|
44
|
-
border-style: solid;
|
45
|
-
border-color: #000000;
|
46
|
-
border-width: 2;
|
47
|
-
padding: 4;
|
48
|
-
background-color: #ffffcc;
|
49
|
-
}
|
50
|
-
span.code_comment {
|
51
|
-
color: #447744;
|
52
|
-
font-style: oblique;
|
53
|
-
}
|
54
|
-
span.code_highlight {
|
55
|
-
color: #ff0000;
|
56
|
-
}
|
57
|
-
div.node_classes {
|
58
|
-
border-style: solid;
|
59
|
-
border-color: #000000;
|
60
|
-
border-width: 2;
|
61
|
-
background-color: #ffffcc;
|
62
|
-
color: #447744;
|
63
|
-
}
|
64
|
-
table.node_desc {
|
65
|
-
border-style: solid;
|
66
|
-
border-color: #000000;
|
67
|
-
border-width: 2;
|
68
|
-
}
|
69
|
-
thead {
|
70
|
-
font-weight: bolder;
|
71
|
-
}
|
72
|
-
tr.node_desc_header {
|
73
|
-
}
|
74
|
-
tr.node_desc_oddrow {
|
75
|
-
background-color: #ddffdd;
|
76
|
-
}
|
77
|
-
tr.node_desc_evenrow {
|
78
|
-
background-color: #ffffcc;
|
79
|
-
}
|
80
|
-
a.links {
|
81
|
-
color: #885500;
|
82
|
-
}
|
83
|
-
td.links {
|
84
|
-
padding: 5;
|
85
|
-
background-color: #bbddff;
|
86
|
-
vertical-align: top;
|
87
|
-
border-right-style: solid;
|
88
|
-
border-color: #000000;
|
89
|
-
border-width: 5;
|
90
|
-
color: #ffffff;
|
91
|
-
}
|
92
|
-
td.nd_class {
|
93
|
-
vertical-align: center;
|
94
|
-
}
|
95
|
-
td.nd_field {
|
96
|
-
vertical-align: top;
|
97
|
-
}
|
98
|
-
td.nd_child {
|
99
|
-
vertical-align: top;
|
100
|
-
text-align: center;
|
101
|
-
}
|
102
|
-
td.nd_values {
|
103
|
-
vertical-align: top;
|
104
|
-
}
|
105
|
-
td.nd_default {
|
106
|
-
vertical-align: top;
|
107
|
-
}
|
108
|
-
td.nd_comments {
|
109
|
-
vertical-align: top;
|
110
|
-
}
|
111
|
-
</style>
|
112
|
-
|
113
|
-
<table><tr><td class="links"> <!-- frame table -->
|
114
|
-
|
115
|
-
<ul>
|
116
|
-
<li><a class="links" href="http://rubyforge.org/projects/cast/">RubyForge</a></li>
|
117
|
-
<li><a class="links" href="http://rubyforge.org/frs/?group_id=561">Download</a></li>
|
118
|
-
</ul>
|
119
|
-
|
120
|
-
</td><td> <!-- frame table -->
|
121
|
-
|
122
|
-
<h1>CAST</h1>
|
123
|
-
|
124
|
-
<h2>What Is</h2>
|
125
|
-
<p>
|
126
|
-
CAST parses C code into an abstract syntax tree (AST), lets you
|
127
|
-
break it, then vomit it out as code. The parser does C99.
|
128
|
-
</p>
|
129
|
-
|
130
|
-
<h2>Library Overview</h2>
|
131
|
-
|
132
|
-
<p>Everything is in the module <tt>C</tt>.</p>
|
133
|
-
<ul>
|
134
|
-
<li>There's the parser (<tt>Parser</tt>).</li>
|
135
|
-
<li>There's the tree (<tt>Node</tt> and its subclasses).</li>
|
136
|
-
<li>That's it.</li>
|
137
|
-
</ul>
|
138
|
-
|
139
|
-
<h3>Usage</h3>
|
140
|
-
|
141
|
-
<p>
|
142
|
-
You call <tt>Parser#parse</tt>, and it gives you a tree of
|
143
|
-
<tt>Node</tt> objects. Watch:
|
144
|
-
</p>
|
145
|
-
|
146
|
-
<pre class="code_snippet">
|
147
|
-
require 'cast/cast'
|
148
|
-
|
149
|
-
<span class="code_comment">## create a parser</span>
|
150
|
-
parser = C::Parser.new
|
151
|
-
|
152
|
-
<span class="code_comment">## (optional) set some settings...</span>
|
153
|
-
parser.pos.filename = "toy.c" <span class="code_comment"># used for error messages</span>
|
154
|
-
parser.type_names << 'LinkedList' <span class="code_comment"># treat these words as types</span>
|
155
|
-
|
156
|
-
<span class="code_comment">## gimme a tree</span>
|
157
|
-
ugly_c_code = open("toy.c"){|f| f.read}
|
158
|
-
tree = parser.parse(ugly_c_code)
|
159
|
-
|
160
|
-
<span class="code_comment">## what's the tree look like?</span>
|
161
|
-
p tree
|
162
|
-
</pre>
|
163
|
-
|
164
|
-
<p>
|
165
|
-
If there's a parse error, <tt>#parse</tt> raises a
|
166
|
-
<tt>ParseError</tt> (which has a nice error message in
|
167
|
-
<tt>#message</tt>).
|
168
|
-
</p>
|
169
|
-
|
170
|
-
<a name="the_parser"></a><h2>The Parser</h2>
|
171
|
-
|
172
|
-
<p>
|
173
|
-
Here's a quiz: what does "<tt>a * b;</tt>" do?
|
174
|
-
</p>
|
175
|
-
<p>
|
176
|
-
I bet you said "why you l4m3r n00b, that's a statement that
|
177
|
-
multiplies <tt>a</tt> by <tt>b</tt> and throws away the answer --
|
178
|
-
now go take your meaningless snippetage to your computing 101 class
|
179
|
-
and let me finish hurting this Java<sup>TM</sup> programmer." Well,
|
180
|
-
you'd be both mean and wrong. It was, of course, a trick question.
|
181
|
-
I didn't say if any of <tt>a</tt> and <tt>b</tt> are types! If only
|
182
|
-
<tt>a</tt> is a type, it's actually a declaration. And if
|
183
|
-
<tt>b</tt> is a type, it's a syntax error.
|
184
|
-
</p>
|
185
|
-
<p>
|
186
|
-
So, the parser's gonna need to know which identifiers are type
|
187
|
-
names. This is one of the bits of state that a <tt>Parser</tt>
|
188
|
-
keeps. Here's the complete list (um, of two):
|
189
|
-
</p>
|
190
|
-
<ul>
|
191
|
-
<li>
|
192
|
-
<tt>#type_names</tt> -- a <tt>Set</tt> of <tt>String</tt>s.
|
193
|
-
</li>
|
194
|
-
<li>
|
195
|
-
<tt>#pos</tt> -- the <tt>Node::Pos</tt> this parser will start
|
196
|
-
parsing at.
|
197
|
-
</li>
|
198
|
-
</ul>
|
199
|
-
|
200
|
-
<p>
|
201
|
-
A <tt>Node::Pos</tt> has three read-write atts: <tt>#filename</tt>,
|
202
|
-
<tt>#line_num</tt>, <tt>#col_num</tt>. Default is <tt>nil</tt>, 1,
|
203
|
-
0.
|
204
|
-
</p>
|
205
|
-
|
206
|
-
<a name="the_nodes"></a><h2>The Nodes</h2>
|
207
|
-
|
208
|
-
<p>There are a couple of Node classes:</p>
|
209
|
-
|
210
|
-
<div class="node_classes"><table><tr>
|
211
|
-
<td>
|
212
|
-
<ul>
|
213
|
-
<li class="node_classes"><span class="node_classes_abstract">Node</span><ul>
|
214
|
-
<li class="node_classes"><span class="node_classes_concrete">TranslationUnit</span></li>
|
215
|
-
<li class="node_classes"><span class="node_classes_concrete">Declaration</span></li>
|
216
|
-
<li class="node_classes"><span class="node_classes_concrete">Declarator</span></li>
|
217
|
-
<li class="node_classes"><span class="node_classes_concrete">FunctionDef</span></li>
|
218
|
-
<li class="node_classes"><span class="node_classes_concrete">Parameter</span></li>
|
219
|
-
<li class="node_classes"><span class="node_classes_concrete">Enumerator</span></li>
|
220
|
-
<li class="node_classes"><span class="node_classes_concrete">MemberInit</span></li>
|
221
|
-
<li class="node_classes"><span class="node_classes_concrete">Member</span></li>
|
222
|
-
<li class="node_classes"><span class="node_classes_abstract">Statement</span><ul>
|
223
|
-
<li class="node_classes"><span class="node_classes_concrete">Block</span></li>
|
224
|
-
<li class="node_classes"><span class="node_classes_concrete">If</span></li>
|
225
|
-
<li class="node_classes"><span class="node_classes_concrete">Switch</span></li>
|
226
|
-
<li class="node_classes"><span class="node_classes_concrete">While</span></li>
|
227
|
-
<li class="node_classes"><span class="node_classes_concrete">For</span></li>
|
228
|
-
<li class="node_classes"><span class="node_classes_concrete">Goto</span></li>
|
229
|
-
<li class="node_classes"><span class="node_classes_concrete">Continue</span></li>
|
230
|
-
<li class="node_classes"><span class="node_classes_concrete">Break</span></li>
|
231
|
-
<li class="node_classes"><span class="node_classes_concrete">Return</span></li>
|
232
|
-
<li class="node_classes"><span class="node_classes_concrete">ExpressionStatement</span></li>
|
233
|
-
</ul></li>
|
234
|
-
<li class="node_classes"><span class="node_classes_abstract">Label</span><ul>
|
235
|
-
<li class="node_classes"><span class="node_classes_concrete">PlainLabel</span></li>
|
236
|
-
<li class="node_classes"><span class="node_classes_concrete">Default</span></li>
|
237
|
-
<li class="node_classes"><span class="node_classes_concrete">Case</span></li>
|
238
|
-
</ul></li>
|
239
|
-
</ul></li>
|
240
|
-
</ul>
|
241
|
-
</td><td>
|
242
|
-
<ul>
|
243
|
-
<li class="node_classes"><span class="node_classes_abstract">Node</span><ul>
|
244
|
-
<li class="node_classes"><span class="node_classes_abstract">Expression</span><ul>
|
245
|
-
<li class="node_classes"><span class="node_classes_concrete">Comma</span></li>
|
246
|
-
<li class="node_classes"><span class="node_classes_concrete">Conditional</span></li>
|
247
|
-
<li class="node_classes"><span class="node_classes_concrete">Variable</span></li>
|
248
|
-
<li class="node_classes"><span class="node_classes_abstract">UnaryExpression</span><ul>
|
249
|
-
<li class="node_classes"><span class="node_classes_abstract">PostfixExpression</span><ul>
|
250
|
-
<li class="node_classes"><span class="node_classes_concrete">Index</span></li>
|
251
|
-
<li class="node_classes"><span class="node_classes_concrete">Call</span></li>
|
252
|
-
<li class="node_classes"><span class="node_classes_concrete">Dot</span></li>
|
253
|
-
<li class="node_classes"><span class="node_classes_concrete">Arrow</span></li>
|
254
|
-
<li class="node_classes"><span class="node_classes_concrete">PostInc</span></li>
|
255
|
-
<li class="node_classes"><span class="node_classes_concrete">PostDec</span></li>
|
256
|
-
</ul></li>
|
257
|
-
<li class="node_classes"><span class="node_classes_abstract">PrefixExpression</span><ul>
|
258
|
-
<li class="node_classes"><span class="node_classes_concrete">Cast</span></li>
|
259
|
-
<li class="node_classes"><span class="node_classes_concrete">Address</span></li>
|
260
|
-
<li class="node_classes"><span class="node_classes_concrete">Dereference</span></li>
|
261
|
-
<li class="node_classes"><span class="node_classes_concrete">Sizeof</span></li>
|
262
|
-
<li class="node_classes"><span class="node_classes_concrete">Plus</span></li>
|
263
|
-
<li class="node_classes"><span class="node_classes_concrete">Minus</span></li>
|
264
|
-
<li class="node_classes"><span class="node_classes_concrete">PreInc</span></li>
|
265
|
-
<li class="node_classes"><span class="node_classes_concrete">PreDec</span></li>
|
266
|
-
<li class="node_classes"><span class="node_classes_concrete">BitNot</span></li>
|
267
|
-
<li class="node_classes"><span class="node_classes_concrete">Not</span></li>
|
268
|
-
</ul></li>
|
269
|
-
</ul></li>
|
270
|
-
</ul></li>
|
271
|
-
</ul></li>
|
272
|
-
</ul>
|
273
|
-
</td><td>
|
274
|
-
<ul>
|
275
|
-
<li class="node_classes"><span class="node_classes_abstract">Node</span><ul>
|
276
|
-
<li class="node_classes"><span class="node_classes_abstract">Expression</span><ul>
|
277
|
-
<li class="node_classes"><span class="node_classes_abstract">BinaryExpression</span><ul>
|
278
|
-
<li class="node_classes"><span class="node_classes_concrete">Add</span></li>
|
279
|
-
<li class="node_classes"><span class="node_classes_concrete">Subtract</span></li>
|
280
|
-
<li class="node_classes"><span class="node_classes_concrete">Multiply</span></li>
|
281
|
-
<li class="node_classes"><span class="node_classes_concrete">Divide</span></li>
|
282
|
-
<li class="node_classes"><span class="node_classes_concrete">Mod</span></li>
|
283
|
-
<li class="node_classes"><span class="node_classes_concrete">Equal</span></li>
|
284
|
-
<li class="node_classes"><span class="node_classes_concrete">NotEqual</span></li>
|
285
|
-
<li class="node_classes"><span class="node_classes_concrete">Less</span></li>
|
286
|
-
<li class="node_classes"><span class="node_classes_concrete">More</span></li>
|
287
|
-
<li class="node_classes"><span class="node_classes_concrete">LessOrEqual</span></li>
|
288
|
-
<li class="node_classes"><span class="node_classes_concrete">MoreOrEqual</span></li>
|
289
|
-
<li class="node_classes"><span class="node_classes_concrete">BitAnd</span></li>
|
290
|
-
<li class="node_classes"><span class="node_classes_concrete">BitOr</span></li>
|
291
|
-
<li class="node_classes"><span class="node_classes_concrete">BitXor</span></li>
|
292
|
-
<li class="node_classes"><span class="node_classes_concrete">ShiftLeft</span></li>
|
293
|
-
<li class="node_classes"><span class="node_classes_concrete">ShiftRight</span></li>
|
294
|
-
<li class="node_classes"><span class="node_classes_concrete">And</span></li>
|
295
|
-
<li class="node_classes"><span class="node_classes_concrete">Or</span></li>
|
296
|
-
</ul></li>
|
297
|
-
</ul></li>
|
298
|
-
</ul></li>
|
299
|
-
</ul>
|
300
|
-
</td><td>
|
301
|
-
<ul>
|
302
|
-
<li class="node_classes"><span class="node_classes_abstract">Node</span><ul>
|
303
|
-
<li class="node_classes"><span class="node_classes_abstract">Expression</span><ul>
|
304
|
-
<li class="node_classes"><span class="node_classes_abstract">AssignmentExpression</span><ul>
|
305
|
-
<li class="node_classes"><span class="node_classes_concrete">Assign</span></li>
|
306
|
-
<li class="node_classes"><span class="node_classes_concrete">MultiplyAssign</span></li>
|
307
|
-
<li class="node_classes"><span class="node_classes_concrete">DivideAssign</span></li>
|
308
|
-
<li class="node_classes"><span class="node_classes_concrete">ModAssign</span></li>
|
309
|
-
<li class="node_classes"><span class="node_classes_concrete">AddAssign</span></li>
|
310
|
-
<li class="node_classes"><span class="node_classes_concrete">SubtractAssign</span></li>
|
311
|
-
<li class="node_classes"><span class="node_classes_concrete">ShiftLeftAssign</span></li>
|
312
|
-
<li class="node_classes"><span class="node_classes_concrete">ShiftRightAssign</span></li>
|
313
|
-
<li class="node_classes"><span class="node_classes_concrete">BitAndAssign</span></li>
|
314
|
-
<li class="node_classes"><span class="node_classes_concrete">BitXorAssign</span></li>
|
315
|
-
<li class="node_classes"><span class="node_classes_concrete">BitOrAssign</span></li>
|
316
|
-
</ul></li>
|
317
|
-
<li class="node_classes"><span class="node_classes_abstract">Literal</span><ul>
|
318
|
-
<li class="node_classes"><span class="node_classes_concrete">StringLiteral</span></li>
|
319
|
-
<li class="node_classes"><span class="node_classes_concrete">CharLiteral</span></li>
|
320
|
-
<li class="node_classes"><span class="node_classes_concrete">CompoundLiteral</span></li>
|
321
|
-
<li class="node_classes"><span class="node_classes_concrete">IntLiteral</span></li>
|
322
|
-
<li class="node_classes"><span class="node_classes_concrete">FloatLiteral</span></li>
|
323
|
-
</ul></li>
|
324
|
-
</ul></li>
|
325
|
-
</ul></li>
|
326
|
-
</ul>
|
327
|
-
</td><td>
|
328
|
-
<ul>
|
329
|
-
<li class="node_classes"><span class="node_classes_abstract">Node</span><ul>
|
330
|
-
<li class="node_classes"><span class="node_classes_abstract">Type</span><ul>
|
331
|
-
<li class="node_classes"><span class="node_classes_abstract">IndirectType</span><ul>
|
332
|
-
<li class="node_classes"><span class="node_classes_concrete">Pointer</span></li>
|
333
|
-
<li class="node_classes"><span class="node_classes_concrete">Array</span></li>
|
334
|
-
<li class="node_classes"><span class="node_classes_concrete">Function</span></li>
|
335
|
-
</ul></li>
|
336
|
-
<li class="node_classes"><span class="node_classes_abstract">DirectType</span><ul>
|
337
|
-
<li class="node_classes"><span class="node_classes_concrete">Struct</span></li>
|
338
|
-
<li class="node_classes"><span class="node_classes_concrete">Union</span></li>
|
339
|
-
<li class="node_classes"><span class="node_classes_concrete">Enum</span></li>
|
340
|
-
<li class="node_classes"><span class="node_classes_concrete">CustomType</span></li>
|
341
|
-
<li class="node_classes"><span class="node_classes_abstract">PrimitiveType</span><ul>
|
342
|
-
<li class="node_classes"><span class="node_classes_concrete">Void</span></li>
|
343
|
-
<li class="node_classes"><span class="node_classes_concrete">Int</span></li>
|
344
|
-
<li class="node_classes"><span class="node_classes_concrete">Float</span></li>
|
345
|
-
<li class="node_classes"><span class="node_classes_concrete">Char</span></li>
|
346
|
-
<li class="node_classes"><span class="node_classes_concrete">Bool</span></li>
|
347
|
-
<li class="node_classes"><span class="node_classes_concrete">Complex</span></li>
|
348
|
-
<li class="node_classes"><span class="node_classes_concrete">Imaginary</span></li>
|
349
|
-
</ul></li>
|
350
|
-
</ul></li>
|
351
|
-
</ul></li>
|
352
|
-
<li class="node_classes"><span class="node_classes_abstract">NodeList</span><ul>
|
353
|
-
<li class="node_classes"><span class="node_classes_concrete">NodeArray</span></li>
|
354
|
-
<li class="node_classes"><span class="node_classes_concrete">NodeChain</span></li>
|
355
|
-
</ul></li>
|
356
|
-
</ul></li>
|
357
|
-
</ul>
|
358
|
-
</td></tr>
|
359
|
-
</table></div>
|
360
|
-
|
361
|
-
<p>
|
362
|
-
The <b>bold</b> ones are abstract.
|
363
|
-
</p>
|
364
|
-
<p>
|
365
|
-
The last 2 (the <tt>NodeList</tt>s) represent lists of nodes.
|
366
|
-
Methodwise, they try to behave like normal ruby <tt>::Array</tt>s.
|
367
|
-
Implementationwise, a <tt>NodeChain</tt> is a doubly linked list,
|
368
|
-
whereas a <tt>NodeArray</tt> is an array. <tt>NodeChain</tt>s may
|
369
|
-
be more efficient when adding things at the beginning of a LARGE
|
370
|
-
list.
|
371
|
-
</p>
|
372
|
-
|
373
|
-
<h3>Attributes</h3>
|
374
|
-
|
375
|
-
<p>Each <tt>Node</tt> object has:</p>
|
376
|
-
|
377
|
-
<ul>
|
378
|
-
<li>
|
379
|
-
<tt>#parent</tt> -- return the parent in the tree (a <tt>Node</tt>
|
380
|
-
or <tt>nil</tt>).
|
381
|
-
</li>
|
382
|
-
<li>
|
383
|
-
<tt>#pos</tt>, <tt>#pos=</tt> -- the position in the source file
|
384
|
-
(a <tt>Node::Pos</tt>).
|
385
|
-
</li>
|
386
|
-
<li>
|
387
|
-
<tt>#to_s</tt> -- return the code for the tree (a
|
388
|
-
<tt>String</tt>).
|
389
|
-
</li>
|
390
|
-
<li>
|
391
|
-
<tt>#inspect</tt> -- return a pretty string for inspection.
|
392
|
-
<b>Try it</b>.
|
393
|
-
</li>
|
394
|
-
<li>
|
395
|
-
<tt>#match?(str)</tt>, <tt>#=~(str)</tt> -- return true iff
|
396
|
-
<tt>str</tt> parses as a <tt>Node</tt> equal to this one.
|
397
|
-
</li>
|
398
|
-
<li>
|
399
|
-
<tt>#detach</tt> -- remove this node from the tree (parent becomes
|
400
|
-
nil) and return it.
|
401
|
-
</li>
|
402
|
-
<li>
|
403
|
-
<tt>#detached?</tt>, <tt>#attached?</tt> -- return true if parent
|
404
|
-
is nil or non-nil respectively.
|
405
|
-
</li>
|
406
|
-
<li>
|
407
|
-
<tt>#replace_with(node)</tt> -- replace this node with
|
408
|
-
<tt>node</tt> in the tree.
|
409
|
-
</li>
|
410
|
-
<li>
|
411
|
-
<tt>#swap_with(node)</tt> -- exchange this node with <tt>node</tt>
|
412
|
-
in their trees.
|
413
|
-
</li>
|
414
|
-
<li>
|
415
|
-
<tt>#insert_prev(*<tt>nodes</tt>)</tt>,
|
416
|
-
<tt>#insert_next(*nodes)</tt> -- insert <tt>nodes</tt> before this
|
417
|
-
node in the parent list. Parent must be a <tt>NodeList</tt>!
|
418
|
-
Useful for adding statements before a node in a block, for
|
419
|
-
example.
|
420
|
-
</li>
|
421
|
-
<li>
|
422
|
-
<tt>#<i>Foo</i>?</tt> -- (where <tt><i>Foo</i></tt> is a module
|
423
|
-
name) return <tt>self.is_a?(<em>Foo</em>)</tt>.
|
424
|
-
</li>
|
425
|
-
</ul>
|
426
|
-
|
427
|
-
<!--<p>
|
428
|
-
Now the <tt>Foo?</tt> method above probably gave all the duck typing
|
429
|
-
purists heart attacks, so I should prepare my defence. CAST pays
|
430
|
-
close attention to the classes of <tt>Node</tt>s. That means if you
|
431
|
-
dress up a <tt>Thingy</tt> as a <tt>FunctionDef</tt> and smuggle it
|
432
|
-
into the tree, don't expect the pacemaker you're using this for to
|
433
|
-
function correctly. Basic methods like <tt>Node#==</tt> check that
|
434
|
-
the classes match.
|
435
|
-
</p>-->
|
436
|
-
|
437
|
-
<p>
|
438
|
-
The <tt>#<i>Foo</i>?</tt> method is a convienience for a common
|
439
|
-
need. Example:
|
440
|
-
</p>
|
441
|
-
<pre class="code_snippet">
|
442
|
-
<span class="code_comment">## make a tree</span>
|
443
|
-
ast = C::Parser.new.parse(code_string)
|
444
|
-
|
445
|
-
<span class="code_comment">## print all global variables</span>
|
446
|
-
ast.entities.each do |node|
|
447
|
-
node.<span class="code_highlight">Declaration?</span> or next
|
448
|
-
node.declarators.each do |decl|
|
449
|
-
unless decl.type.<span class="code_highlight">Function?</span>
|
450
|
-
puts "#{decl.name}: #{decl.type}"
|
451
|
-
end
|
452
|
-
end
|
453
|
-
end
|
454
|
-
</pre>
|
455
|
-
|
456
|
-
<p>
|
457
|
-
If you're a duck-typing purist, then sorry for the cardiac arrest
|
458
|
-
you're now experiencing. CAST <b>does</b> pay attention to the
|
459
|
-
class of <tt>Node</tt> objects for quite a few things. This is the
|
460
|
-
cleanest way to distinguish, e.g., an <tt>Add</tt> from a
|
461
|
-
<tt>Subtract</tt> (which both have the same methods but represent
|
462
|
-
very different things). It just seems impractical (and unnecessary)
|
463
|
-
to allow duck typing in this situation.
|
464
|
-
</p>
|
465
|
-
|
466
|
-
<p>
|
467
|
-
The <tt>#=~</tt> method lets you do:
|
468
|
-
</p>
|
469
|
-
|
470
|
-
<pre class="code_snippet">
|
471
|
-
if declarator.type <span class="code_highlight">=~</span> 'const int *'
|
472
|
-
puts "Ooh, a const int pointer!"
|
473
|
-
end
|
474
|
-
</pre>
|
475
|
-
|
476
|
-
<p>
|
477
|
-
This is <b>not</b> the same as "<tt>declarator.type.to_s == 'const
|
478
|
-
int *'</tt>"; that'd require you to guess how to_s formats its
|
479
|
-
strings (most notably, the whitespace).
|
480
|
-
</p>
|
481
|
-
|
482
|
-
<h3>Fields and children</h3>
|
483
|
-
|
484
|
-
<p>
|
485
|
-
Each concrete <tt>Node</tt> class has a member for each bit of
|
486
|
-
important C stuff it pertains to. I know you peeked at the big list
|
487
|
-
below, so you know the kind of thing I mean.
|
488
|
-
</p>
|
489
|
-
|
490
|
-
<p>
|
491
|
-
But these aren't defined as <tt>attr</tt>s as you normally do in
|
492
|
-
Ruby -- they're <strong>field</strong>s. If a node has a field
|
493
|
-
<tt>foo</tt>, it means there's a setter <tt>#foo=</tt> and getter
|
494
|
-
<tt>#foo</tt>. (A field <tt>foo?</tt> means the setter is
|
495
|
-
<tt>#foo=</tt> and the getter is <tt>#foo?</tt>.) Some fields are
|
496
|
-
even more special: <strong>child</strong> fields. These form the
|
497
|
-
tree structure, and always have a <tt>Node</tt> or <tt>nil</tt>
|
498
|
-
value.
|
499
|
-
</p>
|
500
|
-
|
501
|
-
<p>
|
502
|
-
Why divulge these bizarre internal secrets? Because these
|
503
|
-
<tt>Node</tt> methods are defined in terms of fields and children:
|
504
|
-
</p>
|
505
|
-
<ul>
|
506
|
-
<li>
|
507
|
-
<tt>#==</tt>, <tt>#eql?</tt> -- Equality is checked recursively.
|
508
|
-
That is, all fields (including children) must be equal.
|
509
|
-
</li>
|
510
|
-
<li>
|
511
|
-
<tt>#dup</tt>, <tt>#clone</tt> -- Children are copied recursively
|
512
|
-
(other fields and attrs as normal).
|
513
|
-
</li>
|
514
|
-
</ul>
|
515
|
-
|
516
|
-
<p>
|
517
|
-
Then there's the tree-twiddling methods, which only ever
|
518
|
-
yield/return/affect (non-nil) children.
|
519
|
-
</p>
|
520
|
-
<ul>
|
521
|
-
<li>
|
522
|
-
<tt>#next, #prev </tt> -- return the next/prev sibling.
|
523
|
-
</li>
|
524
|
-
<li>
|
525
|
-
<tt>#list_next</tt>, <tt>#list_prev </tt> -- like
|
526
|
-
<tt>#next</tt>/<tt>#prev</tt>, but also requires the parent to be
|
527
|
-
<tt>NodeList</tt>. I'll be honest; I don't remember why I added
|
528
|
-
these methods. They may well suddenly disappear.
|
529
|
-
</li>
|
530
|
-
<li>
|
531
|
-
<tt>#each</tt>, <tt>#reverse_each</tt> -- Yield all (non-nil)
|
532
|
-
children. Node includes <tt>Enumerable</tt>, so you get the free
|
533
|
-
chocolates too.
|
534
|
-
</li>
|
535
|
-
<li>
|
536
|
-
<tt>#depth_first</tt>, <tt>#reverse_depth_first </tt> -- Walk the
|
537
|
-
tree in that order, yielding two args (<tt>event, node</tt>) at
|
538
|
-
each node. <tt>event</tt> is <tt>:down</tt> on the way down,
|
539
|
-
<tt>:up</tt> on the way up. If the block <tt>throw</tt>s
|
540
|
-
<tt>:prune</tt>, it won't descend any further.
|
541
|
-
</li>
|
542
|
-
<li>
|
543
|
-
<tt>#preorder</tt>, <tt>#reverse_preorder</tt>,
|
544
|
-
<tt>#postorder</tt>, <tt>#reverse_postorder</tt> -- Walk the tree
|
545
|
-
depth first, yielding nodes in the given order. For the
|
546
|
-
preorders, if the block throws <tt>:prune</tt>, it won't descend
|
547
|
-
any further.
|
548
|
-
</li>
|
549
|
-
<li>
|
550
|
-
<tt>#node_after(child)</tt>, <tt>#node_before(child) </tt> --
|
551
|
-
return the node before/after <tt>child</tt> (same as
|
552
|
-
<tt>child.next</tt>).
|
553
|
-
</li>
|
554
|
-
<li>
|
555
|
-
<tt>#remove_node(child)</tt> -- remove <tt>child</tt> from this
|
556
|
-
node (same as <tt>child.detach</tt>).
|
557
|
-
</li>
|
558
|
-
<li>
|
559
|
-
<tt>#replace_node(child, new_child) </tt> -- replace
|
560
|
-
<tt>child</tt> with yeah you guessed it (same as
|
561
|
-
<tt>child.replace_with(newchild)</tt>).
|
562
|
-
</li>
|
563
|
-
</ul>
|
564
|
-
|
565
|
-
<p>
|
566
|
-
If you're walking the tree looking for nodes to move around, don't
|
567
|
-
forget that modifying the tree during traversal is a criminal
|
568
|
-
offence.
|
569
|
-
</p>
|
570
|
-
|
571
|
-
<p>
|
572
|
-
And now, the episode you've been waiting for: THE FIELD LIST! (Cue
|
573
|
-
music and dim lights.)
|
574
|
-
</p>
|
575
|
-
|
576
|
-
<p>Notes about the table:
|
577
|
-
<ul>
|
578
|
-
<li>
|
579
|
-
If no default is listed, it is <tt>false</tt> if the field name
|
580
|
-
ends in a '?', <tt>nil</tt> otherwise.
|
581
|
-
</li>
|
582
|
-
<li>
|
583
|
-
<tt>nil</tt> is <b>always</b> allowed for a child field.
|
584
|
-
</li>
|
585
|
-
<li>
|
586
|
-
There are some conventions we follow religiously to help you:
|
587
|
-
<ul>
|
588
|
-
<li>
|
589
|
-
Field names that end in '?' are <b>always</b> true-or-false.
|
590
|
-
</li>
|
591
|
-
<li>
|
592
|
-
<tt>NodeList</tt>-valued fields <b>always</b> default to an
|
593
|
-
empty <tt>NodeArray</tt> or <tt>NodeChain</tt>, so you can
|
594
|
-
tack things on there with <tt><<</tt>, without worrying
|
595
|
-
about needing to create the list first.
|
596
|
-
</li>
|
597
|
-
<li>
|
598
|
-
A field is <tt>Node</tt>-valued <b>if and only if</b> it is
|
599
|
-
a child field.
|
600
|
-
</li>
|
601
|
-
<li>
|
602
|
-
The rows go yellow, green, yellow, green, ... .
|
603
|
-
</li>
|
604
|
-
</ul>
|
605
|
-
</li>
|
606
|
-
</ul>
|
607
|
-
</p>
|
608
|
-
|
609
|
-
<table class="node_desc">
|
610
|
-
<thead><tr>
|
611
|
-
</tr></thead>
|
612
|
-
|
613
|
-
<thead><tr class="node_desc_header">
|
614
|
-
<td align="center">Class</td>
|
615
|
-
<td align="center">Field</td>
|
616
|
-
<td align="center">Child?</td>
|
617
|
-
<td align="center">Type or possible values</td>
|
618
|
-
<td align="center">Default</td>
|
619
|
-
<td align="center">Comments</td>
|
620
|
-
</tr></thead>
|
621
|
-
|
622
|
-
<tbody>
|
623
|
-
<tr class="node_desc_evenrow">
|
624
|
-
<td class="nd_class" rowspan="1"><tt>TranslationUnit</tt></td>
|
625
|
-
<td class="nd_field"><tt>entities</tt></td>
|
626
|
-
<td class="nd_child">Y</td>
|
627
|
-
<td class="nd_values"><tt>NodeList</tt></td>
|
628
|
-
<td class="nd_default"><tt>NodeChain[]</tt></td>
|
629
|
-
<td class="nd_comments" rowspan="1">
|
630
|
-
He lives at the root of a parsed file.
|
631
|
-
</td>
|
632
|
-
</tr>
|
633
|
-
|
634
|
-
<tr class="node_desc_oddrow">
|
635
|
-
<td class="nd_class" rowspan="4"><tt>Declaration</tt></td>
|
636
|
-
<td class="nd_field"><tt>storage</tt></td>
|
637
|
-
<td class="nd_child"></td>
|
638
|
-
<td class="nd_values"><tt>:typedef</tt>, <tt>:extern</tt>, <tt>:static</tt>, <tt>:auto</tt>, <tt>:register</tt></td>
|
639
|
-
<td class="nd_default"></td>
|
640
|
-
<td class="nd_comments" rowspan="4">
|
641
|
-
There are also methods to query the storage more humanely:
|
642
|
-
<ul>
|
643
|
-
<li><tt>#typedef? </tt> -- true iff <tt>storage == :typedef </tt></li>
|
644
|
-
<li><tt>#extern? </tt> -- true iff <tt>storage == :extern </tt></li>
|
645
|
-
<li><tt>#static? </tt> -- true iff <tt>storage == :static </tt></li>
|
646
|
-
<li><tt>#auto? </tt> -- true iff <tt>storage == :auto </tt></li>
|
647
|
-
<li><tt>#register?</tt> -- true iff <tt>storage == :register</tt></li>
|
648
|
-
</ul>
|
649
|
-
</td>
|
650
|
-
</tr>
|
651
|
-
<tr class="node_desc_oddrow">
|
652
|
-
<td class="nd_field"><tt>type</tt></td>
|
653
|
-
<td class="nd_child">Y</td>
|
654
|
-
<td class="nd_values"><tt>DirectType</tt></td>
|
655
|
-
<td class="nd_default"></td>
|
656
|
-
</tr>
|
657
|
-
<tr class="node_desc_oddrow">
|
658
|
-
<td class="nd_field"><tt>declarators</tt></td>
|
659
|
-
<td class="nd_child">Y</td>
|
660
|
-
<td class="nd_values"><tt>NodeList</tt></td>
|
661
|
-
<td class="nd_default"><tt>NodeArray[]</tt></td>
|
662
|
-
</tr>
|
663
|
-
<tr class="node_desc_oddrow">
|
664
|
-
<td class="nd_field"><tt>inline?</tt></td>
|
665
|
-
<td class="nd_child"></td>
|
666
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
667
|
-
<td class="nd_default"></td>
|
668
|
-
</tr>
|
669
|
-
|
670
|
-
<tr class="node_desc_evenrow">
|
671
|
-
<td class="nd_class" rowspan="4"><tt>Declarator</tt></td>
|
672
|
-
<td class="nd_field"><tt>indirect_type</tt></td>
|
673
|
-
<td class="nd_child">Y</td>
|
674
|
-
<td class="nd_values"><tt>IndirectType</tt></td>
|
675
|
-
<td class="nd_default"></td>
|
676
|
-
<td class="nd_comments" rowspan="4">
|
677
|
-
What on earth is a "declarator", you ask? Consider "<tt>int i,
|
678
|
-
*ip;</tt>". This is a <tt>Declaration</tt> with two
|
679
|
-
<tt>Declarator</tt>s:
|
680
|
-
<pre>
|
681
|
-
Declaration
|
682
|
-
type: Int
|
683
|
-
declarators:
|
684
|
-
- Declarator
|
685
|
-
name: "i"
|
686
|
-
- Declarator
|
687
|
-
indirect_type: Pointer
|
688
|
-
name: "ip"
|
689
|
-
</pre>
|
690
|
-
The <tt>indirect_type</tt> of the <tt>ip</tt>
|
691
|
-
<tt>Declarator</tt> is a <tt>Pointer</tt> to <tt>nil</tt>.
|
692
|
-
"'Pointer to nil' my foot -- I want the type of the stupid
|
693
|
-
variable!" Here:
|
694
|
-
<ul>
|
695
|
-
<li>
|
696
|
-
<tt>#type</tt> -- return the type, the whole type, and
|
697
|
-
nothing but the type. This is a clone; modifying it won't
|
698
|
-
modify the tree.
|
699
|
-
</li>
|
700
|
-
</ul>
|
701
|
-
So calling <tt>#type</tt> on the <tt>ip</tt> <tt>Declarator</tt>
|
702
|
-
gives:
|
703
|
-
<pre>
|
704
|
-
Pointer
|
705
|
-
type: Int
|
706
|
-
</pre>
|
707
|
-
</td>
|
708
|
-
</tr>
|
709
|
-
<tr class="node_desc_evenrow">
|
710
|
-
<td class="nd_field"><tt>name</tt></td>
|
711
|
-
<td class="nd_child"></td>
|
712
|
-
<td class="nd_values"><tt>String</tt></td>
|
713
|
-
<td class="nd_default"></td>
|
714
|
-
</tr>
|
715
|
-
<tr class="node_desc_evenrow">
|
716
|
-
<td class="nd_field"><tt>init</tt></td>
|
717
|
-
<td class="nd_child">Y</td>
|
718
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
719
|
-
<td class="nd_default"></td>
|
720
|
-
</tr>
|
721
|
-
<tr class="node_desc_evenrow">
|
722
|
-
<td class="nd_field"><tt>num_bits</tt></td>
|
723
|
-
<td class="nd_child">Y</td>
|
724
|
-
<td class="nd_values"><tt>Integer</tt></td>
|
725
|
-
<td class="nd_default"></td>
|
726
|
-
</tr>
|
727
|
-
|
728
|
-
<tr class="node_desc_oddrow">
|
729
|
-
<td class="nd_class" rowspan="6"><tt>FunctionDef</tt></td>
|
730
|
-
<td class="nd_field"><tt>storage</tt></td>
|
731
|
-
<td class="nd_child"></td>
|
732
|
-
<td class="nd_values"><tt>:extern</tt>, <tt>:static</tt></td>
|
733
|
-
<td class="nd_default"></td>
|
734
|
-
<td class="nd_comments" rowspan="6">
|
735
|
-
Just like <tt>Declaration</tt>, there's also:
|
736
|
-
<ul>
|
737
|
-
<li><tt>#extern?</tt> -- return true iff <tt>storage == :extern</tt></li>
|
738
|
-
<li><tt>#static?</tt> -- return true iff <tt>storage == :static</tt></li>
|
739
|
-
</ul>
|
740
|
-
There's also a pseudo-field:
|
741
|
-
<ul>
|
742
|
-
<li><tt>#prototype?</tt> -- same as !no_prototype?</li>
|
743
|
-
<li><tt>#prototype=(val)</tt> -- same as no_prototype = !val</li>
|
744
|
-
</ul>
|
745
|
-
<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:
|
746
|
-
<table cellpadding="5" width="100%">
|
747
|
-
<tr><td>
|
748
|
-
<pre>
|
749
|
-
int main(argc, argv)
|
750
|
-
int argc;
|
751
|
-
char **argv;
|
752
|
-
{
|
753
|
-
return 0;
|
754
|
-
}
|
755
|
-
</pre>
|
756
|
-
</td><td>
|
757
|
-
<pre>
|
758
|
-
int main(int argc, char **argv) {
|
759
|
-
return 0;
|
760
|
-
}
|
761
|
-
</pre>
|
762
|
-
</td></tr><tr><td>
|
763
|
-
<b>No prototype.</b>
|
764
|
-
</td><td>
|
765
|
-
<b>Prototype.</b>
|
766
|
-
</td></tr>
|
767
|
-
</table>
|
768
|
-
Everyone tells you to use prototypes. That's because no type
|
769
|
-
checking is done when calling a function declared without a
|
770
|
-
prototype.
|
771
|
-
</pre>
|
772
|
-
</td>
|
773
|
-
</tr>
|
774
|
-
<tr class="node_desc_oddrow">
|
775
|
-
<td class="nd_field"><tt>inline?</tt></td>
|
776
|
-
<td class="nd_child"></td>
|
777
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
778
|
-
<td class="nd_default"></td>
|
779
|
-
</tr>
|
780
|
-
<tr class="node_desc_oddrow">
|
781
|
-
<td class="nd_field"><tt>type</tt></td>
|
782
|
-
<td class="nd_child">Y</td>
|
783
|
-
<td class="nd_values"><tt>Type</tt></td>
|
784
|
-
<td class="nd_default"></td>
|
785
|
-
</tr>
|
786
|
-
<tr class="node_desc_oddrow">
|
787
|
-
<td class="nd_field"><tt>name</tt></td>
|
788
|
-
<td class="nd_child"></td>
|
789
|
-
<td class="nd_values"><tt>String</tt></td>
|
790
|
-
<td class="nd_default"></td>
|
791
|
-
</tr>
|
792
|
-
<tr class="node_desc_oddrow">
|
793
|
-
<td class="nd_field"><tt>def</tt></td>
|
794
|
-
<td class="nd_child">Y</td>
|
795
|
-
<td class="nd_values"><tt>Block</tt></td>
|
796
|
-
<td class="nd_default"><tt>Block.new</tt></td>
|
797
|
-
</tr>
|
798
|
-
<tr class="node_desc_oddrow">
|
799
|
-
<td class="nd_field"><tt>no_prototype?</tt></td>
|
800
|
-
<td class="nd_child"></td>
|
801
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
802
|
-
<td class="nd_default"></td>
|
803
|
-
</tr>
|
804
|
-
|
805
|
-
<tr class="node_desc_evenrow">
|
806
|
-
<td class="nd_class" rowspan="3"><tt>Parameter</tt></td>
|
807
|
-
<td class="nd_field"><tt>register?</tt></td>
|
808
|
-
<td class="nd_child"></td>
|
809
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
810
|
-
<td class="nd_default"></td>
|
811
|
-
<td class="nd_comments" rowspan="3">
|
812
|
-
Used in <tt>Function</tt>s.
|
813
|
-
</td>
|
814
|
-
</tr>
|
815
|
-
<tr class="node_desc_evenrow">
|
816
|
-
<td class="nd_field"><tt>type</tt></td>
|
817
|
-
<td class="nd_child">Y</td>
|
818
|
-
<td class="nd_values"><tt>Type</tt></td>
|
819
|
-
<td class="nd_default"></td>
|
820
|
-
</tr>
|
821
|
-
<tr class="node_desc_evenrow">
|
822
|
-
<td class="nd_field"><tt>name</tt></td>
|
823
|
-
<td class="nd_child"></td>
|
824
|
-
<td class="nd_values"><tt>String</tt></td>
|
825
|
-
<td class="nd_default"></td>
|
826
|
-
</tr>
|
827
|
-
|
828
|
-
<tr class="node_desc_oddrow">
|
829
|
-
<td class="nd_class" rowspan="2"><tt>Enumerator</tt></td>
|
830
|
-
<td class="nd_field"><tt>name</tt></td>
|
831
|
-
<td class="nd_child"></td>
|
832
|
-
<td class="nd_values"><tt>String</tt></td>
|
833
|
-
<td class="nd_default"></td>
|
834
|
-
<td class="nd_comments" rowspan="2">
|
835
|
-
Used in <tt>Enum</tt>s.
|
836
|
-
</td>
|
837
|
-
</tr>
|
838
|
-
<tr class="node_desc_oddrow">
|
839
|
-
<td class="nd_field"><tt>val</tt></td>
|
840
|
-
<td class="nd_child">Y</td>
|
841
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
842
|
-
<td class="nd_default"></td>
|
843
|
-
</tr>
|
844
|
-
|
845
|
-
<tr class="node_desc_evenrow">
|
846
|
-
<td class="nd_class" rowspan="2"><tt>MemberInit</tt></td>
|
847
|
-
<td class="nd_field"><tt>member</tt></td>
|
848
|
-
<td class="nd_child">Y</td>
|
849
|
-
<td class="nd_values"><tt>NodeList</tt> of <tt>Member</tt>-or-<tt>Expression</tt></td>
|
850
|
-
<td class="nd_default"></td>
|
851
|
-
<td class="nd_comments" rowspan="2">
|
852
|
-
Used in <tt>CompoundLiteral</tt>s.
|
853
|
-
</td>
|
854
|
-
</tr>
|
855
|
-
<tr class="node_desc_evenrow">
|
856
|
-
<td class="nd_field"><tt>init</tt></td>
|
857
|
-
<td class="nd_child">Y</td>
|
858
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
859
|
-
<td class="nd_default"></td>
|
860
|
-
</tr>
|
861
|
-
|
862
|
-
<tr class="node_desc_oddrow">
|
863
|
-
<td class="nd_class" rowspan="1"><tt>Member</tt></td>
|
864
|
-
<td class="nd_field"><tt>name</tt></td>
|
865
|
-
<td class="nd_child"></td>
|
866
|
-
<td class="nd_values"><tt>String</tt></td>
|
867
|
-
<td class="nd_default"></td>
|
868
|
-
<td class="nd_comments" rowspan="1">
|
869
|
-
Used in <tt>MemberInit</tt>s.
|
870
|
-
</td>
|
871
|
-
</tr>
|
872
|
-
|
873
|
-
<tr class="node_desc_evenrow">
|
874
|
-
<td class="nd_class" rowspan="2"><tt>Block</tt></td>
|
875
|
-
<td class="nd_field"><tt>labels</tt></td>
|
876
|
-
<td class="nd_child">Y</td>
|
877
|
-
<td class="nd_values"><tt>NodeList</tt> of <tt>Label</tt></td>
|
878
|
-
<td class="nd_default"><tt>NodeArray[]</tt></td>
|
879
|
-
<td class="nd_comments" rowspan="2">
|
880
|
-
</td>
|
881
|
-
</tr>
|
882
|
-
<tr class="node_desc_evenrow">
|
883
|
-
<td class="nd_field"><tt>stmts</tt></td>
|
884
|
-
<td class="nd_child">Y</td>
|
885
|
-
<td class="nd_values"><tt>NodeList</tt> of <tt>Statement</tt></td>
|
886
|
-
<td class="nd_default"><tt>NodeArray[]</tt></td>
|
887
|
-
</tr>
|
888
|
-
|
889
|
-
<tr class="node_desc_oddrow">
|
890
|
-
<td class="nd_class" rowspan="4"><tt>If</tt></td>
|
891
|
-
<td class="nd_field"><tt>labels</tt></td>
|
892
|
-
<td class="nd_child">Y</td>
|
893
|
-
<td class="nd_values"><tt>NodeList</tt> of <tt>Label</tt></td>
|
894
|
-
<td class="nd_default"><tt>NodeArray[]</tt></td>
|
895
|
-
<td class="nd_comments" rowspan="4">
|
896
|
-
</td>
|
897
|
-
</tr>
|
898
|
-
<tr class="node_desc_oddrow">
|
899
|
-
<td class="nd_field"><tt>cond</tt></td>
|
900
|
-
<td class="nd_child">Y</td>
|
901
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
902
|
-
<td class="nd_default"></td>
|
903
|
-
</tr>
|
904
|
-
<tr class="node_desc_oddrow">
|
905
|
-
<td class="nd_field"><tt>then</tt></td>
|
906
|
-
<td class="nd_child">Y</td>
|
907
|
-
<td class="nd_values"><tt>Statement</tt></td>
|
908
|
-
<td class="nd_default"></td>
|
909
|
-
</tr>
|
910
|
-
<tr class="node_desc_oddrow">
|
911
|
-
<td class="nd_field"><tt>else</tt></td>
|
912
|
-
<td class="nd_child">Y</td>
|
913
|
-
<td class="nd_values"><tt>Statement</tt></td>
|
914
|
-
<td class="nd_default"></td>
|
915
|
-
</tr>
|
916
|
-
|
917
|
-
<tr class="node_desc_evenrow">
|
918
|
-
<td class="nd_class" rowspan="3"><tt>Switch</tt></td>
|
919
|
-
<td class="nd_field"><tt>labels</tt></td>
|
920
|
-
<td class="nd_child">Y</td>
|
921
|
-
<td class="nd_values"><tt>NodeList</tt> of <tt>Label</tt></td>
|
922
|
-
<td class="nd_default"><tt>NodeArray[]</tt></td>
|
923
|
-
<td class="nd_comments" rowspan="3">
|
924
|
-
</td>
|
925
|
-
</tr>
|
926
|
-
<tr class="node_desc_evenrow">
|
927
|
-
<td class="nd_field"><tt>cond</tt></td>
|
928
|
-
<td class="nd_child">Y</td>
|
929
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
930
|
-
<td class="nd_default"></td>
|
931
|
-
</tr>
|
932
|
-
<tr class="node_desc_evenrow">
|
933
|
-
<td class="nd_field"><tt>stmt</tt></td>
|
934
|
-
<td class="nd_child">Y</td>
|
935
|
-
<td class="nd_values"><tt>Statement</tt></td>
|
936
|
-
<td class="nd_default"></td>
|
937
|
-
</tr>
|
938
|
-
|
939
|
-
<tr class="node_desc_oddrow">
|
940
|
-
<td class="nd_class" rowspan="4"><tt>While</tt></td>
|
941
|
-
<td class="nd_field"><tt>labels</tt></td>
|
942
|
-
<td class="nd_child">Y</td>
|
943
|
-
<td class="nd_values"><tt>NodeList</tt> of <tt>Label</tt></td>
|
944
|
-
<td class="nd_default"><tt>NodeArray[]</tt></td>
|
945
|
-
<td class="nd_comments" rowspan="4">
|
946
|
-
<tt>do?</tt> means it's a do-while loop.
|
947
|
-
</td>
|
948
|
-
</tr>
|
949
|
-
<tr class="node_desc_oddrow">
|
950
|
-
<td class="nd_field"><tt>do?</tt></td>
|
951
|
-
<td class="nd_child"></td>
|
952
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
953
|
-
<td class="nd_default"></td>
|
954
|
-
</tr>
|
955
|
-
<tr class="node_desc_oddrow">
|
956
|
-
<td class="nd_field"><tt>cond</tt></td>
|
957
|
-
<td class="nd_child">Y</td>
|
958
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
959
|
-
<td class="nd_default"></td>
|
960
|
-
</tr>
|
961
|
-
<tr class="node_desc_oddrow">
|
962
|
-
<td class="nd_field"><tt>stmt</tt></td>
|
963
|
-
<td class="nd_child">Y</td>
|
964
|
-
<td class="nd_values"><tt>Statement</tt></td>
|
965
|
-
<td class="nd_default"></td>
|
966
|
-
</tr>
|
967
|
-
|
968
|
-
<tr class="node_desc_evenrow">
|
969
|
-
<td class="nd_class" rowspan="5"><tt>For</tt></td>
|
970
|
-
<td class="nd_field"><tt>labels</tt></td>
|
971
|
-
<td class="nd_child">Y</td>
|
972
|
-
<td class="nd_values"><tt>NodeList</tt> of <tt>Label</tt></td>
|
973
|
-
<td class="nd_default"><tt>NodeArray[]</tt></td>
|
974
|
-
<td class="nd_comments" rowspan="5">
|
975
|
-
</td>
|
976
|
-
</tr>
|
977
|
-
<tr class="node_desc_evenrow">
|
978
|
-
<td class="nd_field"><tt>init</tt></td>
|
979
|
-
<td class="nd_child">Y</td>
|
980
|
-
<td class="nd_values"><tt>Expression</tt> or <tt>Declaration</tt></td>
|
981
|
-
<td class="nd_default"></td>
|
982
|
-
</tr>
|
983
|
-
<tr class="node_desc_evenrow">
|
984
|
-
<td class="nd_field"><tt>cond</tt></td>
|
985
|
-
<td class="nd_child">Y</td>
|
986
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
987
|
-
<td class="nd_default"></td>
|
988
|
-
</tr>
|
989
|
-
<tr class="node_desc_evenrow">
|
990
|
-
<td class="nd_field"><tt>iter</tt></td>
|
991
|
-
<td class="nd_child">Y</td>
|
992
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
993
|
-
<td class="nd_default"></td>
|
994
|
-
</tr>
|
995
|
-
<tr class="node_desc_evenrow">
|
996
|
-
<td class="nd_field"><tt>stmt</tt></td>
|
997
|
-
<td class="nd_child">Y</td>
|
998
|
-
<td class="nd_values"><tt>Statement</tt></td>
|
999
|
-
<td class="nd_default"></td>
|
1000
|
-
</tr>
|
1001
|
-
|
1002
|
-
<tr class="node_desc_oddrow">
|
1003
|
-
<td class="nd_class" rowspan="2"><tt>Goto</tt></td>
|
1004
|
-
<td class="nd_field"><tt>labels</tt></td>
|
1005
|
-
<td class="nd_child">Y</td>
|
1006
|
-
<td class="nd_values"><tt>NodeList</tt> of <tt>Label</tt></td>
|
1007
|
-
<td class="nd_default"><tt>NodeArray[]</tt></td>
|
1008
|
-
<td class="nd_comments" rowspan="2">
|
1009
|
-
</td>
|
1010
|
-
</tr>
|
1011
|
-
<tr class="node_desc_oddrow">
|
1012
|
-
<td class="nd_field"><tt>target</tt></td>
|
1013
|
-
<td class="nd_child"></td>
|
1014
|
-
<td class="nd_values"><tt>String</tt></td>
|
1015
|
-
<td class="nd_default"></td>
|
1016
|
-
</tr>
|
1017
|
-
|
1018
|
-
<tr class="node_desc_evenrow">
|
1019
|
-
<td class="nd_class" rowspan="1"><tt>Continue</tt></td>
|
1020
|
-
<td class="nd_field"><tt>labels</tt></td>
|
1021
|
-
<td class="nd_child">Y</td>
|
1022
|
-
<td class="nd_values"><tt>NodeList</tt> of <tt>Label</tt></td>
|
1023
|
-
<td class="nd_default"><tt>NodeArray[]</tt></td>
|
1024
|
-
<td class="nd_comments" rowspan="1">
|
1025
|
-
</td>
|
1026
|
-
</tr>
|
1027
|
-
|
1028
|
-
<tr class="node_desc_oddrow">
|
1029
|
-
<td class="nd_class" rowspan="1"><tt>Break</tt></td>
|
1030
|
-
<td class="nd_field"><tt>labels</tt></td>
|
1031
|
-
<td class="nd_child">Y</td>
|
1032
|
-
<td class="nd_values"><tt>NodeList</tt> of <tt>Label</tt></td>
|
1033
|
-
<td class="nd_default"><tt>NodeArray[]</tt></td>
|
1034
|
-
<td class="nd_comments" rowspan="1">
|
1035
|
-
</td>
|
1036
|
-
</tr>
|
1037
|
-
|
1038
|
-
<tr class="node_desc_evenrow">
|
1039
|
-
<td class="nd_class" rowspan="2"><tt>Return</tt></td>
|
1040
|
-
<td class="nd_field"><tt>labels</tt></td>
|
1041
|
-
<td class="nd_child">Y</td>
|
1042
|
-
<td class="nd_values"><tt>NodeList</tt> of <tt>Label</tt></td>
|
1043
|
-
<td class="nd_default"><tt>NodeArray[]</tt></td>
|
1044
|
-
<td class="nd_comments" rowspan="2">
|
1045
|
-
</td>
|
1046
|
-
</tr>
|
1047
|
-
<tr class="node_desc_evenrow">
|
1048
|
-
<td class="nd_field"><tt>expr</tt></td>
|
1049
|
-
<td class="nd_child">Y</td>
|
1050
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1051
|
-
<td class="nd_default"></td>
|
1052
|
-
</tr>
|
1053
|
-
|
1054
|
-
<tr class="node_desc_oddrow">
|
1055
|
-
<td class="nd_class" rowspan="2"><tt>ExpressionStatement</tt></td>
|
1056
|
-
<td class="nd_field"><tt>labels</tt></td>
|
1057
|
-
<td class="nd_child">Y</td>
|
1058
|
-
<td class="nd_values"><tt>NodeList</tt> of <tt>Label</tt></td>
|
1059
|
-
<td class="nd_default"><tt>NodeArray[]</tt></td>
|
1060
|
-
<td class="nd_comments" rowspan="2">
|
1061
|
-
</td>
|
1062
|
-
</tr>
|
1063
|
-
<tr class="node_desc_oddrow">
|
1064
|
-
<td class="nd_field"><tt>expr</tt></td>
|
1065
|
-
<td class="nd_child">Y</td>
|
1066
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1067
|
-
<td class="nd_default"></td>
|
1068
|
-
</tr>
|
1069
|
-
|
1070
|
-
<tr class="node_desc_evenrow">
|
1071
|
-
<td class="nd_class" rowspan="1"><tt>PlainLabel</tt></td>
|
1072
|
-
<td class="nd_field"><tt>name</tt></td>
|
1073
|
-
<td class="nd_child"></td>
|
1074
|
-
<td class="nd_values"><tt>String</tt></td>
|
1075
|
-
<td class="nd_default"></td>
|
1076
|
-
<td class="nd_comments" rowspan="1">
|
1077
|
-
</td>
|
1078
|
-
</tr>
|
1079
|
-
|
1080
|
-
<tr class="node_desc_oddrow">
|
1081
|
-
<td class="nd_class" rowspan="1"><tt>Default</tt></td>
|
1082
|
-
<td class="nd_field"></td>
|
1083
|
-
<td class="nd_child"></td>
|
1084
|
-
<td class="nd_values"></td>
|
1085
|
-
<td class="nd_default"></td>
|
1086
|
-
<td class="nd_comments" rowspan="1">
|
1087
|
-
</td>
|
1088
|
-
</tr>
|
1089
|
-
|
1090
|
-
<tr class="node_desc_evenrow">
|
1091
|
-
<td class="nd_class" rowspan="1"><tt>Case</tt></td>
|
1092
|
-
<td class="nd_field"><tt>expr</tt></td>
|
1093
|
-
<td class="nd_child">Y</td>
|
1094
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1095
|
-
<td class="nd_default"></td>
|
1096
|
-
<td class="nd_comments" rowspan="1">
|
1097
|
-
</td>
|
1098
|
-
</tr>
|
1099
|
-
|
1100
|
-
<tr class="node_desc_oddrow">
|
1101
|
-
<td class="nd_class" rowspan="1"><tt>Comma</tt></td>
|
1102
|
-
<td class="nd_field"><tt>exprs</tt></td>
|
1103
|
-
<td class="nd_child">Y</td>
|
1104
|
-
<td class="nd_values"><tt>NodeList</tt> of <tt>Expression</tt></td>
|
1105
|
-
<td class="nd_default"></td>
|
1106
|
-
<td class="nd_comments" rowspan="1">
|
1107
|
-
</td>
|
1108
|
-
</tr>
|
1109
|
-
|
1110
|
-
<tr class="node_desc_evenrow">
|
1111
|
-
<td class="nd_class" rowspan="3"><tt>Conditional</tt></td>
|
1112
|
-
<td class="nd_field"><tt>cond</tt></td>
|
1113
|
-
<td class="nd_child">Y</td>
|
1114
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1115
|
-
<td class="nd_default"></td>
|
1116
|
-
<td class="nd_comments" rowspan="3">
|
1117
|
-
</td>
|
1118
|
-
</tr>
|
1119
|
-
<tr class="node_desc_evenrow">
|
1120
|
-
<td class="nd_field"><tt>then</tt></td>
|
1121
|
-
<td class="nd_child">Y</td>
|
1122
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1123
|
-
<td class="nd_default"></td>
|
1124
|
-
</tr>
|
1125
|
-
<tr class="node_desc_evenrow">
|
1126
|
-
<td class="nd_field"><tt>else</tt></td>
|
1127
|
-
<td class="nd_child">Y</td>
|
1128
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1129
|
-
<td class="nd_default"></td>
|
1130
|
-
</tr>
|
1131
|
-
|
1132
|
-
<tr class="node_desc_oddrow">
|
1133
|
-
<td class="nd_class" rowspan="1"><tt>Variable</tt></td>
|
1134
|
-
<td class="nd_field"><tt>name</tt></td>
|
1135
|
-
<td class="nd_child"></td>
|
1136
|
-
<td class="nd_values"><tt>String</tt></td>
|
1137
|
-
<td class="nd_default"></td>
|
1138
|
-
<td class="nd_comments" rowspan="1">
|
1139
|
-
</td>
|
1140
|
-
</tr>
|
1141
|
-
|
1142
|
-
<tr class="node_desc_evenrow">
|
1143
|
-
<td class="nd_class" rowspan="2"><tt>Index</tt></td>
|
1144
|
-
<td class="nd_field"><tt>expr</tt></td>
|
1145
|
-
<td class="nd_child">Y</td>
|
1146
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1147
|
-
<td class="nd_default"></td>
|
1148
|
-
<td class="nd_comments" rowspan="2">
|
1149
|
-
</td>
|
1150
|
-
</tr>
|
1151
|
-
<tr class="node_desc_evenrow">
|
1152
|
-
<td class="nd_field"><tt>index</tt></td>
|
1153
|
-
<td class="nd_child">Y</td>
|
1154
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1155
|
-
<td class="nd_default"></td>
|
1156
|
-
</tr>
|
1157
|
-
|
1158
|
-
<tr class="node_desc_oddrow">
|
1159
|
-
<td class="nd_class" rowspan="2"><tt>Call</tt></td>
|
1160
|
-
<td class="nd_field"><tt>expr</tt></td>
|
1161
|
-
<td class="nd_child">Y</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 class="node_desc_oddrow">
|
1168
|
-
<td class="nd_field"><tt>args</tt></td>
|
1169
|
-
<td class="nd_child">Y</td>
|
1170
|
-
<td class="nd_values"><tt>NodeList</tt> of <tt>Expression</tt>-or-<tt>Type</tt></td>
|
1171
|
-
<td class="nd_default"></td>
|
1172
|
-
</tr>
|
1173
|
-
|
1174
|
-
<tr class="node_desc_evenrow">
|
1175
|
-
<td class="nd_class" rowspan="2"><tt>Dot</tt></td>
|
1176
|
-
<td class="nd_field"><tt>expr</tt></td>
|
1177
|
-
<td class="nd_child">Y</td>
|
1178
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1179
|
-
<td class="nd_default"></td>
|
1180
|
-
<td class="nd_comments" rowspan="2">
|
1181
|
-
</td>
|
1182
|
-
</tr>
|
1183
|
-
<tr class="node_desc_evenrow">
|
1184
|
-
<td class="nd_field"><tt>member</tt></td>
|
1185
|
-
<td class="nd_child">Y</td>
|
1186
|
-
<td class="nd_values"><tt>String</tt></td>
|
1187
|
-
<td class="nd_default"></td>
|
1188
|
-
</tr>
|
1189
|
-
|
1190
|
-
<tr class="node_desc_oddrow">
|
1191
|
-
<td class="nd_class" rowspan="2"><tt>Arrow</tt></td>
|
1192
|
-
<td class="nd_field"><tt>expr</tt></td>
|
1193
|
-
<td class="nd_child">Y</td>
|
1194
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1195
|
-
<td class="nd_default"></td>
|
1196
|
-
<td class="nd_comments" rowspan="2">
|
1197
|
-
</td>
|
1198
|
-
</tr>
|
1199
|
-
<tr class="node_desc_oddrow">
|
1200
|
-
<td class="nd_field"><tt>member</tt></td>
|
1201
|
-
<td class="nd_child">Y</td>
|
1202
|
-
<td class="nd_values"><tt>String</tt></td>
|
1203
|
-
<td class="nd_default"></td>
|
1204
|
-
</tr>
|
1205
|
-
|
1206
|
-
<tr class="node_desc_evenrow">
|
1207
|
-
<td class="nd_class" rowspan="1"><tt>PostInc</tt></td>
|
1208
|
-
<td class="nd_field"><tt>expr</tt></td>
|
1209
|
-
<td class="nd_child">Y</td>
|
1210
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1211
|
-
<td class="nd_default"></td>
|
1212
|
-
<td class="nd_comments" rowspan="1">
|
1213
|
-
</td>
|
1214
|
-
</tr>
|
1215
|
-
|
1216
|
-
<tr class="node_desc_oddrow">
|
1217
|
-
<td class="nd_class" rowspan="1"><tt>PostDec</tt></td>
|
1218
|
-
<td class="nd_field"><tt>expr</tt></td>
|
1219
|
-
<td class="nd_child">Y</td>
|
1220
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1221
|
-
<td class="nd_default"></td>
|
1222
|
-
<td class="nd_comments" rowspan="1">
|
1223
|
-
</td>
|
1224
|
-
</tr>
|
1225
|
-
|
1226
|
-
<tr class="node_desc_evenrow">
|
1227
|
-
<td class="nd_class" rowspan="2"><tt>Cast</tt></td>
|
1228
|
-
<td class="nd_field"><tt>type</tt></td>
|
1229
|
-
<td class="nd_child">Y</td>
|
1230
|
-
<td class="nd_values"><tt>Type</tt></td>
|
1231
|
-
<td class="nd_default"></td>
|
1232
|
-
<td class="nd_comments" rowspan="2">
|
1233
|
-
</td>
|
1234
|
-
</tr>
|
1235
|
-
<tr class="node_desc_evenrow">
|
1236
|
-
<td class="nd_field"><tt>expr</tt></td>
|
1237
|
-
<td class="nd_child">Y</td>
|
1238
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1239
|
-
<td class="nd_default"></td>
|
1240
|
-
</tr>
|
1241
|
-
|
1242
|
-
<tr class="node_desc_oddrow">
|
1243
|
-
<td class="nd_class" rowspan="1"><tt>Address</tt></td>
|
1244
|
-
<td class="nd_field"><tt>expr</tt></td>
|
1245
|
-
<td class="nd_child">Y</td>
|
1246
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1247
|
-
<td class="nd_default"></td>
|
1248
|
-
<td class="nd_comments" rowspan="1">
|
1249
|
-
</td>
|
1250
|
-
</tr>
|
1251
|
-
|
1252
|
-
<tr class="node_desc_evenrow">
|
1253
|
-
<td class="nd_class" rowspan="1"><tt>Dereference</tt></td>
|
1254
|
-
<td class="nd_field"><tt>expr</tt></td>
|
1255
|
-
<td class="nd_child">Y</td>
|
1256
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1257
|
-
<td class="nd_default"></td>
|
1258
|
-
<td class="nd_comments" rowspan="1">
|
1259
|
-
</td>
|
1260
|
-
</tr>
|
1261
|
-
|
1262
|
-
<tr class="node_desc_oddrow">
|
1263
|
-
<td class="nd_class" rowspan="1"><tt>Sizeof</tt></td>
|
1264
|
-
<td class="nd_field"><tt>expr</tt></td>
|
1265
|
-
<td class="nd_child">Y</td>
|
1266
|
-
<td class="nd_values"><tt>Type</tt> or <tt>Expression</tt></td>
|
1267
|
-
<td class="nd_default"></td>
|
1268
|
-
<td class="nd_comments" rowspan="1">
|
1269
|
-
</td>
|
1270
|
-
</tr>
|
1271
|
-
|
1272
|
-
<tr class="node_desc_evenrow">
|
1273
|
-
<td class="nd_class" rowspan="1"><tt>Positive</tt></td>
|
1274
|
-
<td class="nd_field"><tt>expr</tt></td>
|
1275
|
-
<td class="nd_child">Y</td>
|
1276
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1277
|
-
<td class="nd_default"></td>
|
1278
|
-
<td class="nd_comments" rowspan="1">
|
1279
|
-
</td>
|
1280
|
-
</tr>
|
1281
|
-
|
1282
|
-
<tr class="node_desc_oddrow">
|
1283
|
-
<td class="nd_class" rowspan="1"><tt>Negative</tt></td>
|
1284
|
-
<td class="nd_field"><tt>expr</tt></td>
|
1285
|
-
<td class="nd_child">Y</td>
|
1286
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1287
|
-
<td class="nd_default"></td>
|
1288
|
-
<td class="nd_comments" rowspan="1">
|
1289
|
-
</td>
|
1290
|
-
</tr>
|
1291
|
-
|
1292
|
-
<tr class="node_desc_evenrow">
|
1293
|
-
<td class="nd_class" rowspan="1"><tt>PreInc</tt></td>
|
1294
|
-
<td class="nd_field"><tt>expr</tt></td>
|
1295
|
-
<td class="nd_child">Y</td>
|
1296
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1297
|
-
<td class="nd_default"></td>
|
1298
|
-
<td class="nd_comments" rowspan="1">
|
1299
|
-
</td>
|
1300
|
-
</tr>
|
1301
|
-
|
1302
|
-
<tr class="node_desc_oddrow">
|
1303
|
-
<td class="nd_class" rowspan="1"><tt>PreDec</tt></td>
|
1304
|
-
<td class="nd_field"><tt>expr</tt></td>
|
1305
|
-
<td class="nd_child">Y</td>
|
1306
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1307
|
-
<td class="nd_default"></td>
|
1308
|
-
<td class="nd_comments" rowspan="1">
|
1309
|
-
</td>
|
1310
|
-
</tr>
|
1311
|
-
|
1312
|
-
<tr class="node_desc_evenrow">
|
1313
|
-
<td class="nd_class" rowspan="1"><tt>BitNot</tt></td>
|
1314
|
-
<td class="nd_field"><tt>expr</tt></td>
|
1315
|
-
<td class="nd_child">Y</td>
|
1316
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1317
|
-
<td class="nd_default"></td>
|
1318
|
-
<td class="nd_comments" rowspan="1">
|
1319
|
-
</td>
|
1320
|
-
</tr>
|
1321
|
-
|
1322
|
-
<tr class="node_desc_oddrow">
|
1323
|
-
<td class="nd_class" rowspan="1"><tt>Not</tt></td>
|
1324
|
-
<td class="nd_field"><tt>expr</tt></td>
|
1325
|
-
<td class="nd_child">Y</td>
|
1326
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1327
|
-
<td class="nd_default"></td>
|
1328
|
-
<td class="nd_comments" rowspan="1">
|
1329
|
-
</td>
|
1330
|
-
</tr>
|
1331
|
-
|
1332
|
-
<tr class="node_desc_evenrow">
|
1333
|
-
<td class="nd_class" rowspan="2"><tt>Add</tt></td>
|
1334
|
-
<td class="nd_field"><tt>expr1</tt></td>
|
1335
|
-
<td class="nd_child">Y</td>
|
1336
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1337
|
-
<td class="nd_default"></td>
|
1338
|
-
<td class="nd_comments" rowspan="2">
|
1339
|
-
</td>
|
1340
|
-
</tr>
|
1341
|
-
<tr class="node_desc_evenrow">
|
1342
|
-
<td class="nd_field"><tt>expr2</tt></td>
|
1343
|
-
<td class="nd_child">Y</td>
|
1344
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1345
|
-
<td class="nd_default"></td>
|
1346
|
-
</tr>
|
1347
|
-
|
1348
|
-
<tr class="node_desc_oddrow">
|
1349
|
-
<td class="nd_class" rowspan="2"><tt>Subtract</tt></td>
|
1350
|
-
<td class="nd_field"><tt>expr1</tt></td>
|
1351
|
-
<td class="nd_child">Y</td>
|
1352
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1353
|
-
<td class="nd_default"></td>
|
1354
|
-
<td class="nd_comments" rowspan="2">
|
1355
|
-
</td>
|
1356
|
-
</tr>
|
1357
|
-
<tr class="node_desc_oddrow">
|
1358
|
-
<td class="nd_field"><tt>expr2</tt></td>
|
1359
|
-
<td class="nd_child">Y</td>
|
1360
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1361
|
-
<td class="nd_default"></td>
|
1362
|
-
</tr>
|
1363
|
-
|
1364
|
-
<tr class="node_desc_evenrow">
|
1365
|
-
<td class="nd_class" rowspan="2"><tt>Multiply</tt></td>
|
1366
|
-
<td class="nd_field"><tt>expr1</tt></td>
|
1367
|
-
<td class="nd_child">Y</td>
|
1368
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1369
|
-
<td class="nd_default"></td>
|
1370
|
-
<td class="nd_comments" rowspan="2">
|
1371
|
-
</td>
|
1372
|
-
</tr>
|
1373
|
-
<tr class="node_desc_evenrow">
|
1374
|
-
<td class="nd_field"><tt>expr2</tt></td>
|
1375
|
-
<td class="nd_child">Y</td>
|
1376
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1377
|
-
<td class="nd_default"></td>
|
1378
|
-
</tr>
|
1379
|
-
|
1380
|
-
<tr class="node_desc_oddrow">
|
1381
|
-
<td class="nd_class" rowspan="2"><tt>Divide</tt></td>
|
1382
|
-
<td class="nd_field"><tt>expr1</tt></td>
|
1383
|
-
<td class="nd_child">Y</td>
|
1384
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1385
|
-
<td class="nd_default"></td>
|
1386
|
-
<td class="nd_comments" rowspan="2">
|
1387
|
-
</td>
|
1388
|
-
</tr>
|
1389
|
-
<tr class="node_desc_oddrow">
|
1390
|
-
<td class="nd_field"><tt>expr2</tt></td>
|
1391
|
-
<td class="nd_child">Y</td>
|
1392
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1393
|
-
<td class="nd_default"></td>
|
1394
|
-
</tr>
|
1395
|
-
|
1396
|
-
<tr class="node_desc_evenrow">
|
1397
|
-
<td class="nd_class" rowspan="2"><tt>Mod</tt></td>
|
1398
|
-
<td class="nd_field"><tt>expr1</tt></td>
|
1399
|
-
<td class="nd_child">Y</td>
|
1400
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1401
|
-
<td class="nd_default"></td>
|
1402
|
-
<td class="nd_comments" rowspan="2">
|
1403
|
-
</td>
|
1404
|
-
</tr>
|
1405
|
-
<tr class="node_desc_evenrow">
|
1406
|
-
<td class="nd_field"><tt>expr2</tt></td>
|
1407
|
-
<td class="nd_child">Y</td>
|
1408
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1409
|
-
<td class="nd_default"></td>
|
1410
|
-
</tr>
|
1411
|
-
|
1412
|
-
<tr class="node_desc_oddrow">
|
1413
|
-
<td class="nd_class" rowspan="2"><tt>Equal</tt></td>
|
1414
|
-
<td class="nd_field"><tt>expr1</tt></td>
|
1415
|
-
<td class="nd_child">Y</td>
|
1416
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1417
|
-
<td class="nd_default"></td>
|
1418
|
-
<td class="nd_comments" rowspan="2">
|
1419
|
-
</td>
|
1420
|
-
</tr>
|
1421
|
-
<tr class="node_desc_oddrow">
|
1422
|
-
<td class="nd_field"><tt>expr2</tt></td>
|
1423
|
-
<td class="nd_child">Y</td>
|
1424
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1425
|
-
<td class="nd_default"></td>
|
1426
|
-
</tr>
|
1427
|
-
|
1428
|
-
<tr class="node_desc_evenrow">
|
1429
|
-
<td class="nd_class" rowspan="2"><tt>NotEqual</tt></td>
|
1430
|
-
<td class="nd_field"><tt>expr1</tt></td>
|
1431
|
-
<td class="nd_child">Y</td>
|
1432
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1433
|
-
<td class="nd_default"></td>
|
1434
|
-
<td class="nd_comments" rowspan="2">
|
1435
|
-
</td>
|
1436
|
-
</tr>
|
1437
|
-
<tr class="node_desc_evenrow">
|
1438
|
-
<td class="nd_field"><tt>expr2</tt></td>
|
1439
|
-
<td class="nd_child">Y</td>
|
1440
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1441
|
-
<td class="nd_default"></td>
|
1442
|
-
</tr>
|
1443
|
-
|
1444
|
-
<tr class="node_desc_oddrow">
|
1445
|
-
<td class="nd_class" rowspan="2"><tt>Less</tt></td>
|
1446
|
-
<td class="nd_field"><tt>expr1</tt></td>
|
1447
|
-
<td class="nd_child">Y</td>
|
1448
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1449
|
-
<td class="nd_default"></td>
|
1450
|
-
<td class="nd_comments" rowspan="2">
|
1451
|
-
</td>
|
1452
|
-
</tr>
|
1453
|
-
<tr class="node_desc_oddrow">
|
1454
|
-
<td class="nd_field"><tt>expr2</tt></td>
|
1455
|
-
<td class="nd_child">Y</td>
|
1456
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1457
|
-
<td class="nd_default"></td>
|
1458
|
-
</tr>
|
1459
|
-
|
1460
|
-
<tr class="node_desc_evenrow">
|
1461
|
-
<td class="nd_class" rowspan="2"><tt>More</tt></td>
|
1462
|
-
<td class="nd_field"><tt>expr1</tt></td>
|
1463
|
-
<td class="nd_child">Y</td>
|
1464
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1465
|
-
<td class="nd_default"></td>
|
1466
|
-
<td class="nd_comments" rowspan="2">
|
1467
|
-
</td>
|
1468
|
-
</tr>
|
1469
|
-
<tr class="node_desc_evenrow">
|
1470
|
-
<td class="nd_field"><tt>expr2</tt></td>
|
1471
|
-
<td class="nd_child">Y</td>
|
1472
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1473
|
-
<td class="nd_default"></td>
|
1474
|
-
</tr>
|
1475
|
-
|
1476
|
-
<tr class="node_desc_oddrow">
|
1477
|
-
<td class="nd_class" rowspan="2"><tt>LessOrEqual</tt></td>
|
1478
|
-
<td class="nd_field"><tt>expr1</tt></td>
|
1479
|
-
<td class="nd_child">Y</td>
|
1480
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1481
|
-
<td class="nd_default"></td>
|
1482
|
-
<td class="nd_comments" rowspan="2">
|
1483
|
-
</td>
|
1484
|
-
</tr>
|
1485
|
-
<tr class="node_desc_oddrow">
|
1486
|
-
<td class="nd_field"><tt>expr2</tt></td>
|
1487
|
-
<td class="nd_child">Y</td>
|
1488
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1489
|
-
<td class="nd_default"></td>
|
1490
|
-
</tr>
|
1491
|
-
|
1492
|
-
<tr class="node_desc_evenrow">
|
1493
|
-
<td class="nd_class" rowspan="2"><tt>MoreOrEqual</tt></td>
|
1494
|
-
<td class="nd_field"><tt>expr1</tt></td>
|
1495
|
-
<td class="nd_child">Y</td>
|
1496
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1497
|
-
<td class="nd_default"></td>
|
1498
|
-
<td class="nd_comments" rowspan="2">
|
1499
|
-
</td>
|
1500
|
-
</tr>
|
1501
|
-
<tr class="node_desc_evenrow">
|
1502
|
-
<td class="nd_field"><tt>expr2</tt></td>
|
1503
|
-
<td class="nd_child">Y</td>
|
1504
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1505
|
-
<td class="nd_default"></td>
|
1506
|
-
</tr>
|
1507
|
-
|
1508
|
-
<tr class="node_desc_oddrow">
|
1509
|
-
<td class="nd_class" rowspan="2"><tt>BitAnd</tt></td>
|
1510
|
-
<td class="nd_field"><tt>expr1</tt></td>
|
1511
|
-
<td class="nd_child">Y</td>
|
1512
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1513
|
-
<td class="nd_default"></td>
|
1514
|
-
<td class="nd_comments" rowspan="2">
|
1515
|
-
</td>
|
1516
|
-
</tr>
|
1517
|
-
<tr class="node_desc_oddrow">
|
1518
|
-
<td class="nd_field"><tt>expr2</tt></td>
|
1519
|
-
<td class="nd_child">Y</td>
|
1520
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1521
|
-
<td class="nd_default"></td>
|
1522
|
-
</tr>
|
1523
|
-
|
1524
|
-
<tr class="node_desc_evenrow">
|
1525
|
-
<td class="nd_class" rowspan="2"><tt>BitOr</tt></td>
|
1526
|
-
<td class="nd_field"><tt>expr1</tt></td>
|
1527
|
-
<td class="nd_child">Y</td>
|
1528
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1529
|
-
<td class="nd_default"></td>
|
1530
|
-
<td class="nd_comments" rowspan="2">
|
1531
|
-
</td>
|
1532
|
-
</tr>
|
1533
|
-
<tr class="node_desc_evenrow">
|
1534
|
-
<td class="nd_field"><tt>expr2</tt></td>
|
1535
|
-
<td class="nd_child">Y</td>
|
1536
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1537
|
-
<td class="nd_default"></td>
|
1538
|
-
</tr>
|
1539
|
-
|
1540
|
-
<tr class="node_desc_oddrow">
|
1541
|
-
<td class="nd_class" rowspan="2"><tt>BitXor</tt></td>
|
1542
|
-
<td class="nd_field"><tt>expr1</tt></td>
|
1543
|
-
<td class="nd_child">Y</td>
|
1544
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1545
|
-
<td class="nd_default"></td>
|
1546
|
-
<td class="nd_comments" rowspan="2">
|
1547
|
-
</td>
|
1548
|
-
</tr>
|
1549
|
-
<tr class="node_desc_oddrow">
|
1550
|
-
<td class="nd_field"><tt>expr2</tt></td>
|
1551
|
-
<td class="nd_child">Y</td>
|
1552
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1553
|
-
<td class="nd_default"></td>
|
1554
|
-
</tr>
|
1555
|
-
|
1556
|
-
<tr class="node_desc_evenrow">
|
1557
|
-
<td class="nd_class" rowspan="2"><tt>ShiftLeft</tt></td>
|
1558
|
-
<td class="nd_field"><tt>expr1</tt></td>
|
1559
|
-
<td class="nd_child">Y</td>
|
1560
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1561
|
-
<td class="nd_default"></td>
|
1562
|
-
<td class="nd_comments" rowspan="2">
|
1563
|
-
</td>
|
1564
|
-
</tr>
|
1565
|
-
<tr class="node_desc_evenrow">
|
1566
|
-
<td class="nd_field"><tt>expr2</tt></td>
|
1567
|
-
<td class="nd_child">Y</td>
|
1568
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1569
|
-
<td class="nd_default"></td>
|
1570
|
-
</tr>
|
1571
|
-
|
1572
|
-
<tr class="node_desc_oddrow">
|
1573
|
-
<td class="nd_class" rowspan="2"><tt>ShiftRight</tt></td>
|
1574
|
-
<td class="nd_field"><tt>expr1</tt></td>
|
1575
|
-
<td class="nd_child">Y</td>
|
1576
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1577
|
-
<td class="nd_default"></td>
|
1578
|
-
<td class="nd_comments" rowspan="2">
|
1579
|
-
</td>
|
1580
|
-
</tr>
|
1581
|
-
<tr class="node_desc_oddrow">
|
1582
|
-
<td class="nd_field"><tt>expr2</tt></td>
|
1583
|
-
<td class="nd_child">Y</td>
|
1584
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1585
|
-
<td class="nd_default"></td>
|
1586
|
-
</tr>
|
1587
|
-
|
1588
|
-
<tr class="node_desc_evenrow">
|
1589
|
-
<td class="nd_class" rowspan="2"><tt>And</tt></td>
|
1590
|
-
<td class="nd_field"><tt>expr1</tt></td>
|
1591
|
-
<td class="nd_child">Y</td>
|
1592
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1593
|
-
<td class="nd_default"></td>
|
1594
|
-
<td class="nd_comments" rowspan="2">
|
1595
|
-
</td>
|
1596
|
-
</tr>
|
1597
|
-
<tr class="node_desc_evenrow">
|
1598
|
-
<td class="nd_field"><tt>expr2</tt></td>
|
1599
|
-
<td class="nd_child">Y</td>
|
1600
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1601
|
-
<td class="nd_default"></td>
|
1602
|
-
</tr>
|
1603
|
-
|
1604
|
-
<tr class="node_desc_oddrow">
|
1605
|
-
<td class="nd_class" rowspan="2"><tt>Or</tt></td>
|
1606
|
-
<td class="nd_field"><tt>expr1</tt></td>
|
1607
|
-
<td class="nd_child">Y</td>
|
1608
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1609
|
-
<td class="nd_default"></td>
|
1610
|
-
<td class="nd_comments" rowspan="2">
|
1611
|
-
</td>
|
1612
|
-
</tr>
|
1613
|
-
<tr class="node_desc_oddrow">
|
1614
|
-
<td class="nd_field"><tt>expr2</tt></td>
|
1615
|
-
<td class="nd_child">Y</td>
|
1616
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1617
|
-
<td class="nd_default"></td>
|
1618
|
-
</tr>
|
1619
|
-
|
1620
|
-
<tr class="node_desc_evenrow">
|
1621
|
-
<td class="nd_class" rowspan="2"><tt>Assign</tt></td>
|
1622
|
-
<td class="nd_field"><tt>lval</tt></td>
|
1623
|
-
<td class="nd_child">Y</td>
|
1624
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1625
|
-
<td class="nd_default"></td>
|
1626
|
-
<td class="nd_comments" rowspan="2">
|
1627
|
-
</td>
|
1628
|
-
</tr>
|
1629
|
-
<tr class="node_desc_evenrow">
|
1630
|
-
<td class="nd_field"><tt>rval</tt></td>
|
1631
|
-
<td class="nd_child">Y</td>
|
1632
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1633
|
-
<td class="nd_default"></td>
|
1634
|
-
</tr>
|
1635
|
-
|
1636
|
-
<tr class="node_desc_oddrow">
|
1637
|
-
<td class="nd_class" rowspan="2"><tt>MultiplyAssign</tt></td>
|
1638
|
-
<td class="nd_field"><tt>lval</tt></td>
|
1639
|
-
<td class="nd_child">Y</td>
|
1640
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1641
|
-
<td class="nd_default"></td>
|
1642
|
-
<td class="nd_comments" rowspan="2">
|
1643
|
-
</td>
|
1644
|
-
</tr>
|
1645
|
-
<tr class="node_desc_oddrow">
|
1646
|
-
<td class="nd_field"><tt>rval</tt></td>
|
1647
|
-
<td class="nd_child">Y</td>
|
1648
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1649
|
-
<td class="nd_default"></td>
|
1650
|
-
</tr>
|
1651
|
-
|
1652
|
-
<tr class="node_desc_evenrow">
|
1653
|
-
<td class="nd_class" rowspan="2"><tt>DivideAssign</tt></td>
|
1654
|
-
<td class="nd_field"><tt>lval</tt></td>
|
1655
|
-
<td class="nd_child">Y</td>
|
1656
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1657
|
-
<td class="nd_default"></td>
|
1658
|
-
<td class="nd_comments" rowspan="2">
|
1659
|
-
</td>
|
1660
|
-
</tr>
|
1661
|
-
<tr class="node_desc_evenrow">
|
1662
|
-
<td class="nd_field"><tt>rval</tt></td>
|
1663
|
-
<td class="nd_child">Y</td>
|
1664
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1665
|
-
<td class="nd_default"></td>
|
1666
|
-
</tr>
|
1667
|
-
|
1668
|
-
<tr class="node_desc_oddrow">
|
1669
|
-
<td class="nd_class" rowspan="2"><tt>ModAssign</tt></td>
|
1670
|
-
<td class="nd_field"><tt>lval</tt></td>
|
1671
|
-
<td class="nd_child">Y</td>
|
1672
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1673
|
-
<td class="nd_default"></td>
|
1674
|
-
<td class="nd_comments" rowspan="2">
|
1675
|
-
</td>
|
1676
|
-
</tr>
|
1677
|
-
<tr class="node_desc_oddrow">
|
1678
|
-
<td class="nd_field"><tt>rval</tt></td>
|
1679
|
-
<td class="nd_child">Y</td>
|
1680
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1681
|
-
<td class="nd_default"></td>
|
1682
|
-
</tr>
|
1683
|
-
|
1684
|
-
<tr class="node_desc_evenrow">
|
1685
|
-
<td class="nd_class" rowspan="2"><tt>AddAssign</tt></td>
|
1686
|
-
<td class="nd_field"><tt>lval</tt></td>
|
1687
|
-
<td class="nd_child">Y</td>
|
1688
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1689
|
-
<td class="nd_default"></td>
|
1690
|
-
<td class="nd_comments" rowspan="2">
|
1691
|
-
</td>
|
1692
|
-
</tr>
|
1693
|
-
<tr class="node_desc_evenrow">
|
1694
|
-
<td class="nd_field"><tt>rval</tt></td>
|
1695
|
-
<td class="nd_child">Y</td>
|
1696
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1697
|
-
<td class="nd_default"></td>
|
1698
|
-
</tr>
|
1699
|
-
|
1700
|
-
<tr class="node_desc_oddrow">
|
1701
|
-
<td class="nd_class" rowspan="2"><tt>SubtractAssign</tt></td>
|
1702
|
-
<td class="nd_field"><tt>lval</tt></td>
|
1703
|
-
<td class="nd_child">Y</td>
|
1704
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1705
|
-
<td class="nd_default"></td>
|
1706
|
-
<td class="nd_comments" rowspan="2">
|
1707
|
-
</td>
|
1708
|
-
</tr>
|
1709
|
-
<tr class="node_desc_oddrow">
|
1710
|
-
<td class="nd_field"><tt>rval</tt></td>
|
1711
|
-
<td class="nd_child">Y</td>
|
1712
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1713
|
-
<td class="nd_default"></td>
|
1714
|
-
</tr>
|
1715
|
-
|
1716
|
-
<tr class="node_desc_evenrow">
|
1717
|
-
<td class="nd_class" rowspan="2"><tt>ShiftLeftAssign</tt></td>
|
1718
|
-
<td class="nd_field"><tt>lval</tt></td>
|
1719
|
-
<td class="nd_child">Y</td>
|
1720
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1721
|
-
<td class="nd_default"></td>
|
1722
|
-
<td class="nd_comments" rowspan="2">
|
1723
|
-
</td>
|
1724
|
-
</tr>
|
1725
|
-
<tr class="node_desc_evenrow">
|
1726
|
-
<td class="nd_field"><tt>rval</tt></td>
|
1727
|
-
<td class="nd_child">Y</td>
|
1728
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1729
|
-
<td class="nd_default"></td>
|
1730
|
-
</tr>
|
1731
|
-
|
1732
|
-
<tr class="node_desc_oddrow">
|
1733
|
-
<td class="nd_class" rowspan="2"><tt>ShiftRightAssign</tt></td>
|
1734
|
-
<td class="nd_field"><tt>lval</tt></td>
|
1735
|
-
<td class="nd_child">Y</td>
|
1736
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1737
|
-
<td class="nd_default"></td>
|
1738
|
-
<td class="nd_comments" rowspan="2">
|
1739
|
-
</td>
|
1740
|
-
</tr>
|
1741
|
-
<tr class="node_desc_oddrow">
|
1742
|
-
<td class="nd_field"><tt>rval</tt></td>
|
1743
|
-
<td class="nd_child">Y</td>
|
1744
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1745
|
-
<td class="nd_default"></td>
|
1746
|
-
</tr>
|
1747
|
-
|
1748
|
-
<tr class="node_desc_evenrow">
|
1749
|
-
<td class="nd_class" rowspan="2"><tt>BitAndAssign</tt></td>
|
1750
|
-
<td class="nd_field"><tt>lval</tt></td>
|
1751
|
-
<td class="nd_child">Y</td>
|
1752
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1753
|
-
<td class="nd_default"></td>
|
1754
|
-
<td class="nd_comments" rowspan="2">
|
1755
|
-
</td>
|
1756
|
-
</tr>
|
1757
|
-
<tr class="node_desc_evenrow">
|
1758
|
-
<td class="nd_field"><tt>rval</tt></td>
|
1759
|
-
<td class="nd_child">Y</td>
|
1760
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1761
|
-
<td class="nd_default"></td>
|
1762
|
-
</tr>
|
1763
|
-
|
1764
|
-
<tr class="node_desc_oddrow">
|
1765
|
-
<td class="nd_class" rowspan="2"><tt>BitXorAssign</tt></td>
|
1766
|
-
<td class="nd_field"><tt>lval</tt></td>
|
1767
|
-
<td class="nd_child">Y</td>
|
1768
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1769
|
-
<td class="nd_default"></td>
|
1770
|
-
<td class="nd_comments" rowspan="2">
|
1771
|
-
</td>
|
1772
|
-
</tr>
|
1773
|
-
<tr class="node_desc_oddrow">
|
1774
|
-
<td class="nd_field"><tt>rval</tt></td>
|
1775
|
-
<td class="nd_child">Y</td>
|
1776
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1777
|
-
<td class="nd_default"></td>
|
1778
|
-
</tr>
|
1779
|
-
|
1780
|
-
<tr class="node_desc_evenrow">
|
1781
|
-
<td class="nd_class" rowspan="2"><tt>BitOrAssign</tt></td>
|
1782
|
-
<td class="nd_field"><tt>lval</tt></td>
|
1783
|
-
<td class="nd_child">Y</td>
|
1784
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1785
|
-
<td class="nd_default"></td>
|
1786
|
-
<td class="nd_comments" rowspan="2">
|
1787
|
-
</td>
|
1788
|
-
</tr>
|
1789
|
-
<tr class="node_desc_evenrow">
|
1790
|
-
<td class="nd_field"><tt>rval</tt></td>
|
1791
|
-
<td class="nd_child">Y</td>
|
1792
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1793
|
-
<td class="nd_default"></td>
|
1794
|
-
</tr>
|
1795
|
-
|
1796
|
-
<tr class="node_desc_oddrow">
|
1797
|
-
<td class="nd_class" rowspan="1"><tt>StringLiteral</tt></td>
|
1798
|
-
<td class="nd_field"><tt>val</tt></td>
|
1799
|
-
<td class="nd_child"></td>
|
1800
|
-
<td class="nd_values"><tt>String</tt></td>
|
1801
|
-
<td class="nd_default"></td>
|
1802
|
-
<td class="nd_comments" rowspan="1">
|
1803
|
-
The <tt>String</tt> in <tt>val</tt> is the literal string entered. <tt>"\n"</tt>
|
1804
|
-
isn't converted to a newline, for instance.
|
1805
|
-
</td>
|
1806
|
-
</tr>
|
1807
|
-
|
1808
|
-
<tr class="node_desc_evenrow">
|
1809
|
-
<td class="nd_class" rowspan="1"><tt>CharLiteral</tt></td>
|
1810
|
-
<td class="nd_field"><tt>val</tt></td>
|
1811
|
-
<td class="nd_child"></td>
|
1812
|
-
<td class="nd_values"><tt>String</tt></td>
|
1813
|
-
<td class="nd_default"></td>
|
1814
|
-
<td class="nd_comments" rowspan="1">
|
1815
|
-
The <tt>String</tt> in <tt>val</tt> is the literal string entered. <tt>'\n'</tt>
|
1816
|
-
isn't converted to a newline, for instance.
|
1817
|
-
</td>
|
1818
|
-
</tr>
|
1819
|
-
|
1820
|
-
<tr class="node_desc_oddrow">
|
1821
|
-
<td class="nd_class" rowspan="2"><tt>CompoundLiteral</tt></td>
|
1822
|
-
<td class="nd_field"><tt>type</tt></td>
|
1823
|
-
<td class="nd_child">Y</td>
|
1824
|
-
<td class="nd_values"><tt>Type</tt></td>
|
1825
|
-
<td class="nd_default"></td>
|
1826
|
-
<td class="nd_comments" rowspan="2">
|
1827
|
-
<p>
|
1828
|
-
Here's an example. <tt>(struct S){1, .x = 2, .y [3] .z =
|
1829
|
-
4}</tt> parses as:</p>
|
1830
|
-
<pre>
|
1831
|
-
CompoundLiteral
|
1832
|
-
type: Struct
|
1833
|
-
name: "S"
|
1834
|
-
member_inits:
|
1835
|
-
- MemberInit
|
1836
|
-
init: IntLiteral
|
1837
|
-
val: 1
|
1838
|
-
- MemberInit
|
1839
|
-
member:
|
1840
|
-
- Member
|
1841
|
-
name: "x"
|
1842
|
-
init: IntLiteral
|
1843
|
-
val: 2
|
1844
|
-
- MemberInit
|
1845
|
-
member:
|
1846
|
-
- Member
|
1847
|
-
name: "y"
|
1848
|
-
- IntLiteral
|
1849
|
-
val: 3
|
1850
|
-
- Member
|
1851
|
-
name: "z"
|
1852
|
-
init: IntLiteral
|
1853
|
-
val: 4
|
1854
|
-
</pre>
|
1855
|
-
"That's legal syntax!?" Yep. Look it up.
|
1856
|
-
</td>
|
1857
|
-
</tr>
|
1858
|
-
<tr class="node_desc_oddrow">
|
1859
|
-
<td class="nd_field"><tt>member_inits</tt></td>
|
1860
|
-
<td class="nd_child">Y</td>
|
1861
|
-
<td class="nd_values"><tt>NodeList</tt> of <tt>MemberInit</tt></td>
|
1862
|
-
<td class="nd_default"><tt>NodeArray[]</tt></td>
|
1863
|
-
</tr>
|
1864
|
-
|
1865
|
-
<tr class="node_desc_evenrow">
|
1866
|
-
<td class="nd_class" rowspan="2"><tt>IntLiteral</tt></td>
|
1867
|
-
<td class="nd_field"><tt>val</tt></td>
|
1868
|
-
<td class="nd_child"></td>
|
1869
|
-
<td class="nd_values"><tt>Integer</tt></td>
|
1870
|
-
<td class="nd_default"></td>
|
1871
|
-
<td class="nd_comments" rowspan="2">
|
1872
|
-
<p>Also:</p>
|
1873
|
-
<ul>
|
1874
|
-
<li><tt>#dec?</tt> -- return true iff <tt>format == :dec</tt></li>
|
1875
|
-
<li><tt>#hex?</tt> -- return true iff <tt>format == :hex</tt></li>
|
1876
|
-
<li><tt>#oct?</tt> -- return true iff <tt>format == :oct</tt></li>
|
1877
|
-
</ul>
|
1878
|
-
</td>
|
1879
|
-
</tr>
|
1880
|
-
<tr class="node_desc_evenrow">
|
1881
|
-
<td class="nd_field"><tt>format</tt></td>
|
1882
|
-
<td class="nd_child"></td>
|
1883
|
-
<td class="nd_values"><tt>:dec</tt>, <tt>:hex</tt>, <tt>:oct</tt></td>
|
1884
|
-
<td class="nd_default"><tt>:dec</tt></td>
|
1885
|
-
</tr>
|
1886
|
-
|
1887
|
-
<tr class="node_desc_oddrow">
|
1888
|
-
<td class="nd_class" rowspan="1"><tt>FloatLiteral</tt></td>
|
1889
|
-
<td class="nd_field"><tt>val</tt></td>
|
1890
|
-
<td class="nd_child"></td>
|
1891
|
-
<td class="nd_values"><tt>Float</tt></td>
|
1892
|
-
<td class="nd_default"></td>
|
1893
|
-
<td class="nd_comments" rowspan="1">
|
1894
|
-
</td>
|
1895
|
-
</tr>
|
1896
|
-
|
1897
|
-
<tr class="node_desc_evenrow">
|
1898
|
-
<td class="nd_class" rowspan="4"><tt>Pointer</tt></td>
|
1899
|
-
<td class="nd_field"><tt>const?</tt></td>
|
1900
|
-
<td class="nd_child"></td>
|
1901
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
1902
|
-
<td class="nd_default"></td>
|
1903
|
-
<td class="nd_comments" rowspan="4">
|
1904
|
-
</td>
|
1905
|
-
</tr>
|
1906
|
-
<tr class="node_desc_evenrow">
|
1907
|
-
<td class="nd_field"><tt>restrict?</tt></td>
|
1908
|
-
<td class="nd_child"></td>
|
1909
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
1910
|
-
<td class="nd_default"></td>
|
1911
|
-
</tr>
|
1912
|
-
<tr class="node_desc_evenrow">
|
1913
|
-
<td class="nd_field"><tt>volatile?</tt></td>
|
1914
|
-
<td class="nd_child"></td>
|
1915
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
1916
|
-
<td class="nd_default"></td>
|
1917
|
-
</tr>
|
1918
|
-
<tr class="node_desc_evenrow">
|
1919
|
-
<td class="nd_field"><tt>type</tt></td>
|
1920
|
-
<td class="nd_child">Y</td>
|
1921
|
-
<td class="nd_values"><tt>Type</tt></td>
|
1922
|
-
<td class="nd_default"></td>
|
1923
|
-
</tr>
|
1924
|
-
|
1925
|
-
<tr class="node_desc_oddrow">
|
1926
|
-
<td class="nd_class" rowspan="5"><tt>Array</tt></td>
|
1927
|
-
<td class="nd_field"><tt>const?</tt></td>
|
1928
|
-
<td class="nd_child"></td>
|
1929
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
1930
|
-
<td class="nd_default"></td>
|
1931
|
-
<td class="nd_comments" rowspan="5">
|
1932
|
-
</td>
|
1933
|
-
</tr>
|
1934
|
-
<tr class="node_desc_oddrow">
|
1935
|
-
<td class="nd_field"><tt>restrict?</tt></td>
|
1936
|
-
<td class="nd_child"></td>
|
1937
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
1938
|
-
<td class="nd_default"></td>
|
1939
|
-
</tr>
|
1940
|
-
<tr class="node_desc_oddrow">
|
1941
|
-
<td class="nd_field"><tt>volatile?</tt></td>
|
1942
|
-
<td class="nd_child"></td>
|
1943
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
1944
|
-
<td class="nd_default"></td>
|
1945
|
-
</tr>
|
1946
|
-
<tr class="node_desc_oddrow">
|
1947
|
-
<td class="nd_field"><tt>type</tt></td>
|
1948
|
-
<td class="nd_child">Y</td>
|
1949
|
-
<td class="nd_values"><tt>Type</tt></td>
|
1950
|
-
<td class="nd_default"></td>
|
1951
|
-
</tr>
|
1952
|
-
<tr class="node_desc_oddrow">
|
1953
|
-
<td class="nd_field"><tt>length</tt></td>
|
1954
|
-
<td class="nd_child">Y</td>
|
1955
|
-
<td class="nd_values"><tt>Expression</tt></td>
|
1956
|
-
<td class="nd_default"></td>
|
1957
|
-
</tr>
|
1958
|
-
|
1959
|
-
<tr class="node_desc_evenrow">
|
1960
|
-
<td class="nd_class" rowspan="6"><tt>Function</tt></td>
|
1961
|
-
<td class="nd_field"><tt>const?</tt></td>
|
1962
|
-
<td class="nd_child"></td>
|
1963
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
1964
|
-
<td class="nd_default"></td>
|
1965
|
-
<td class="nd_comments" rowspan="6">
|
1966
|
-
</td>
|
1967
|
-
</tr>
|
1968
|
-
<tr class="node_desc_evenrow">
|
1969
|
-
<td class="nd_field"><tt>restrict?</tt></td>
|
1970
|
-
<td class="nd_child"></td>
|
1971
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
1972
|
-
<td class="nd_default"></td>
|
1973
|
-
</tr>
|
1974
|
-
<tr class="node_desc_evenrow">
|
1975
|
-
<td class="nd_field"><tt>volatile?</tt></td>
|
1976
|
-
<td class="nd_child"></td>
|
1977
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
1978
|
-
<td class="nd_default"></td>
|
1979
|
-
</tr>
|
1980
|
-
<tr class="node_desc_evenrow">
|
1981
|
-
<td class="nd_field"><tt>type</tt></td>
|
1982
|
-
<td class="nd_child">Y</td>
|
1983
|
-
<td class="nd_values"><tt>Type</tt></td>
|
1984
|
-
<td class="nd_default"></td>
|
1985
|
-
</tr>
|
1986
|
-
<tr class="node_desc_evenrow">
|
1987
|
-
<td class="nd_field"><tt>params</tt></td>
|
1988
|
-
<td class="nd_child">Y</td>
|
1989
|
-
<td class="nd_values"><tt>NodeList</tt> of <tt>Parameter</tt></td>
|
1990
|
-
<td class="nd_default"><tt>NodeArray[]</tt></td>
|
1991
|
-
</tr>
|
1992
|
-
<tr class="node_desc_evenrow">
|
1993
|
-
<td class="nd_field"><tt>var_args?</tt></td>
|
1994
|
-
<td class="nd_child"></td>
|
1995
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
1996
|
-
<td class="nd_default"></td>
|
1997
|
-
</tr>
|
1998
|
-
|
1999
|
-
<tr class="node_desc_oddrow">
|
2000
|
-
<td class="nd_class" rowspan="5"><tt>Struct</tt></td>
|
2001
|
-
<td class="nd_field"><tt>const?</tt></td>
|
2002
|
-
<td class="nd_child"></td>
|
2003
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
2004
|
-
<td class="nd_default"></td>
|
2005
|
-
<td class="nd_comments" rowspan="5">
|
2006
|
-
</td>
|
2007
|
-
</tr>
|
2008
|
-
<tr class="node_desc_oddrow">
|
2009
|
-
<td class="nd_field"><tt>restrict?</tt></td>
|
2010
|
-
<td class="nd_child"></td>
|
2011
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
2012
|
-
<td class="nd_default"></td>
|
2013
|
-
</tr>
|
2014
|
-
<tr class="node_desc_oddrow">
|
2015
|
-
<td class="nd_field"><tt>volatile?</tt></td>
|
2016
|
-
<td class="nd_child"></td>
|
2017
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
2018
|
-
<td class="nd_default"></td>
|
2019
|
-
</tr>
|
2020
|
-
<tr class="node_desc_oddrow">
|
2021
|
-
<td class="nd_field"><tt>name</tt></td>
|
2022
|
-
<td class="nd_child"></td>
|
2023
|
-
<td class="nd_values"><tt>String</tt></td>
|
2024
|
-
<td class="nd_default"></td>
|
2025
|
-
</tr>
|
2026
|
-
<tr class="node_desc_oddrow">
|
2027
|
-
<td class="nd_field"><tt>members</tt></td>
|
2028
|
-
<td class="nd_child">Y</td>
|
2029
|
-
<td class="nd_values"><tt>NodeList</tt> of <tt>Member</tt></td>
|
2030
|
-
<td class="nd_default"><tt>NodeArray[]</tt></td>
|
2031
|
-
</tr>
|
2032
|
-
|
2033
|
-
<tr class="node_desc_evenrow">
|
2034
|
-
<td class="nd_class" rowspan="5"><tt>Union</tt></td>
|
2035
|
-
<td class="nd_field"><tt>const?</tt></td>
|
2036
|
-
<td class="nd_child"></td>
|
2037
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
2038
|
-
<td class="nd_default"></td>
|
2039
|
-
<td class="nd_comments" rowspan="5">
|
2040
|
-
</td>
|
2041
|
-
</tr>
|
2042
|
-
<tr class="node_desc_evenrow">
|
2043
|
-
<td class="nd_field"><tt>restrict?</tt></td>
|
2044
|
-
<td class="nd_child"></td>
|
2045
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
2046
|
-
<td class="nd_default"></td>
|
2047
|
-
</tr>
|
2048
|
-
<tr class="node_desc_evenrow">
|
2049
|
-
<td class="nd_field"><tt>volatile?</tt></td>
|
2050
|
-
<td class="nd_child"></td>
|
2051
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
2052
|
-
<td class="nd_default"></td>
|
2053
|
-
</tr>
|
2054
|
-
<tr class="node_desc_evenrow">
|
2055
|
-
<td class="nd_field"><tt>name</tt></td>
|
2056
|
-
<td class="nd_child"></td>
|
2057
|
-
<td class="nd_values"><tt>String</tt></td>
|
2058
|
-
<td class="nd_default"></td>
|
2059
|
-
</tr>
|
2060
|
-
<tr class="node_desc_evenrow">
|
2061
|
-
<td class="nd_field"><tt>members</tt></td>
|
2062
|
-
<td class="nd_child">Y</td>
|
2063
|
-
<td class="nd_values"><tt>NodeList</tt> of <tt>Member</tt></td>
|
2064
|
-
<td class="nd_default"><tt>NodeArray[]</tt></td>
|
2065
|
-
</tr>
|
2066
|
-
|
2067
|
-
<tr class="node_desc_oddrow">
|
2068
|
-
<td class="nd_class" rowspan="5"><tt>Enum</tt></td>
|
2069
|
-
<td class="nd_field"><tt>const?</tt></td>
|
2070
|
-
<td class="nd_child"></td>
|
2071
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
2072
|
-
<td class="nd_default"></td>
|
2073
|
-
<td class="nd_comments" rowspan="5">
|
2074
|
-
</td>
|
2075
|
-
</tr>
|
2076
|
-
<tr class="node_desc_oddrow">
|
2077
|
-
<td class="nd_field"><tt>restrict?</tt></td>
|
2078
|
-
<td class="nd_child"></td>
|
2079
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
2080
|
-
<td class="nd_default"></td>
|
2081
|
-
</tr>
|
2082
|
-
<tr class="node_desc_oddrow">
|
2083
|
-
<td class="nd_field"><tt>volatile?</tt></td>
|
2084
|
-
<td class="nd_child"></td>
|
2085
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
2086
|
-
<td class="nd_default"></td>
|
2087
|
-
</tr>
|
2088
|
-
<tr class="node_desc_oddrow">
|
2089
|
-
<td class="nd_field"><tt>name</tt></td>
|
2090
|
-
<td class="nd_child"></td>
|
2091
|
-
<td class="nd_values"><tt>String</tt></td>
|
2092
|
-
<td class="nd_default"></td>
|
2093
|
-
</tr>
|
2094
|
-
<tr class="node_desc_oddrow">
|
2095
|
-
<td class="nd_field"><tt>members</tt></td>
|
2096
|
-
<td class="nd_child">Y</td>
|
2097
|
-
<td class="nd_values"><tt>NodeList</tt> of <tt>Enumerator</tt></td>
|
2098
|
-
<td class="nd_default"></td>
|
2099
|
-
</tr>
|
2100
|
-
|
2101
|
-
<tr class="node_desc_evenrow">
|
2102
|
-
<td class="nd_class" rowspan="4"><tt>CustomType</tt></td>
|
2103
|
-
<td class="nd_field"><tt>const?</tt></td>
|
2104
|
-
<td class="nd_child"></td>
|
2105
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
2106
|
-
<td class="nd_default"></td>
|
2107
|
-
<td class="nd_comments" rowspan="4">
|
2108
|
-
This is for <tt>typedef</tt>'d names.
|
2109
|
-
</td>
|
2110
|
-
</tr>
|
2111
|
-
<tr class="node_desc_evenrow">
|
2112
|
-
<td class="nd_field"><tt>restrict?</tt></td>
|
2113
|
-
<td class="nd_child"></td>
|
2114
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
2115
|
-
<td class="nd_default"></td>
|
2116
|
-
</tr>
|
2117
|
-
<tr class="node_desc_evenrow">
|
2118
|
-
<td class="nd_field"><tt>volatile?</tt></td>
|
2119
|
-
<td class="nd_child"></td>
|
2120
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
2121
|
-
<td class="nd_default"></td>
|
2122
|
-
</tr>
|
2123
|
-
<tr class="node_desc_evenrow">
|
2124
|
-
<td class="nd_field"><tt>name</tt></td>
|
2125
|
-
<td class="nd_child"></td>
|
2126
|
-
<td class="nd_values"><tt>String</tt></td>
|
2127
|
-
<td class="nd_default"></td>
|
2128
|
-
</tr>
|
2129
|
-
|
2130
|
-
<tr class="node_desc_oddrow">
|
2131
|
-
<td class="nd_class" rowspan="3"><tt>Void</tt></td>
|
2132
|
-
<td class="nd_field"><tt>const?</tt></td>
|
2133
|
-
<td class="nd_child"></td>
|
2134
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
2135
|
-
<td class="nd_default"></td>
|
2136
|
-
<td class="nd_comments" rowspan="3">
|
2137
|
-
<tt>const void</tt>!? Yes, think about: <tt>const void *</tt>.
|
2138
|
-
</td>
|
2139
|
-
</tr>
|
2140
|
-
<tr class="node_desc_oddrow">
|
2141
|
-
<td class="nd_field"><tt>restrict?</tt></td>
|
2142
|
-
<td class="nd_child"></td>
|
2143
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
2144
|
-
<td class="nd_default"></td>
|
2145
|
-
</tr>
|
2146
|
-
<tr class="node_desc_oddrow">
|
2147
|
-
<td class="nd_field"><tt>volatile?</tt></td>
|
2148
|
-
<td class="nd_child"></td>
|
2149
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
2150
|
-
<td class="nd_default"></td>
|
2151
|
-
</tr>
|
2152
|
-
|
2153
|
-
<tr class="node_desc_evenrow">
|
2154
|
-
<td class="nd_class" rowspan="5"><tt>Int</tt></td>
|
2155
|
-
<td class="nd_field"><tt>const?</tt></td>
|
2156
|
-
<td class="nd_child"></td>
|
2157
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
2158
|
-
<td class="nd_default"></td>
|
2159
|
-
<td class="nd_comments" rowspan="5">
|
2160
|
-
<tt>longness</tt> sounds silly, so here are some less silly
|
2161
|
-
methods:
|
2162
|
-
<ul>
|
2163
|
-
<li><tt>#short?</tt> -- return true iff <tt>longness == -1</tt></li>
|
2164
|
-
<li><tt>#plain?</tt> -- return true iff <tt>longness == 0</tt></li>
|
2165
|
-
<li><tt>#long?</tt> -- return true iff <tt>longness == 1</tt></li>
|
2166
|
-
<li><tt>#long_long?</tt> -- return true iff <tt>longness == 2</tt></li>
|
2167
|
-
</ul>
|
2168
|
-
Oh, and look, a pseudo-field:
|
2169
|
-
<ul>
|
2170
|
-
<li><tt>#signed?</tt> -- same as <tt>!unsigned?</tt></li>
|
2171
|
-
<li><tt>#signed=(val)</tt> -- same as <tt>unsigned = !val</tt></li>
|
2172
|
-
</ul>
|
2173
|
-
</td>
|
2174
|
-
</tr>
|
2175
|
-
<tr class="node_desc_evenrow">
|
2176
|
-
<td class="nd_field"><tt>restrict?</tt></td>
|
2177
|
-
<td class="nd_child"></td>
|
2178
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
2179
|
-
<td class="nd_default"></td>
|
2180
|
-
</tr>
|
2181
|
-
<tr class="node_desc_evenrow">
|
2182
|
-
<td class="nd_field"><tt>volatile?</tt></td>
|
2183
|
-
<td class="nd_child"></td>
|
2184
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
2185
|
-
<td class="nd_default"></td>
|
2186
|
-
</tr>
|
2187
|
-
<tr class="node_desc_evenrow">
|
2188
|
-
<td class="nd_field"><tt>longness</tt></td>
|
2189
|
-
<td class="nd_child"></td>
|
2190
|
-
<td class="nd_values"><tt>-1</tt>, <tt>0</tt>, <tt>1</tt>, <tt>2</tt></td>
|
2191
|
-
<td class="nd_default"><tt>0</tt></td>
|
2192
|
-
</tr>
|
2193
|
-
<tr class="node_desc_evenrow">
|
2194
|
-
<td class="nd_field"><tt>unsigned?</tt></td>
|
2195
|
-
<td class="nd_child"></td>
|
2196
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
2197
|
-
<td class="nd_default"></td>
|
2198
|
-
</tr>
|
2199
|
-
|
2200
|
-
<tr class="node_desc_oddrow">
|
2201
|
-
<td class="nd_class" rowspan="4"><tt>Float</tt></td>
|
2202
|
-
<td class="nd_field"><tt>const?</tt></td>
|
2203
|
-
<td class="nd_child"></td>
|
2204
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
2205
|
-
<td class="nd_default"></td>
|
2206
|
-
<td class="nd_comments" rowspan="4">
|
2207
|
-
Less silly-sounding <tt>longness</tt> substitutes:
|
2208
|
-
<ul>
|
2209
|
-
<li><tt>#plain?</tt> -- return true iff <tt>longness == 0</tt></li>
|
2210
|
-
<li><tt>#double?</tt> -- return true iff <tt>longness == 1</tt></li>
|
2211
|
-
<li><tt>#long_double?</tt> -- return true iff <tt>longness == 2</tt></li>
|
2212
|
-
</ul>
|
2213
|
-
</td>
|
2214
|
-
</tr>
|
2215
|
-
<tr class="node_desc_oddrow">
|
2216
|
-
<td class="nd_field"><tt>restrict?</tt></td>
|
2217
|
-
<td class="nd_child"></td>
|
2218
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
2219
|
-
<td class="nd_default"></td>
|
2220
|
-
</tr>
|
2221
|
-
<tr class="node_desc_oddrow">
|
2222
|
-
<td class="nd_field"><tt>volatile?</tt></td>
|
2223
|
-
<td class="nd_child"></td>
|
2224
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
2225
|
-
<td class="nd_default"></td>
|
2226
|
-
</tr>
|
2227
|
-
<tr class="node_desc_oddrow">
|
2228
|
-
<td class="nd_field"><tt>longness</tt></td>
|
2229
|
-
<td class="nd_child"></td>
|
2230
|
-
<td class="nd_values"><tt>0</tt>, <tt>1</tt>, <tt>2</tt></td>
|
2231
|
-
<td class="nd_default"><tt>0</tt></td>
|
2232
|
-
</tr>
|
2233
|
-
|
2234
|
-
<tr class="node_desc_evenrow">
|
2235
|
-
<td class="nd_class" rowspan="4"><tt>Char</tt></td>
|
2236
|
-
<td class="nd_field"><tt>const?</tt></td>
|
2237
|
-
<td class="nd_child"></td>
|
2238
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
2239
|
-
<td class="nd_default"></td>
|
2240
|
-
<td class="nd_comments" rowspan="4">
|
2241
|
-
Also:
|
2242
|
-
<ul>
|
2243
|
-
<li><tt>#signed?</tt> -- return true iff <tt>signed == true</tt></li>
|
2244
|
-
<li><tt>#unsigned?</tt> -- return true iff <tt>signed == false</tt></li>
|
2245
|
-
<li><tt>#plain?</tt> -- return true iff <tt>signed == nil</tt></li>
|
2246
|
-
</ul>
|
2247
|
-
Yes, C99 says that <tt>char</tt>, <tt>signed char</tt>, and
|
2248
|
-
<tt>unsigned char</tt> are 3 distinct types (unlike with
|
2249
|
-
<tt>int</tt> -- go figure). Like Martian chalk and Venusian
|
2250
|
-
cheese: completely different, but you can fit 'em each in one
|
2251
|
-
byte. Mmm, Martian chalk...
|
2252
|
-
</td>
|
2253
|
-
</tr>
|
2254
|
-
<tr class="node_desc_evenrow">
|
2255
|
-
<td class="nd_field"><tt>restrict?</tt></td>
|
2256
|
-
<td class="nd_child"></td>
|
2257
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
2258
|
-
<td class="nd_default"></td>
|
2259
|
-
</tr>
|
2260
|
-
<tr class="node_desc_evenrow">
|
2261
|
-
<td class="nd_field"><tt>volatile?</tt></td>
|
2262
|
-
<td class="nd_child"></td>
|
2263
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
2264
|
-
<td class="nd_default"></td>
|
2265
|
-
</tr>
|
2266
|
-
<tr class="node_desc_evenrow">
|
2267
|
-
<td class="nd_field"><tt>signed</tt></td>
|
2268
|
-
<td class="nd_child"></td>
|
2269
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt>, <tt>nil</tt></td>
|
2270
|
-
<td class="nd_default"></td>
|
2271
|
-
</tr>
|
2272
|
-
|
2273
|
-
<tr class="node_desc_oddrow">
|
2274
|
-
<td class="nd_class" rowspan="3"><tt>Bool</tt></td>
|
2275
|
-
<td class="nd_field"><tt>const?</tt></td>
|
2276
|
-
<td class="nd_child"></td>
|
2277
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
2278
|
-
<td class="nd_default"></td>
|
2279
|
-
<td class="nd_comments" rowspan="3">
|
2280
|
-
This is the rarely seen <tt>_Bool</tt> type.
|
2281
|
-
</td>
|
2282
|
-
</tr>
|
2283
|
-
<tr class="node_desc_oddrow">
|
2284
|
-
<td class="nd_field"><tt>restrict?</tt></td>
|
2285
|
-
<td class="nd_child"></td>
|
2286
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
2287
|
-
<td class="nd_default"></td>
|
2288
|
-
</tr>
|
2289
|
-
<tr class="node_desc_oddrow">
|
2290
|
-
<td class="nd_field"><tt>volatile?</tt></td>
|
2291
|
-
<td class="nd_child"></td>
|
2292
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
2293
|
-
<td class="nd_default"></td>
|
2294
|
-
</tr>
|
2295
|
-
|
2296
|
-
<tr class="node_desc_evenrow">
|
2297
|
-
<td class="nd_class" rowspan="4"><tt>Complex</tt></td>
|
2298
|
-
<td class="nd_field"><tt>const?</tt></td>
|
2299
|
-
<td class="nd_child"></td>
|
2300
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
2301
|
-
<td class="nd_default"></td>
|
2302
|
-
<td class="nd_comments" rowspan="4">
|
2303
|
-
<p>This is the rarely seen <tt>_Complex</tt> type.</p>
|
2304
|
-
<ul>
|
2305
|
-
<li><tt>#plain?</tt> -- return true iff <tt>longness == 0</tt></li>
|
2306
|
-
<li><tt>#double?</tt> -- return true iff <tt>longness == 1</tt></li>
|
2307
|
-
<li><tt>#long_double?</tt> -- return true iff <tt>longness == 2</tt></li>
|
2308
|
-
</ul>
|
2309
|
-
</td>
|
2310
|
-
</tr>
|
2311
|
-
<tr class="node_desc_evenrow">
|
2312
|
-
<td class="nd_field"><tt>restrict?</tt></td>
|
2313
|
-
<td class="nd_child"></td>
|
2314
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
2315
|
-
<td class="nd_default"></td>
|
2316
|
-
</tr>
|
2317
|
-
<tr class="node_desc_evenrow">
|
2318
|
-
<td class="nd_field"><tt>volatile?</tt></td>
|
2319
|
-
<td class="nd_child"></td>
|
2320
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
2321
|
-
<td class="nd_default"></td>
|
2322
|
-
</tr>
|
2323
|
-
<tr class="node_desc_evenrow">
|
2324
|
-
<td class="nd_field"><tt>longness</tt></td>
|
2325
|
-
<td class="nd_child"></td>
|
2326
|
-
<td class="nd_values"><tt>0</tt>, <tt>1</tt>, <tt>2</tt></td>
|
2327
|
-
<td class="nd_default"><tt>0</tt></td>
|
2328
|
-
</tr>
|
2329
|
-
|
2330
|
-
<tr class="node_desc_oddrow">
|
2331
|
-
<td class="nd_class" rowspan="4"><tt>Imaginary</tt></td>
|
2332
|
-
<td class="nd_field"><tt>const?</tt></td>
|
2333
|
-
<td class="nd_child"></td>
|
2334
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
2335
|
-
<td class="nd_default"></td>
|
2336
|
-
<td class="nd_comments" rowspan="4">
|
2337
|
-
<p>This is the rarely seen <tt>_Imaginary</tt> type.</p>
|
2338
|
-
<ul>
|
2339
|
-
<li><tt>#plain?</tt> -- return true iff <tt>longness == 0</tt></li>
|
2340
|
-
<li><tt>#double?</tt> -- return true iff <tt>longness == 1</tt></li>
|
2341
|
-
<li><tt>#long_double?</tt> -- return true iff <tt>longness == 2</tt></li>
|
2342
|
-
</ul>
|
2343
|
-
</td>
|
2344
|
-
</tr>
|
2345
|
-
<tr class="node_desc_oddrow">
|
2346
|
-
<td class="nd_field"><tt>restrict?</tt></td>
|
2347
|
-
<td class="nd_child"></td>
|
2348
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
2349
|
-
<td class="nd_default"></td>
|
2350
|
-
</tr>
|
2351
|
-
<tr class="node_desc_oddrow">
|
2352
|
-
<td class="nd_field"><tt>volatile?</tt></td>
|
2353
|
-
<td class="nd_child"></td>
|
2354
|
-
<td class="nd_values"><tt>true</tt>, <tt>false</tt></td>
|
2355
|
-
<td class="nd_default"></td>
|
2356
|
-
</tr>
|
2357
|
-
<tr class="node_desc_oddrow">
|
2358
|
-
<td class="nd_field"><tt>longness</tt></td>
|
2359
|
-
<td class="nd_child"></td>
|
2360
|
-
<td class="nd_values"><tt>0</tt>, <tt>1</tt>, <tt>2</tt></td>
|
2361
|
-
<td class="nd_default"><tt>0</tt></td>
|
2362
|
-
</tr>
|
2363
|
-
</tbody></table>
|
2364
|
-
|
2365
|
-
<h3>Node Construction</h3>
|
2366
|
-
|
2367
|
-
<p>
|
2368
|
-
Wanna make a <tt>Node</tt>? Take your pick:
|
2369
|
-
</p>
|
2370
|
-
<ul>
|
2371
|
-
<li>
|
2372
|
-
<tt>#new(field1, field2, ...)</tt> -- fields are in the order
|
2373
|
-
listed above.
|
2374
|
-
</li>
|
2375
|
-
<li>
|
2376
|
-
<tt>#new(:field1 => val, :field2 => val, ...)</tt> -- field order
|
2377
|
-
doesn't matter this way.
|
2378
|
-
</li>
|
2379
|
-
<li>
|
2380
|
-
<tt>#new_at(pos, *args)</tt> -- set the <tt>pos</tt> to that
|
2381
|
-
given, and pass <tt>args</tt> to <tt>#new</tt>.
|
2382
|
-
</li>
|
2383
|
-
</ul>
|
2384
|
-
|
2385
|
-
<p>
|
2386
|
-
They're for losers, though. What you really want to do is make
|
2387
|
-
<tt>Node</tt>s by parsing C code. Each class -- even the abstract
|
2388
|
-
classes like <tt>Statement</tt> -- has a <tt>.parse</tt> method:
|
2389
|
-
<pre class="code_snippet">
|
2390
|
-
funcdef = C::FunctionDef.parse <<EOS
|
2391
|
-
void frobnicate(int karma) {
|
2392
|
-
use_waffle_iron();
|
2393
|
-
}
|
2394
|
-
|
2395
|
-
stmt = C::Statement.parse('while (not_looking) paint_car();')
|
2396
|
-
</pre>
|
2397
|
-
</p>
|
2398
|
-
<p>
|
2399
|
-
Need to tell it to treat <tt>WaffleIron</tt> as a type name? All
|
2400
|
-
those <tt>parse</tt> methods use <tt>C.default_parser</tt>:
|
2401
|
-
<pre class="code_snippet">
|
2402
|
-
C.default_parser.type_names << 'WaffleIron'
|
2403
|
-
type = C::Type.parse('WaffleIron')
|
2404
|
-
</pre>
|
2405
|
-
|
2406
|
-
<p>Alternatively, you could've given <tt>parse</tt> your own
|
2407
|
-
parser:</p>
|
2408
|
-
|
2409
|
-
<pre class="code_snippet">
|
2410
|
-
parser = C::Parser.new
|
2411
|
-
parser.type_names << 'WaffleIron'
|
2412
|
-
type = C::Type.parse('WaffleIron', parser)
|
2413
|
-
</pre>
|
2414
|
-
</p>
|
2415
|
-
<p>
|
2416
|
-
In fact, there's also <tt>C.parse(str, parser=nil)</tt>, which is an
|
2417
|
-
alias for <tt>C::TranslationUnit.parse(str, parser)</tt>.
|
2418
|
-
</p>
|
2419
|
-
<pre class="code_snippet">
|
2420
|
-
ast = C.parse(STDIN)
|
2421
|
-
</pre>
|
2422
|
-
<p>
|
2423
|
-
Yes, all that talk in the intro about doing <tt>parser =
|
2424
|
-
C::Parser.new; parser.parse(...)</tt> was actually all a charade to
|
2425
|
-
make you type more. I so own you.
|
2426
|
-
</p>
|
2427
|
-
|
2428
|
-
<a name="open_issues"></a><h2>Open Issues</h2>
|
2429
|
-
<ul>
|
2430
|
-
<li>
|
2431
|
-
Is it okay to bastardize the <tt>=~</tt> operator like that?
|
2432
|
-
</li>
|
2433
|
-
<li>
|
2434
|
-
Should binary operators have a list of expressions rather than
|
2435
|
-
just 2? That'd allow to_s to format the strings better in some
|
2436
|
-
cases and make it consistent with Comma.
|
2437
|
-
</li>
|
2438
|
-
<li>
|
2439
|
-
At the moment CAST chokes on preprocessor #-lines. Ruby makes it
|
2440
|
-
trivial to filter these out before passing the string to
|
2441
|
-
<tt>Parser#parse</tt>, and this makes it obvious when you forget
|
2442
|
-
to run a file through the preprocessor (which you need to do to
|
2443
|
-
get type names at least once). Is this stupid? Ideally we should
|
2444
|
-
probably have a builtin preprocessor and use that.
|
2445
|
-
</li>
|
2446
|
-
<li>
|
2447
|
-
Should a <tt>Member</tt> be allowed in <tt>MemberInit#member</tt>?
|
2448
|
-
It'd be the common case, but special cases make uniform treatment
|
2449
|
-
more arduous. Is "uniform treatment" an issue?
|
2450
|
-
</li>
|
2451
|
-
</ul>
|
2452
|
-
|
2453
|
-
<p>
|
2454
|
-
<a href="mailto:george.ogata@gmail.com">Vote now</a>.
|
2455
|
-
</p>
|
2456
|
-
|
2457
|
-
<a name="to_do"></a><h2>To Do</h2>
|
2458
|
-
<ul>
|
2459
|
-
<li>
|
2460
|
-
Stop embarrasing yourself and write the parser in C.
|
2461
|
-
</li>
|
2462
|
-
<li>
|
2463
|
-
Make it <tt>-wd</tt> friendly.
|
2464
|
-
</li>
|
2465
|
-
<li>
|
2466
|
-
Fix the "TODO" bits in <tt>c.y</tt>. These are for rarely used C
|
2467
|
-
constructs, like the declaration <tt>int arr[*];</tt>.
|
2468
|
-
</li>
|
2469
|
-
<li>
|
2470
|
-
Add a comment node. Might make it useful for doc extraction.
|
2471
|
-
Anyone want this? Not all comments will be caught, though.
|
2472
|
-
Comments can appear between any two tokens, and I don't really
|
2473
|
-
want to add comment fields to every node. They'd probably just
|
2474
|
-
appear between toplevel entities (in
|
2475
|
-
<tt>TranslationUnit#entities</tt>) and between statements (in
|
2476
|
-
<tt>Block#stmts</tt>).
|
2477
|
-
</li>
|
2478
|
-
<li>
|
2479
|
-
Make it rdoc-able.
|
2480
|
-
</li>
|
2481
|
-
</ul>
|
2482
|
-
|
2483
|
-
<p>
|
2484
|
-
If any of these affect you greatly, <a
|
2485
|
-
href="mailto:george.ogata@gmail.com">kick me</a> to make it happen
|
2486
|
-
faster.
|
2487
|
-
</p>
|
2488
|
-
|
2489
|
-
<a name="to_do"></a><h2>Contact</h2>
|
2490
|
-
|
2491
|
-
I'm not really sure what people are going to try to use this for. If
|
2492
|
-
there's some functionality you think would make a good addition, or
|
2493
|
-
think I've made a mess of this poor puppy, give me a yell.
|
2494
|
-
|
2495
|
-
<p>
|
2496
|
-
You can spam me at <a
|
2497
|
-
href="mailto:george.ogata@gmail.com">george.ogata@gmail.com</a>.
|
2498
|
-
It'd help if you prefixed the subject with "[cast] " so I can easily
|
2499
|
-
distinguish CAST spam from fake Rolex spam.
|
2500
|
-
</p>
|
2501
|
-
|
2502
|
-
</td></tr></table> <!-- frame table -->
|
2503
|
-
|
2504
|
-
</body>
|
2505
|
-
</html>
|