| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#################################################################### |
|
2
|
|
|
|
|
|
|
# |
|
3
|
|
|
|
|
|
|
# This file was generated using Parse::Yapp version 1.05. |
|
4
|
|
|
|
|
|
|
# |
|
5
|
|
|
|
|
|
|
# Don't edit this file, use source file instead. |
|
6
|
|
|
|
|
|
|
# |
|
7
|
|
|
|
|
|
|
# ANY CHANGE MADE HERE WILL BE LOST ! |
|
8
|
|
|
|
|
|
|
# |
|
9
|
|
|
|
|
|
|
#################################################################### |
|
10
|
|
|
|
|
|
|
package TM::AsTMa::Fact; |
|
11
|
2
|
|
|
2
|
|
100595
|
use vars qw ( @ISA ); |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
102
|
|
|
12
|
2
|
|
|
2
|
|
12
|
use strict; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
91
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
@ISA= qw ( Parse::Yapp::Driver ); |
|
15
|
2
|
|
|
2
|
|
2326
|
use Parse::Yapp::Driver; |
|
|
2
|
|
|
|
|
6539
|
|
|
|
2
|
|
|
|
|
3381
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
#line 1 "yapp/astma-fact.yp" |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
use Data::Dumper; |
|
20
|
|
|
|
|
|
|
use TM; |
|
21
|
|
|
|
|
|
|
use TM::Literal; |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
use constant LEFT => 'http://psi.tm.bond.edu.au/astma/1.0/#psi-left'; |
|
24
|
|
|
|
|
|
|
use constant RIGHT => 'http://psi.tm.bond.edu.au/astma/1.0/#psi-right'; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my $tracing = 0; |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub new { |
|
31
|
|
|
|
|
|
|
my $class = shift; |
|
32
|
|
|
|
|
|
|
my %options = @_; |
|
33
|
|
|
|
|
|
|
my $store = delete $options{store} || new TM; # the Yapp parser is picky and interprets this :-/ |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
ref($class) and $class=ref($class); |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
my $self = $class->SUPER::new( |
|
38
|
|
|
|
|
|
|
## yydebug => 0x01, |
|
39
|
|
|
|
|
|
|
yyversion => '1.05', |
|
40
|
|
|
|
|
|
|
yystates => |
|
41
|
|
|
|
|
|
|
[ |
|
42
|
|
|
|
|
|
|
{#State 0 |
|
43
|
|
|
|
|
|
|
DEFAULT => -1, |
|
44
|
|
|
|
|
|
|
GOTOS => { |
|
45
|
|
|
|
|
|
|
'maplet_definitions' => 1 |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
}, |
|
48
|
|
|
|
|
|
|
{#State 1 |
|
49
|
|
|
|
|
|
|
ACTIONS => { |
|
50
|
|
|
|
|
|
|
'' => 3, |
|
51
|
|
|
|
|
|
|
'ID' => 2, |
|
52
|
|
|
|
|
|
|
'TRACE' => 4, |
|
53
|
|
|
|
|
|
|
'LPAREN' => 5, |
|
54
|
|
|
|
|
|
|
'LBRACKET' => 6, |
|
55
|
|
|
|
|
|
|
'COMMENT' => 7, |
|
56
|
|
|
|
|
|
|
'CANCEL' => 9, |
|
57
|
|
|
|
|
|
|
'ENCODING' => 13, |
|
58
|
|
|
|
|
|
|
'LOG' => 14, |
|
59
|
|
|
|
|
|
|
'EOL' => 15 |
|
60
|
|
|
|
|
|
|
}, |
|
61
|
|
|
|
|
|
|
GOTOS => { |
|
62
|
|
|
|
|
|
|
'maplet_definition' => 12, |
|
63
|
|
|
|
|
|
|
'association_definition' => 11, |
|
64
|
|
|
|
|
|
|
'topic_definition' => 8, |
|
65
|
|
|
|
|
|
|
'template_definition' => 10 |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
}, |
|
68
|
|
|
|
|
|
|
{#State 2 |
|
69
|
|
|
|
|
|
|
DEFAULT => -18, |
|
70
|
|
|
|
|
|
|
GOTOS => { |
|
71
|
|
|
|
|
|
|
'types' => 16 |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
}, |
|
74
|
|
|
|
|
|
|
{#State 3 |
|
75
|
|
|
|
|
|
|
DEFAULT => 0 |
|
76
|
|
|
|
|
|
|
}, |
|
77
|
|
|
|
|
|
|
{#State 4 |
|
78
|
|
|
|
|
|
|
ACTIONS => { |
|
79
|
|
|
|
|
|
|
'EOL' => 17 |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
}, |
|
82
|
|
|
|
|
|
|
{#State 5 |
|
83
|
|
|
|
|
|
|
ACTIONS => { |
|
84
|
|
|
|
|
|
|
'ID' => 18 |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
}, |
|
87
|
|
|
|
|
|
|
{#State 6 |
|
88
|
|
|
|
|
|
|
DEFAULT => -41, |
|
89
|
|
|
|
|
|
|
GOTOS => { |
|
90
|
|
|
|
|
|
|
'@4-1' => 19 |
|
91
|
|
|
|
|
|
|
} |
|
92
|
|
|
|
|
|
|
}, |
|
93
|
|
|
|
|
|
|
{#State 7 |
|
94
|
|
|
|
|
|
|
ACTIONS => { |
|
95
|
|
|
|
|
|
|
'EOL' => 20 |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
}, |
|
98
|
|
|
|
|
|
|
{#State 8 |
|
99
|
|
|
|
|
|
|
DEFAULT => -9 |
|
100
|
|
|
|
|
|
|
}, |
|
101
|
|
|
|
|
|
|
{#State 9 |
|
102
|
|
|
|
|
|
|
ACTIONS => { |
|
103
|
|
|
|
|
|
|
'EOL' => 21 |
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
}, |
|
106
|
|
|
|
|
|
|
{#State 10 |
|
107
|
|
|
|
|
|
|
ACTIONS => { |
|
108
|
|
|
|
|
|
|
'EOL' => 22 |
|
109
|
|
|
|
|
|
|
} |
|
110
|
|
|
|
|
|
|
}, |
|
111
|
|
|
|
|
|
|
{#State 11 |
|
112
|
|
|
|
|
|
|
DEFAULT => -10 |
|
113
|
|
|
|
|
|
|
}, |
|
114
|
|
|
|
|
|
|
{#State 12 |
|
115
|
|
|
|
|
|
|
DEFAULT => -2 |
|
116
|
|
|
|
|
|
|
}, |
|
117
|
|
|
|
|
|
|
{#State 13 |
|
118
|
|
|
|
|
|
|
ACTIONS => { |
|
119
|
|
|
|
|
|
|
'EOL' => 23 |
|
120
|
|
|
|
|
|
|
} |
|
121
|
|
|
|
|
|
|
}, |
|
122
|
|
|
|
|
|
|
{#State 14 |
|
123
|
|
|
|
|
|
|
ACTIONS => { |
|
124
|
|
|
|
|
|
|
'EOL' => 24 |
|
125
|
|
|
|
|
|
|
} |
|
126
|
|
|
|
|
|
|
}, |
|
127
|
|
|
|
|
|
|
{#State 15 |
|
128
|
|
|
|
|
|
|
DEFAULT => -11 |
|
129
|
|
|
|
|
|
|
}, |
|
130
|
|
|
|
|
|
|
{#State 16 |
|
131
|
|
|
|
|
|
|
ACTIONS => { |
|
132
|
|
|
|
|
|
|
'ISREIFIED' => 26, |
|
133
|
|
|
|
|
|
|
'ISINDICATEDBY' => 27, |
|
134
|
|
|
|
|
|
|
'ISA' => 28, |
|
135
|
|
|
|
|
|
|
'LPAREN' => 25, |
|
136
|
|
|
|
|
|
|
'REIFIES' => 30 |
|
137
|
|
|
|
|
|
|
}, |
|
138
|
|
|
|
|
|
|
DEFAULT => -14, |
|
139
|
|
|
|
|
|
|
GOTOS => { |
|
140
|
|
|
|
|
|
|
'type' => 29, |
|
141
|
|
|
|
|
|
|
'reification_indication' => 31 |
|
142
|
|
|
|
|
|
|
} |
|
143
|
|
|
|
|
|
|
}, |
|
144
|
|
|
|
|
|
|
{#State 17 |
|
145
|
|
|
|
|
|
|
DEFAULT => -7 |
|
146
|
|
|
|
|
|
|
}, |
|
147
|
|
|
|
|
|
|
{#State 18 |
|
148
|
|
|
|
|
|
|
ACTIONS => { |
|
149
|
|
|
|
|
|
|
'RPAREN' => 32 |
|
150
|
|
|
|
|
|
|
} |
|
151
|
|
|
|
|
|
|
}, |
|
152
|
|
|
|
|
|
|
{#State 19 |
|
153
|
|
|
|
|
|
|
ACTIONS => { |
|
154
|
|
|
|
|
|
|
'LPAREN' => 5 |
|
155
|
|
|
|
|
|
|
}, |
|
156
|
|
|
|
|
|
|
GOTOS => { |
|
157
|
|
|
|
|
|
|
'association_definition' => 33 |
|
158
|
|
|
|
|
|
|
} |
|
159
|
|
|
|
|
|
|
}, |
|
160
|
|
|
|
|
|
|
{#State 20 |
|
161
|
|
|
|
|
|
|
DEFAULT => -4 |
|
162
|
|
|
|
|
|
|
}, |
|
163
|
|
|
|
|
|
|
{#State 21 |
|
164
|
|
|
|
|
|
|
DEFAULT => -6 |
|
165
|
|
|
|
|
|
|
}, |
|
166
|
|
|
|
|
|
|
{#State 22 |
|
167
|
|
|
|
|
|
|
DEFAULT => -3 |
|
168
|
|
|
|
|
|
|
}, |
|
169
|
|
|
|
|
|
|
{#State 23 |
|
170
|
|
|
|
|
|
|
DEFAULT => -8 |
|
171
|
|
|
|
|
|
|
}, |
|
172
|
|
|
|
|
|
|
{#State 24 |
|
173
|
|
|
|
|
|
|
DEFAULT => -5 |
|
174
|
|
|
|
|
|
|
}, |
|
175
|
|
|
|
|
|
|
{#State 25 |
|
176
|
|
|
|
|
|
|
DEFAULT => -50, |
|
177
|
|
|
|
|
|
|
GOTOS => { |
|
178
|
|
|
|
|
|
|
'ids' => 34 |
|
179
|
|
|
|
|
|
|
} |
|
180
|
|
|
|
|
|
|
}, |
|
181
|
|
|
|
|
|
|
{#State 26 |
|
182
|
|
|
|
|
|
|
ACTIONS => { |
|
183
|
|
|
|
|
|
|
'ID' => 35 |
|
184
|
|
|
|
|
|
|
} |
|
185
|
|
|
|
|
|
|
}, |
|
186
|
|
|
|
|
|
|
{#State 27 |
|
187
|
|
|
|
|
|
|
ACTIONS => { |
|
188
|
|
|
|
|
|
|
'ID' => 36 |
|
189
|
|
|
|
|
|
|
} |
|
190
|
|
|
|
|
|
|
}, |
|
191
|
|
|
|
|
|
|
{#State 28 |
|
192
|
|
|
|
|
|
|
ACTIONS => { |
|
193
|
|
|
|
|
|
|
'ID' => 37 |
|
194
|
|
|
|
|
|
|
} |
|
195
|
|
|
|
|
|
|
}, |
|
196
|
|
|
|
|
|
|
{#State 29 |
|
197
|
|
|
|
|
|
|
DEFAULT => -19 |
|
198
|
|
|
|
|
|
|
}, |
|
199
|
|
|
|
|
|
|
{#State 30 |
|
200
|
|
|
|
|
|
|
ACTIONS => { |
|
201
|
|
|
|
|
|
|
'ID' => 38 |
|
202
|
|
|
|
|
|
|
} |
|
203
|
|
|
|
|
|
|
}, |
|
204
|
|
|
|
|
|
|
{#State 31 |
|
205
|
|
|
|
|
|
|
DEFAULT => -38, |
|
206
|
|
|
|
|
|
|
GOTOS => { |
|
207
|
|
|
|
|
|
|
'inline_assocs' => 39 |
|
208
|
|
|
|
|
|
|
} |
|
209
|
|
|
|
|
|
|
}, |
|
210
|
|
|
|
|
|
|
{#State 32 |
|
211
|
|
|
|
|
|
|
ACTIONS => { |
|
212
|
|
|
|
|
|
|
'AT' => 40 |
|
213
|
|
|
|
|
|
|
}, |
|
214
|
|
|
|
|
|
|
DEFAULT => -36, |
|
215
|
|
|
|
|
|
|
GOTOS => { |
|
216
|
|
|
|
|
|
|
'scope' => 41 |
|
217
|
|
|
|
|
|
|
} |
|
218
|
|
|
|
|
|
|
}, |
|
219
|
|
|
|
|
|
|
{#State 33 |
|
220
|
|
|
|
|
|
|
DEFAULT => -42 |
|
221
|
|
|
|
|
|
|
}, |
|
222
|
|
|
|
|
|
|
{#State 34 |
|
223
|
|
|
|
|
|
|
ACTIONS => { |
|
224
|
|
|
|
|
|
|
'ID' => 42, |
|
225
|
|
|
|
|
|
|
'RPAREN' => 43 |
|
226
|
|
|
|
|
|
|
} |
|
227
|
|
|
|
|
|
|
}, |
|
228
|
|
|
|
|
|
|
{#State 35 |
|
229
|
|
|
|
|
|
|
DEFAULT => -16 |
|
230
|
|
|
|
|
|
|
}, |
|
231
|
|
|
|
|
|
|
{#State 36 |
|
232
|
|
|
|
|
|
|
DEFAULT => -17 |
|
233
|
|
|
|
|
|
|
}, |
|
234
|
|
|
|
|
|
|
{#State 37 |
|
235
|
|
|
|
|
|
|
DEFAULT => -20 |
|
236
|
|
|
|
|
|
|
}, |
|
237
|
|
|
|
|
|
|
{#State 38 |
|
238
|
|
|
|
|
|
|
DEFAULT => -15 |
|
239
|
|
|
|
|
|
|
}, |
|
240
|
|
|
|
|
|
|
{#State 39 |
|
241
|
|
|
|
|
|
|
ACTIONS => { |
|
242
|
|
|
|
|
|
|
'ID' => 44, |
|
243
|
|
|
|
|
|
|
'EOL' => 46 |
|
244
|
|
|
|
|
|
|
}, |
|
245
|
|
|
|
|
|
|
GOTOS => { |
|
246
|
|
|
|
|
|
|
'inline_assoc' => 45 |
|
247
|
|
|
|
|
|
|
} |
|
248
|
|
|
|
|
|
|
}, |
|
249
|
|
|
|
|
|
|
{#State 40 |
|
250
|
|
|
|
|
|
|
ACTIONS => { |
|
251
|
|
|
|
|
|
|
'ID' => 47 |
|
252
|
|
|
|
|
|
|
} |
|
253
|
|
|
|
|
|
|
}, |
|
254
|
|
|
|
|
|
|
{#State 41 |
|
255
|
|
|
|
|
|
|
ACTIONS => { |
|
256
|
|
|
|
|
|
|
'ISREIFIED' => 26, |
|
257
|
|
|
|
|
|
|
'ISINDICATEDBY' => 27, |
|
258
|
|
|
|
|
|
|
'REIFIES' => 30 |
|
259
|
|
|
|
|
|
|
}, |
|
260
|
|
|
|
|
|
|
DEFAULT => -14, |
|
261
|
|
|
|
|
|
|
GOTOS => { |
|
262
|
|
|
|
|
|
|
'reification_indication' => 48 |
|
263
|
|
|
|
|
|
|
} |
|
264
|
|
|
|
|
|
|
}, |
|
265
|
|
|
|
|
|
|
{#State 42 |
|
266
|
|
|
|
|
|
|
DEFAULT => -51 |
|
267
|
|
|
|
|
|
|
}, |
|
268
|
|
|
|
|
|
|
{#State 43 |
|
269
|
|
|
|
|
|
|
DEFAULT => -21 |
|
270
|
|
|
|
|
|
|
}, |
|
271
|
|
|
|
|
|
|
{#State 44 |
|
272
|
|
|
|
|
|
|
ACTIONS => { |
|
273
|
|
|
|
|
|
|
'ID' => 49 |
|
274
|
|
|
|
|
|
|
} |
|
275
|
|
|
|
|
|
|
}, |
|
276
|
|
|
|
|
|
|
{#State 45 |
|
277
|
|
|
|
|
|
|
DEFAULT => -39 |
|
278
|
|
|
|
|
|
|
}, |
|
279
|
|
|
|
|
|
|
{#State 46 |
|
280
|
|
|
|
|
|
|
DEFAULT => -12, |
|
281
|
|
|
|
|
|
|
GOTOS => { |
|
282
|
|
|
|
|
|
|
'@1-5' => 50 |
|
283
|
|
|
|
|
|
|
} |
|
284
|
|
|
|
|
|
|
}, |
|
285
|
|
|
|
|
|
|
{#State 47 |
|
286
|
|
|
|
|
|
|
DEFAULT => -37 |
|
287
|
|
|
|
|
|
|
}, |
|
288
|
|
|
|
|
|
|
{#State 48 |
|
289
|
|
|
|
|
|
|
ACTIONS => { |
|
290
|
|
|
|
|
|
|
'EOL' => 51 |
|
291
|
|
|
|
|
|
|
} |
|
292
|
|
|
|
|
|
|
}, |
|
293
|
|
|
|
|
|
|
{#State 49 |
|
294
|
|
|
|
|
|
|
DEFAULT => -40 |
|
295
|
|
|
|
|
|
|
}, |
|
296
|
|
|
|
|
|
|
{#State 50 |
|
297
|
|
|
|
|
|
|
DEFAULT => -22, |
|
298
|
|
|
|
|
|
|
GOTOS => { |
|
299
|
|
|
|
|
|
|
'characteristics_indication' => 52 |
|
300
|
|
|
|
|
|
|
} |
|
301
|
|
|
|
|
|
|
}, |
|
302
|
|
|
|
|
|
|
{#State 51 |
|
303
|
|
|
|
|
|
|
ACTIONS => { |
|
304
|
|
|
|
|
|
|
'ID' => 53 |
|
305
|
|
|
|
|
|
|
}, |
|
306
|
|
|
|
|
|
|
GOTOS => { |
|
307
|
|
|
|
|
|
|
'member' => 54, |
|
308
|
|
|
|
|
|
|
'association_members' => 55 |
|
309
|
|
|
|
|
|
|
} |
|
310
|
|
|
|
|
|
|
}, |
|
311
|
|
|
|
|
|
|
{#State 52 |
|
312
|
|
|
|
|
|
|
ACTIONS => { |
|
313
|
|
|
|
|
|
|
'OC' => 57, |
|
314
|
|
|
|
|
|
|
'IN' => 58, |
|
315
|
|
|
|
|
|
|
'BN' => 59, |
|
316
|
|
|
|
|
|
|
'SIN' => 60 |
|
317
|
|
|
|
|
|
|
}, |
|
318
|
|
|
|
|
|
|
DEFAULT => -13, |
|
319
|
|
|
|
|
|
|
GOTOS => { |
|
320
|
|
|
|
|
|
|
'characteristic_indication' => 56, |
|
321
|
|
|
|
|
|
|
'indication' => 61, |
|
322
|
|
|
|
|
|
|
'class' => 62, |
|
323
|
|
|
|
|
|
|
'characteristic' => 63 |
|
324
|
|
|
|
|
|
|
} |
|
325
|
|
|
|
|
|
|
}, |
|
326
|
|
|
|
|
|
|
{#State 53 |
|
327
|
|
|
|
|
|
|
ACTIONS => { |
|
328
|
|
|
|
|
|
|
'COLON' => 64 |
|
329
|
|
|
|
|
|
|
} |
|
330
|
|
|
|
|
|
|
}, |
|
331
|
|
|
|
|
|
|
{#State 54 |
|
332
|
|
|
|
|
|
|
DEFAULT => -44 |
|
333
|
|
|
|
|
|
|
}, |
|
334
|
|
|
|
|
|
|
{#State 55 |
|
335
|
|
|
|
|
|
|
ACTIONS => { |
|
336
|
|
|
|
|
|
|
'ID' => 53 |
|
337
|
|
|
|
|
|
|
}, |
|
338
|
|
|
|
|
|
|
DEFAULT => -43, |
|
339
|
|
|
|
|
|
|
GOTOS => { |
|
340
|
|
|
|
|
|
|
'member' => 65 |
|
341
|
|
|
|
|
|
|
} |
|
342
|
|
|
|
|
|
|
}, |
|
343
|
|
|
|
|
|
|
{#State 56 |
|
344
|
|
|
|
|
|
|
DEFAULT => -23 |
|
345
|
|
|
|
|
|
|
}, |
|
346
|
|
|
|
|
|
|
{#State 57 |
|
347
|
|
|
|
|
|
|
DEFAULT => -31 |
|
348
|
|
|
|
|
|
|
}, |
|
349
|
|
|
|
|
|
|
{#State 58 |
|
350
|
|
|
|
|
|
|
DEFAULT => -32 |
|
351
|
|
|
|
|
|
|
}, |
|
352
|
|
|
|
|
|
|
{#State 59 |
|
353
|
|
|
|
|
|
|
DEFAULT => -30 |
|
354
|
|
|
|
|
|
|
}, |
|
355
|
|
|
|
|
|
|
{#State 60 |
|
356
|
|
|
|
|
|
|
DEFAULT => -26, |
|
357
|
|
|
|
|
|
|
GOTOS => { |
|
358
|
|
|
|
|
|
|
'@2-1' => 66 |
|
359
|
|
|
|
|
|
|
} |
|
360
|
|
|
|
|
|
|
}, |
|
361
|
|
|
|
|
|
|
{#State 61 |
|
362
|
|
|
|
|
|
|
DEFAULT => -25 |
|
363
|
|
|
|
|
|
|
}, |
|
364
|
|
|
|
|
|
|
{#State 62 |
|
365
|
|
|
|
|
|
|
DEFAULT => -28, |
|
366
|
|
|
|
|
|
|
GOTOS => { |
|
367
|
|
|
|
|
|
|
'@3-1' => 67 |
|
368
|
|
|
|
|
|
|
} |
|
369
|
|
|
|
|
|
|
}, |
|
370
|
|
|
|
|
|
|
{#State 63 |
|
371
|
|
|
|
|
|
|
DEFAULT => -24 |
|
372
|
|
|
|
|
|
|
}, |
|
373
|
|
|
|
|
|
|
{#State 64 |
|
374
|
|
|
|
|
|
|
DEFAULT => -50, |
|
375
|
|
|
|
|
|
|
GOTOS => { |
|
376
|
|
|
|
|
|
|
'ids' => 68, |
|
377
|
|
|
|
|
|
|
'ids1' => 69 |
|
378
|
|
|
|
|
|
|
} |
|
379
|
|
|
|
|
|
|
}, |
|
380
|
|
|
|
|
|
|
{#State 65 |
|
381
|
|
|
|
|
|
|
DEFAULT => -45 |
|
382
|
|
|
|
|
|
|
}, |
|
383
|
|
|
|
|
|
|
{#State 66 |
|
384
|
|
|
|
|
|
|
ACTIONS => { |
|
385
|
|
|
|
|
|
|
'STRING' => 71 |
|
386
|
|
|
|
|
|
|
}, |
|
387
|
|
|
|
|
|
|
GOTOS => { |
|
388
|
|
|
|
|
|
|
'string' => 70 |
|
389
|
|
|
|
|
|
|
} |
|
390
|
|
|
|
|
|
|
}, |
|
391
|
|
|
|
|
|
|
{#State 67 |
|
392
|
|
|
|
|
|
|
ACTIONS => { |
|
393
|
|
|
|
|
|
|
'AT' => 40 |
|
394
|
|
|
|
|
|
|
}, |
|
395
|
|
|
|
|
|
|
DEFAULT => -36, |
|
396
|
|
|
|
|
|
|
GOTOS => { |
|
397
|
|
|
|
|
|
|
'scope' => 72 |
|
398
|
|
|
|
|
|
|
} |
|
399
|
|
|
|
|
|
|
}, |
|
400
|
|
|
|
|
|
|
{#State 68 |
|
401
|
|
|
|
|
|
|
ACTIONS => { |
|
402
|
|
|
|
|
|
|
'ID' => 73 |
|
403
|
|
|
|
|
|
|
} |
|
404
|
|
|
|
|
|
|
}, |
|
405
|
|
|
|
|
|
|
{#State 69 |
|
406
|
|
|
|
|
|
|
ACTIONS => { |
|
407
|
|
|
|
|
|
|
'RBRACKET' => 74, |
|
408
|
|
|
|
|
|
|
'EOL' => 76 |
|
409
|
|
|
|
|
|
|
}, |
|
410
|
|
|
|
|
|
|
GOTOS => { |
|
411
|
|
|
|
|
|
|
'eom' => 75 |
|
412
|
|
|
|
|
|
|
} |
|
413
|
|
|
|
|
|
|
}, |
|
414
|
|
|
|
|
|
|
{#State 70 |
|
415
|
|
|
|
|
|
|
DEFAULT => -27 |
|
416
|
|
|
|
|
|
|
}, |
|
417
|
|
|
|
|
|
|
{#State 71 |
|
418
|
|
|
|
|
|
|
ACTIONS => { |
|
419
|
|
|
|
|
|
|
'EOL' => 77 |
|
420
|
|
|
|
|
|
|
} |
|
421
|
|
|
|
|
|
|
}, |
|
422
|
|
|
|
|
|
|
{#State 72 |
|
423
|
|
|
|
|
|
|
ACTIONS => { |
|
424
|
|
|
|
|
|
|
'LPAREN' => 78 |
|
425
|
|
|
|
|
|
|
}, |
|
426
|
|
|
|
|
|
|
DEFAULT => -33, |
|
427
|
|
|
|
|
|
|
GOTOS => { |
|
428
|
|
|
|
|
|
|
'char_type' => 79, |
|
429
|
|
|
|
|
|
|
'assoc_type' => 80 |
|
430
|
|
|
|
|
|
|
} |
|
431
|
|
|
|
|
|
|
}, |
|
432
|
|
|
|
|
|
|
{#State 73 |
|
433
|
|
|
|
|
|
|
ACTIONS => { |
|
434
|
|
|
|
|
|
|
'ID' => -51 |
|
435
|
|
|
|
|
|
|
}, |
|
436
|
|
|
|
|
|
|
DEFAULT => -49 |
|
437
|
|
|
|
|
|
|
}, |
|
438
|
|
|
|
|
|
|
{#State 74 |
|
439
|
|
|
|
|
|
|
ACTIONS => { |
|
440
|
|
|
|
|
|
|
'EOL' => 81 |
|
441
|
|
|
|
|
|
|
} |
|
442
|
|
|
|
|
|
|
}, |
|
443
|
|
|
|
|
|
|
{#State 75 |
|
444
|
|
|
|
|
|
|
DEFAULT => -46 |
|
445
|
|
|
|
|
|
|
}, |
|
446
|
|
|
|
|
|
|
{#State 76 |
|
447
|
|
|
|
|
|
|
DEFAULT => -47 |
|
448
|
|
|
|
|
|
|
}, |
|
449
|
|
|
|
|
|
|
{#State 77 |
|
450
|
|
|
|
|
|
|
DEFAULT => -52 |
|
451
|
|
|
|
|
|
|
}, |
|
452
|
|
|
|
|
|
|
{#State 78 |
|
453
|
|
|
|
|
|
|
ACTIONS => { |
|
454
|
|
|
|
|
|
|
'ID' => 82 |
|
455
|
|
|
|
|
|
|
} |
|
456
|
|
|
|
|
|
|
}, |
|
457
|
|
|
|
|
|
|
{#State 79 |
|
458
|
|
|
|
|
|
|
ACTIONS => { |
|
459
|
|
|
|
|
|
|
'STRING' => 71 |
|
460
|
|
|
|
|
|
|
}, |
|
461
|
|
|
|
|
|
|
GOTOS => { |
|
462
|
|
|
|
|
|
|
'string' => 83 |
|
463
|
|
|
|
|
|
|
} |
|
464
|
|
|
|
|
|
|
}, |
|
465
|
|
|
|
|
|
|
{#State 80 |
|
466
|
|
|
|
|
|
|
DEFAULT => -34 |
|
467
|
|
|
|
|
|
|
}, |
|
468
|
|
|
|
|
|
|
{#State 81 |
|
469
|
|
|
|
|
|
|
DEFAULT => -48 |
|
470
|
|
|
|
|
|
|
}, |
|
471
|
|
|
|
|
|
|
{#State 82 |
|
472
|
|
|
|
|
|
|
ACTIONS => { |
|
473
|
|
|
|
|
|
|
'RPAREN' => 84 |
|
474
|
|
|
|
|
|
|
} |
|
475
|
|
|
|
|
|
|
}, |
|
476
|
|
|
|
|
|
|
{#State 83 |
|
477
|
|
|
|
|
|
|
DEFAULT => -29 |
|
478
|
|
|
|
|
|
|
}, |
|
479
|
|
|
|
|
|
|
{#State 84 |
|
480
|
|
|
|
|
|
|
DEFAULT => -35 |
|
481
|
|
|
|
|
|
|
} |
|
482
|
|
|
|
|
|
|
], |
|
483
|
|
|
|
|
|
|
yyrules => |
|
484
|
|
|
|
|
|
|
[ |
|
485
|
|
|
|
|
|
|
[#Rule 0 |
|
486
|
|
|
|
|
|
|
'$start', 2, undef |
|
487
|
|
|
|
|
|
|
], |
|
488
|
|
|
|
|
|
|
[#Rule 1 |
|
489
|
|
|
|
|
|
|
'maplet_definitions', 0, undef |
|
490
|
|
|
|
|
|
|
], |
|
491
|
|
|
|
|
|
|
[#Rule 2 |
|
492
|
|
|
|
|
|
|
'maplet_definitions', 2, undef |
|
493
|
|
|
|
|
|
|
], |
|
494
|
|
|
|
|
|
|
[#Rule 3 |
|
495
|
|
|
|
|
|
|
'maplet_definitions', 3, undef |
|
496
|
|
|
|
|
|
|
], |
|
497
|
|
|
|
|
|
|
[#Rule 4 |
|
498
|
|
|
|
|
|
|
'maplet_definitions', 3, undef |
|
499
|
|
|
|
|
|
|
], |
|
500
|
|
|
|
|
|
|
[#Rule 5 |
|
501
|
|
|
|
|
|
|
'maplet_definitions', 3, |
|
502
|
|
|
|
|
|
|
sub |
|
503
|
|
|
|
|
|
|
#line 42 "yapp/astma-fact.yp" |
|
504
|
|
|
|
|
|
|
{ warn "Logging $_[2]"; } |
|
505
|
|
|
|
|
|
|
], |
|
506
|
|
|
|
|
|
|
[#Rule 6 |
|
507
|
|
|
|
|
|
|
'maplet_definitions', 3, |
|
508
|
|
|
|
|
|
|
sub |
|
509
|
|
|
|
|
|
|
#line 43 "yapp/astma-fact.yp" |
|
510
|
|
|
|
|
|
|
{ die "Cancelled"; } |
|
511
|
|
|
|
|
|
|
], |
|
512
|
|
|
|
|
|
|
[#Rule 7 |
|
513
|
|
|
|
|
|
|
'maplet_definitions', 3, |
|
514
|
|
|
|
|
|
|
sub |
|
515
|
|
|
|
|
|
|
#line 44 "yapp/astma-fact.yp" |
|
516
|
|
|
|
|
|
|
{ $tracing = $_[2]; warn "# start tracing: level $tracing"; } |
|
517
|
|
|
|
|
|
|
], |
|
518
|
|
|
|
|
|
|
[#Rule 8 |
|
519
|
|
|
|
|
|
|
'maplet_definitions', 3, |
|
520
|
|
|
|
|
|
|
sub |
|
521
|
|
|
|
|
|
|
#line 45 "yapp/astma-fact.yp" |
|
522
|
|
|
|
|
|
|
{ |
|
523
|
|
|
|
|
|
|
use Encode; |
|
524
|
|
|
|
|
|
|
Encode::from_to ($_[0]->YYData->{INPUT}, "iso-8859-1", $_[2]); |
|
525
|
|
|
|
|
|
|
} |
|
526
|
|
|
|
|
|
|
], |
|
527
|
|
|
|
|
|
|
[#Rule 9 |
|
528
|
|
|
|
|
|
|
'maplet_definition', 1, undef |
|
529
|
|
|
|
|
|
|
], |
|
530
|
|
|
|
|
|
|
[#Rule 10 |
|
531
|
|
|
|
|
|
|
'maplet_definition', 1, undef |
|
532
|
|
|
|
|
|
|
], |
|
533
|
|
|
|
|
|
|
[#Rule 11 |
|
534
|
|
|
|
|
|
|
'maplet_definition', 1, undef |
|
535
|
|
|
|
|
|
|
], |
|
536
|
|
|
|
|
|
|
[#Rule 12 |
|
537
|
|
|
|
|
|
|
'@1-5', 0, |
|
538
|
|
|
|
|
|
|
sub |
|
539
|
|
|
|
|
|
|
#line 57 "yapp/astma-fact.yp" |
|
540
|
|
|
|
|
|
|
{ |
|
541
|
|
|
|
|
|
|
$_[1] = $_[0]->{USER}->{store}->internalize ($_[1]); |
|
542
|
|
|
|
|
|
|
|
|
543
|
|
|
|
|
|
|
if (ref $_[3]) { # we have reification info |
|
544
|
|
|
|
|
|
|
if ( $_[3]->[0] == 1) { # 1 = REIFIES, means current ID is a shorthand for the other |
|
545
|
|
|
|
|
|
|
$_[0]->{USER}->{store}->internalize ($_[1] => $_[3]->[1]); |
|
546
|
|
|
|
|
|
|
} elsif ($_[3]->[0] == 0) { # 0 = IS-REIFIED, this must be the other way round |
|
547
|
|
|
|
|
|
|
$_[0]->{USER}->{store}->internalize ($_[3]->[1] => $_[1]); |
|
548
|
|
|
|
|
|
|
} elsif ($_[3]->[0] == 2) { # 2 = ISINDICATEDBY, add the subject indicators |
|
549
|
|
|
|
|
|
|
$_[0]->{USER}->{store}->internalize ($_[1] => \ $_[3]->[1]); |
|
550
|
|
|
|
|
|
|
} else { |
|
551
|
|
|
|
|
|
|
die "internal fu**up"; |
|
552
|
|
|
|
|
|
|
} |
|
553
|
|
|
|
|
|
|
} |
|
554
|
|
|
|
|
|
|
# assert instance/class |
|
555
|
|
|
|
|
|
|
if (@{$_[2]}) { |
|
556
|
|
|
|
|
|
|
$_[0]->{USER}->{store}->assert ( map { bless |
|
557
|
|
|
|
|
|
|
[ undef, |
|
558
|
|
|
|
|
|
|
undef, |
|
559
|
|
|
|
|
|
|
'isa', |
|
560
|
|
|
|
|
|
|
undef, |
|
561
|
|
|
|
|
|
|
[ 'class', 'instance' ], |
|
562
|
|
|
|
|
|
|
[ $_, $_[1] ], |
|
563
|
|
|
|
|
|
|
], 'Assertion' } |
|
564
|
|
|
|
|
|
|
@{$_[2]} ); |
|
565
|
|
|
|
|
|
|
} |
|
566
|
|
|
|
|
|
|
{ # memorize the types should be a 'topic' |
|
567
|
|
|
|
|
|
|
# at the end (see end of parse) |
|
568
|
|
|
|
|
|
|
my $implicits = $_[0]->{USER}->{implicits}; |
|
569
|
|
|
|
|
|
|
map { $implicits->{'isa-thing'}->{$_}++ } |
|
570
|
|
|
|
|
|
|
(@{$_[2]}, $_[1]); # the types and the ID are declared implicitely |
|
571
|
|
|
|
|
|
|
} |
|
572
|
|
|
|
|
|
|
|
|
573
|
|
|
|
|
|
|
if (ref $_[4]) { # there are inline assocs |
|
574
|
|
|
|
|
|
|
foreach (@{$_[4]}) { |
|
575
|
|
|
|
|
|
|
my $type = $_->[0]; |
|
576
|
|
|
|
|
|
|
my $player = $_->[1]; |
|
577
|
|
|
|
|
|
|
my $store = $_[0]->{USER}->{store}; |
|
578
|
|
|
|
|
|
|
my $templates = $_[0]->{USER}->{templates}; |
|
579
|
|
|
|
|
|
|
if ($type eq 'is-subclass-of' || $type eq 'subclasses') { |
|
580
|
|
|
|
|
|
|
$store->assert (bless [ undef, # LID |
|
581
|
|
|
|
|
|
|
undef, # SCOPE |
|
582
|
|
|
|
|
|
|
'is-subclass-of', # TYPE |
|
583
|
|
|
|
|
|
|
TM->ASSOC, # KIND |
|
584
|
|
|
|
|
|
|
[ 'subclass', 'superclass' ], # ROLES |
|
585
|
|
|
|
|
|
|
[ $_[1], $player ], # PLAYERS |
|
586
|
|
|
|
|
|
|
undef ], 'Assertion' ); |
|
587
|
|
|
|
|
|
|
} elsif ($type eq 'is-a') { |
|
588
|
|
|
|
|
|
|
$store->assert (bless [ undef, # LID |
|
589
|
|
|
|
|
|
|
undef, # SCOPE |
|
590
|
|
|
|
|
|
|
'isa', # TYPE |
|
591
|
|
|
|
|
|
|
TM->ASSOC, # KIND |
|
592
|
|
|
|
|
|
|
[ 'instance', 'class' ], # ROLES |
|
593
|
|
|
|
|
|
|
[ $_[1], $player ], # PLAYERS |
|
594
|
|
|
|
|
|
|
undef ], 'Assertion' ); |
|
595
|
|
|
|
|
|
|
} elsif ($type eq 'has-a') { # same, but other way round |
|
596
|
|
|
|
|
|
|
$store->assert (bless [ undef, # LID |
|
597
|
|
|
|
|
|
|
undef, # SCOPE |
|
598
|
|
|
|
|
|
|
'isa', # TYPE |
|
599
|
|
|
|
|
|
|
TM->ASSOC, # KIND |
|
600
|
|
|
|
|
|
|
[ 'instance', 'class' ], # ROLES |
|
601
|
|
|
|
|
|
|
[ $player, $_[1] ], # PLAYERS |
|
602
|
|
|
|
|
|
|
undef ], 'Assertion' ); |
|
603
|
|
|
|
|
|
|
} elsif ($templates->tids ( $type ) && |
|
604
|
|
|
|
|
|
|
(my @ts = $templates->match (TM->FORALL, type => $templates->tids ( $type ) ))) { |
|
605
|
|
|
|
|
|
|
warn "duplicate template for '$type' found (maybe typo?), taking one" if @ts > 1; |
|
606
|
|
|
|
|
|
|
my $t = $ts[0]; # I choose one |
|
607
|
|
|
|
|
|
|
$store->assert (bless [ undef, # LID |
|
608
|
|
|
|
|
|
|
undef, # SCOPE |
|
609
|
|
|
|
|
|
|
$type, # TYPE |
|
610
|
|
|
|
|
|
|
TM->ASSOC, # KIND |
|
611
|
|
|
|
|
|
|
[ # ROLES |
|
612
|
|
|
|
|
|
|
map { |
|
613
|
|
|
|
|
|
|
my $l = $templates->toplet ($_)->[TM->ADDRESS]; |
|
614
|
|
|
|
|
|
|
($l && $l eq LEFT ? |
|
615
|
|
|
|
|
|
|
$_[1] |
|
616
|
|
|
|
|
|
|
: |
|
617
|
|
|
|
|
|
|
($l && $l eq RIGHT ? |
|
618
|
|
|
|
|
|
|
$player |
|
619
|
|
|
|
|
|
|
: |
|
620
|
|
|
|
|
|
|
$_) |
|
621
|
|
|
|
|
|
|
) |
|
622
|
|
|
|
|
|
|
} @{$t->[TM->ROLES]} |
|
623
|
|
|
|
|
|
|
], |
|
624
|
|
|
|
|
|
|
[ # PLAYERS |
|
625
|
|
|
|
|
|
|
map { |
|
626
|
|
|
|
|
|
|
my $l = $templates->toplet ($_)->[TM->ADDRESS]; |
|
627
|
|
|
|
|
|
|
($l && $l eq LEFT ? |
|
628
|
|
|
|
|
|
|
$_[1] |
|
629
|
|
|
|
|
|
|
: |
|
630
|
|
|
|
|
|
|
($l && $l eq RIGHT ? |
|
631
|
|
|
|
|
|
|
$player |
|
632
|
|
|
|
|
|
|
: |
|
633
|
|
|
|
|
|
|
$_) |
|
634
|
|
|
|
|
|
|
) |
|
635
|
|
|
|
|
|
|
} @{$t->[TM->PLAYERS]} |
|
636
|
|
|
|
|
|
|
], |
|
637
|
|
|
|
|
|
|
undef ], 'Assertion' ); |
|
638
|
|
|
|
|
|
|
} else { |
|
639
|
|
|
|
|
|
|
die "unknown association type '$type' in inlined association"; |
|
640
|
|
|
|
|
|
|
} |
|
641
|
|
|
|
|
|
|
} |
|
642
|
|
|
|
|
|
|
} |
|
643
|
|
|
|
|
|
|
warn "added toplet $_[1]" if $tracing; |
|
644
|
|
|
|
|
|
|
} |
|
645
|
|
|
|
|
|
|
], |
|
646
|
|
|
|
|
|
|
[#Rule 13 |
|
647
|
|
|
|
|
|
|
'topic_definition', 7, |
|
648
|
|
|
|
|
|
|
sub |
|
649
|
|
|
|
|
|
|
#line 163 "yapp/astma-fact.yp" |
|
650
|
|
|
|
|
|
|
{ |
|
651
|
|
|
|
|
|
|
#warn "char/ind in topic: ".Dumper $_[7]; |
|
652
|
|
|
|
|
|
|
my $id = $_[1]; |
|
653
|
|
|
|
|
|
|
# add assertions for every characteristic |
|
654
|
|
|
|
|
|
|
$_[0]->{USER}->{store}->assert ( map {bless [ undef, # LID |
|
655
|
|
|
|
|
|
|
$_->[1], # SCOPE |
|
656
|
|
|
|
|
|
|
$_->[2] || # TYPE |
|
657
|
|
|
|
|
|
|
($_->[0] == TM->NAME ? 'name' : 'occurrence'), |
|
658
|
|
|
|
|
|
|
$_->[0], # KIND |
|
659
|
|
|
|
|
|
|
[ 'thing', 'value' ], # ROLES |
|
660
|
|
|
|
|
|
|
[ $id, $_->[3] ], # PLAYERS |
|
661
|
|
|
|
|
|
|
undef ], 'Assertion' } |
|
662
|
|
|
|
|
|
|
@{$_[7]->[0]} ); |
|
663
|
|
|
|
|
|
|
|
|
664
|
|
|
|
|
|
|
map { $store->internalize ($id => \ $_ ) } @{$_[7]->[1]}; # add the subject indicators |
|
665
|
|
|
|
|
|
|
|
|
666
|
|
|
|
|
|
|
{ # memorize basename types and scopes as implicitely defined |
|
667
|
|
|
|
|
|
|
my $implicits = $_[0]->{USER}->{implicits}; |
|
668
|
|
|
|
|
|
|
map { $implicits->{'isa-scope'}->{$_}++ } |
|
669
|
|
|
|
|
|
|
map { $_->[1] } |
|
670
|
|
|
|
|
|
|
grep ($_->[1], @{$_[7]->[0]}); # get the bloody scopes and tuck them away |
|
671
|
|
|
|
|
|
|
|
|
672
|
|
|
|
|
|
|
map { $implicits->{'subclasses'}->{ $_->[0] == TM->NAME ? 'name' : 'occurrence' }->{$_->[2]}++ } |
|
673
|
|
|
|
|
|
|
grep ($_->[2], @{$_[7]->[0]}); # get all the characteristics with types |
|
674
|
|
|
|
|
|
|
} |
|
675
|
|
|
|
|
|
|
warn "added ".(scalar @{$_[7]->[0]})."characteristics for $_[1]" if $tracing > 1; |
|
676
|
|
|
|
|
|
|
} |
|
677
|
|
|
|
|
|
|
], |
|
678
|
|
|
|
|
|
|
[#Rule 14 |
|
679
|
|
|
|
|
|
|
'reification_indication', 0, undef |
|
680
|
|
|
|
|
|
|
], |
|
681
|
|
|
|
|
|
|
[#Rule 15 |
|
682
|
|
|
|
|
|
|
'reification_indication', 2, |
|
683
|
|
|
|
|
|
|
sub |
|
684
|
|
|
|
|
|
|
#line 193 "yapp/astma-fact.yp" |
|
685
|
|
|
|
|
|
|
{ [ 1, $_[2] ] } |
|
686
|
|
|
|
|
|
|
], |
|
687
|
|
|
|
|
|
|
[#Rule 16 |
|
688
|
|
|
|
|
|
|
'reification_indication', 2, |
|
689
|
|
|
|
|
|
|
sub |
|
690
|
|
|
|
|
|
|
#line 194 "yapp/astma-fact.yp" |
|
691
|
|
|
|
|
|
|
{ [ 0, $_[2] ] } |
|
692
|
|
|
|
|
|
|
], |
|
693
|
|
|
|
|
|
|
[#Rule 17 |
|
694
|
|
|
|
|
|
|
'reification_indication', 2, |
|
695
|
|
|
|
|
|
|
sub |
|
696
|
|
|
|
|
|
|
#line 195 "yapp/astma-fact.yp" |
|
697
|
|
|
|
|
|
|
{ [ 2, $_[2] ] } |
|
698
|
|
|
|
|
|
|
], |
|
699
|
|
|
|
|
|
|
[#Rule 18 |
|
700
|
|
|
|
|
|
|
'types', 0, |
|
701
|
|
|
|
|
|
|
sub |
|
702
|
|
|
|
|
|
|
#line 198 "yapp/astma-fact.yp" |
|
703
|
|
|
|
|
|
|
{ [] } |
|
704
|
|
|
|
|
|
|
], |
|
705
|
|
|
|
|
|
|
[#Rule 19 |
|
706
|
|
|
|
|
|
|
'types', 2, |
|
707
|
|
|
|
|
|
|
sub |
|
708
|
|
|
|
|
|
|
#line 199 "yapp/astma-fact.yp" |
|
709
|
|
|
|
|
|
|
{ push @{$_[1]}, @{$_[2]}; $_[1] } |
|
710
|
|
|
|
|
|
|
], |
|
711
|
|
|
|
|
|
|
[#Rule 20 |
|
712
|
|
|
|
|
|
|
'type', 2, |
|
713
|
|
|
|
|
|
|
sub |
|
714
|
|
|
|
|
|
|
#line 202 "yapp/astma-fact.yp" |
|
715
|
|
|
|
|
|
|
{ [ $_[2] ] } |
|
716
|
|
|
|
|
|
|
], |
|
717
|
|
|
|
|
|
|
[#Rule 21 |
|
718
|
|
|
|
|
|
|
'type', 3, |
|
719
|
|
|
|
|
|
|
sub |
|
720
|
|
|
|
|
|
|
#line 203 "yapp/astma-fact.yp" |
|
721
|
|
|
|
|
|
|
{ $_[2] } |
|
722
|
|
|
|
|
|
|
], |
|
723
|
|
|
|
|
|
|
[#Rule 22 |
|
724
|
|
|
|
|
|
|
'characteristics_indication', 0, undef |
|
725
|
|
|
|
|
|
|
], |
|
726
|
|
|
|
|
|
|
[#Rule 23 |
|
727
|
|
|
|
|
|
|
'characteristics_indication', 2, |
|
728
|
|
|
|
|
|
|
sub |
|
729
|
|
|
|
|
|
|
#line 208 "yapp/astma-fact.yp" |
|
730
|
|
|
|
|
|
|
{ push @{$_[1]->[ ref($_[2]) eq 'ARRAY' ? 0 : 1 ]}, $_[2]; $_[1] } |
|
731
|
|
|
|
|
|
|
], |
|
732
|
|
|
|
|
|
|
[#Rule 24 |
|
733
|
|
|
|
|
|
|
'characteristic_indication', 1, undef |
|
734
|
|
|
|
|
|
|
], |
|
735
|
|
|
|
|
|
|
[#Rule 25 |
|
736
|
|
|
|
|
|
|
'characteristic_indication', 1, undef |
|
737
|
|
|
|
|
|
|
], |
|
738
|
|
|
|
|
|
|
[#Rule 26 |
|
739
|
|
|
|
|
|
|
'@2-1', 0, |
|
740
|
|
|
|
|
|
|
sub |
|
741
|
|
|
|
|
|
|
#line 216 "yapp/astma-fact.yp" |
|
742
|
|
|
|
|
|
|
{ $_[0]->{USER}->{string} ||= "\n" } |
|
743
|
|
|
|
|
|
|
], |
|
744
|
|
|
|
|
|
|
[#Rule 27 |
|
745
|
|
|
|
|
|
|
'indication', 3, |
|
746
|
|
|
|
|
|
|
sub |
|
747
|
|
|
|
|
|
|
#line 217 "yapp/astma-fact.yp" |
|
748
|
|
|
|
|
|
|
{ $_[3] } |
|
749
|
|
|
|
|
|
|
], |
|
750
|
|
|
|
|
|
|
[#Rule 28 |
|
751
|
|
|
|
|
|
|
'@3-1', 0, |
|
752
|
|
|
|
|
|
|
sub |
|
753
|
|
|
|
|
|
|
#line 220 "yapp/astma-fact.yp" |
|
754
|
|
|
|
|
|
|
{ $_[0]->{USER}->{string} ||= "\n" } |
|
755
|
|
|
|
|
|
|
], |
|
756
|
|
|
|
|
|
|
[#Rule 29 |
|
757
|
|
|
|
|
|
|
'characteristic', 5, |
|
758
|
|
|
|
|
|
|
sub |
|
759
|
|
|
|
|
|
|
#line 221 "yapp/astma-fact.yp" |
|
760
|
|
|
|
|
|
|
{ # check whether we are dealing with URIs or strings |
|
761
|
|
|
|
|
|
|
if ($_[1] == TM->NAME) { # names are always strings |
|
762
|
|
|
|
|
|
|
$_[5] = new TM::Literal ($_[5], TM::Literal->STRING); |
|
763
|
|
|
|
|
|
|
} elsif ($_[5] =~ /^\w+:\S+$/) { # can only be OCC, but is it URI? |
|
764
|
|
|
|
|
|
|
$_[5] = new TM::Literal ($_[5], TM::Literal->URI); |
|
765
|
|
|
|
|
|
|
} else { # occurrence and not a URI -> string |
|
766
|
|
|
|
|
|
|
$_[5] = new TM::Literal ($_[5], TM::Literal->STRING); |
|
767
|
|
|
|
|
|
|
} |
|
768
|
|
|
|
|
|
|
## warn "char ".Dumper [ $_[1], $_[3], $_[4], $_[5] ]; |
|
769
|
|
|
|
|
|
|
[ $_[1], $_[3], $_[4], $_[5] ] |
|
770
|
|
|
|
|
|
|
} |
|
771
|
|
|
|
|
|
|
], |
|
772
|
|
|
|
|
|
|
[#Rule 30 |
|
773
|
|
|
|
|
|
|
'class', 1, |
|
774
|
|
|
|
|
|
|
sub |
|
775
|
|
|
|
|
|
|
#line 234 "yapp/astma-fact.yp" |
|
776
|
|
|
|
|
|
|
{ TM->NAME } |
|
777
|
|
|
|
|
|
|
], |
|
778
|
|
|
|
|
|
|
[#Rule 31 |
|
779
|
|
|
|
|
|
|
'class', 1, |
|
780
|
|
|
|
|
|
|
sub |
|
781
|
|
|
|
|
|
|
#line 235 "yapp/astma-fact.yp" |
|
782
|
|
|
|
|
|
|
{ TM->OCC } |
|
783
|
|
|
|
|
|
|
], |
|
784
|
|
|
|
|
|
|
[#Rule 32 |
|
785
|
|
|
|
|
|
|
'class', 1, |
|
786
|
|
|
|
|
|
|
sub |
|
787
|
|
|
|
|
|
|
#line 236 "yapp/astma-fact.yp" |
|
788
|
|
|
|
|
|
|
{ TM->OCC } |
|
789
|
|
|
|
|
|
|
], |
|
790
|
|
|
|
|
|
|
[#Rule 33 |
|
791
|
|
|
|
|
|
|
'char_type', 0, undef |
|
792
|
|
|
|
|
|
|
], |
|
793
|
|
|
|
|
|
|
[#Rule 34 |
|
794
|
|
|
|
|
|
|
'char_type', 1, undef |
|
795
|
|
|
|
|
|
|
], |
|
796
|
|
|
|
|
|
|
[#Rule 35 |
|
797
|
|
|
|
|
|
|
'assoc_type', 3, |
|
798
|
|
|
|
|
|
|
sub |
|
799
|
|
|
|
|
|
|
#line 243 "yapp/astma-fact.yp" |
|
800
|
|
|
|
|
|
|
{ $_[2] } |
|
801
|
|
|
|
|
|
|
], |
|
802
|
|
|
|
|
|
|
[#Rule 36 |
|
803
|
|
|
|
|
|
|
'scope', 0, undef |
|
804
|
|
|
|
|
|
|
], |
|
805
|
|
|
|
|
|
|
[#Rule 37 |
|
806
|
|
|
|
|
|
|
'scope', 2, |
|
807
|
|
|
|
|
|
|
sub |
|
808
|
|
|
|
|
|
|
#line 247 "yapp/astma-fact.yp" |
|
809
|
|
|
|
|
|
|
{ $_[2] } |
|
810
|
|
|
|
|
|
|
], |
|
811
|
|
|
|
|
|
|
[#Rule 38 |
|
812
|
|
|
|
|
|
|
'inline_assocs', 0, undef |
|
813
|
|
|
|
|
|
|
], |
|
814
|
|
|
|
|
|
|
[#Rule 39 |
|
815
|
|
|
|
|
|
|
'inline_assocs', 2, |
|
816
|
|
|
|
|
|
|
sub |
|
817
|
|
|
|
|
|
|
#line 252 "yapp/astma-fact.yp" |
|
818
|
|
|
|
|
|
|
{ push @{$_[1]}, $_[2]; $_[1] } |
|
819
|
|
|
|
|
|
|
], |
|
820
|
|
|
|
|
|
|
[#Rule 40 |
|
821
|
|
|
|
|
|
|
'inline_assoc', 2, |
|
822
|
|
|
|
|
|
|
sub |
|
823
|
|
|
|
|
|
|
#line 255 "yapp/astma-fact.yp" |
|
824
|
|
|
|
|
|
|
{ [ $_[1], $_[2] ] } |
|
825
|
|
|
|
|
|
|
], |
|
826
|
|
|
|
|
|
|
[#Rule 41 |
|
827
|
|
|
|
|
|
|
'@4-1', 0, |
|
828
|
|
|
|
|
|
|
sub |
|
829
|
|
|
|
|
|
|
#line 259 "yapp/astma-fact.yp" |
|
830
|
|
|
|
|
|
|
{ ($_[0]->{USER}->{templates}, $_[0]->{USER}->{store}) = ($_[0]->{USER}->{store}, $_[0]->{USER}->{templates}); } |
|
831
|
|
|
|
|
|
|
], |
|
832
|
|
|
|
|
|
|
[#Rule 42 |
|
833
|
|
|
|
|
|
|
'template_definition', 3, |
|
834
|
|
|
|
|
|
|
sub |
|
835
|
|
|
|
|
|
|
#line 262 "yapp/astma-fact.yp" |
|
836
|
|
|
|
|
|
|
{ ($_[0]->{USER}->{templates}, $_[0]->{USER}->{store}) = ($_[0]->{USER}->{store}, $_[0]->{USER}->{templates}); } |
|
837
|
|
|
|
|
|
|
], |
|
838
|
|
|
|
|
|
|
[#Rule 43 |
|
839
|
|
|
|
|
|
|
'association_definition', 7, |
|
840
|
|
|
|
|
|
|
sub |
|
841
|
|
|
|
|
|
|
#line 268 "yapp/astma-fact.yp" |
|
842
|
|
|
|
|
|
|
{ |
|
843
|
|
|
|
|
|
|
##warn "members ".Dumper $_[5]; |
|
844
|
|
|
|
|
|
|
## ??? TODO SCOPE ???? |
|
845
|
|
|
|
|
|
|
my (@roles, @players); |
|
846
|
|
|
|
|
|
|
foreach my $m (@{$_[7]}) { # one member |
|
847
|
|
|
|
|
|
|
my $role = shift @$m; # first is role |
|
848
|
|
|
|
|
|
|
|
|
849
|
|
|
|
|
|
|
while (@$m) { |
|
850
|
|
|
|
|
|
|
push @roles, $role; # roles repeat for every player |
|
851
|
|
|
|
|
|
|
my $player = shift @$m; |
|
852
|
|
|
|
|
|
|
push @players, $player; |
|
853
|
|
|
|
|
|
|
} |
|
854
|
|
|
|
|
|
|
} |
|
855
|
|
|
|
|
|
|
my ($a) = $_[0]->{USER}->{store}->assert (bless [ undef, $_[4], $_[2], TM->ASSOC, \@roles, \@players, undef ], 'Assertion'); |
|
856
|
|
|
|
|
|
|
##warn "templates" .Dumper $_[0]->{USER}->{store}; |
|
857
|
|
|
|
|
|
|
{ # reification |
|
858
|
|
|
|
|
|
|
my $ms = $_[0]->{USER}->{store}; |
|
859
|
|
|
|
|
|
|
if (ref $_[5]) { |
|
860
|
|
|
|
|
|
|
if ($_[5]->[0] == 1) { # 1 = REIFIES, 0 = IS-REIFIED |
|
861
|
|
|
|
|
|
|
# (assoc) reifies http://.... means |
|
862
|
|
|
|
|
|
|
# 1) the assoc will be addes as thing (is done already) |
|
863
|
|
|
|
|
|
|
# 2) the http:// will be used as one subject indicator |
|
864
|
|
|
|
|
|
|
die "reifier of association must be a URI" unless $_[5]->[1] =~ /^\w+:.+/; |
|
865
|
|
|
|
|
|
|
$ms->internalize ($a->[TM::LID], $_[5]->[1]); |
|
866
|
|
|
|
|
|
|
} elsif ($_[5]->[0] == 0) { # something reifies this assoc |
|
867
|
|
|
|
|
|
|
# (assoc) is-reified-by xxx means |
|
868
|
|
|
|
|
|
|
# 1) assoc is added as thing (is done already) |
|
869
|
|
|
|
|
|
|
# 2) the local identifier is added as thing with the abs URL of the assoc as subject address |
|
870
|
|
|
|
|
|
|
die "reifier must be local identifier" unless $_[5]->[1] =~ /^[A-Za-z][A-Za-z0-9_\.-]+$/; |
|
871
|
|
|
|
|
|
|
$ms->internalize ($_[5]->[1] => $a); |
|
872
|
|
|
|
|
|
|
} else { # this would be 'indication' but we do not want that here |
|
873
|
|
|
|
|
|
|
die "indication for associations are undefined"; |
|
874
|
|
|
|
|
|
|
} |
|
875
|
|
|
|
|
|
|
} |
|
876
|
|
|
|
|
|
|
} |
|
877
|
|
|
|
|
|
|
|
|
878
|
|
|
|
|
|
|
{ # memorize that association type subclasses association |
|
879
|
|
|
|
|
|
|
# my $implicits = $_[0]->{USER}->{implicits}; |
|
880
|
|
|
|
|
|
|
|
|
881
|
|
|
|
|
|
|
# implicit $implicits->{'subclasses'}->{'association'}->{$_[2]}++; |
|
882
|
|
|
|
|
|
|
$_[0]->{USER}->{implicits}->{'isa-scope'}->{$_[4]}++ if $_[4]; |
|
883
|
|
|
|
|
|
|
} |
|
884
|
|
|
|
|
|
|
warn "added assertion $_[2]" if $tracing; |
|
885
|
|
|
|
|
|
|
} |
|
886
|
|
|
|
|
|
|
], |
|
887
|
|
|
|
|
|
|
[#Rule 44 |
|
888
|
|
|
|
|
|
|
'association_members', 1, |
|
889
|
|
|
|
|
|
|
sub |
|
890
|
|
|
|
|
|
|
#line 314 "yapp/astma-fact.yp" |
|
891
|
|
|
|
|
|
|
{ [ $_[1] ] } |
|
892
|
|
|
|
|
|
|
], |
|
893
|
|
|
|
|
|
|
[#Rule 45 |
|
894
|
|
|
|
|
|
|
'association_members', 2, |
|
895
|
|
|
|
|
|
|
sub |
|
896
|
|
|
|
|
|
|
#line 315 "yapp/astma-fact.yp" |
|
897
|
|
|
|
|
|
|
{ push @{$_[1]}, $_[2]; $_[1] } |
|
898
|
|
|
|
|
|
|
], |
|
899
|
|
|
|
|
|
|
[#Rule 46 |
|
900
|
|
|
|
|
|
|
'member', 4, |
|
901
|
|
|
|
|
|
|
sub |
|
902
|
|
|
|
|
|
|
#line 318 "yapp/astma-fact.yp" |
|
903
|
|
|
|
|
|
|
{ [ $_[1], @{$_[3]} ] } |
|
904
|
|
|
|
|
|
|
], |
|
905
|
|
|
|
|
|
|
[#Rule 47 |
|
906
|
|
|
|
|
|
|
'eom', 1, undef |
|
907
|
|
|
|
|
|
|
], |
|
908
|
|
|
|
|
|
|
[#Rule 48 |
|
909
|
|
|
|
|
|
|
'eom', 2, undef |
|
910
|
|
|
|
|
|
|
], |
|
911
|
|
|
|
|
|
|
[#Rule 49 |
|
912
|
|
|
|
|
|
|
'ids1', 2, |
|
913
|
|
|
|
|
|
|
sub |
|
914
|
|
|
|
|
|
|
#line 325 "yapp/astma-fact.yp" |
|
915
|
|
|
|
|
|
|
{ push @{$_[1]}, $_[2]; $_[1] } |
|
916
|
|
|
|
|
|
|
], |
|
917
|
|
|
|
|
|
|
[#Rule 50 |
|
918
|
|
|
|
|
|
|
'ids', 0, |
|
919
|
|
|
|
|
|
|
sub |
|
920
|
|
|
|
|
|
|
#line 328 "yapp/astma-fact.yp" |
|
921
|
|
|
|
|
|
|
{ [] } |
|
922
|
|
|
|
|
|
|
], |
|
923
|
|
|
|
|
|
|
[#Rule 51 |
|
924
|
|
|
|
|
|
|
'ids', 2, |
|
925
|
|
|
|
|
|
|
sub |
|
926
|
|
|
|
|
|
|
#line 329 "yapp/astma-fact.yp" |
|
927
|
|
|
|
|
|
|
{ push @{$_[1]}, $_[2]; $_[1] } |
|
928
|
|
|
|
|
|
|
], |
|
929
|
|
|
|
|
|
|
[#Rule 52 |
|
930
|
|
|
|
|
|
|
'string', 2, |
|
931
|
|
|
|
|
|
|
sub |
|
932
|
|
|
|
|
|
|
#line 332 "yapp/astma-fact.yp" |
|
933
|
|
|
|
|
|
|
{ die "empty string in characteristics" unless $_[1]; $_[1] } |
|
934
|
|
|
|
|
|
|
] |
|
935
|
|
|
|
|
|
|
], |
|
936
|
|
|
|
|
|
|
%options); |
|
937
|
|
|
|
|
|
|
$self->{USER}->{store} = $store; |
|
938
|
|
|
|
|
|
|
return bless $self, $class; |
|
939
|
|
|
|
|
|
|
} |
|
940
|
|
|
|
|
|
|
|
|
941
|
|
|
|
|
|
|
#line 335 "yapp/astma-fact.yp" |
|
942
|
|
|
|
|
|
|
|
|
943
|
|
|
|
|
|
|
|
|
944
|
|
|
|
|
|
|
sub _Error { |
|
945
|
|
|
|
|
|
|
die "Syntax error: Found ".$_[0]->YYCurtok." but expected ".join (' or ', $_[0]->YYExpect); |
|
946
|
|
|
|
|
|
|
} |
|
947
|
|
|
|
|
|
|
|
|
948
|
|
|
|
|
|
|
use constant CHUNK_SIZE => 32000; |
|
949
|
|
|
|
|
|
|
|
|
950
|
|
|
|
|
|
|
sub _Lexer { |
|
951
|
|
|
|
|
|
|
my $parser = shift; |
|
952
|
|
|
|
|
|
|
my $yydata = $parser->YYData; |
|
953
|
|
|
|
|
|
|
|
|
954
|
|
|
|
|
|
|
if (length ($yydata->{INPUT}) < 1024 && $yydata->{OFFSET} < $yydata->{TOTAL}) { |
|
955
|
|
|
|
|
|
|
$yydata->{INPUT} .= substr ($yydata->{RESERVE}, $yydata->{OFFSET}, CHUNK_SIZE); |
|
956
|
|
|
|
|
|
|
$yydata->{OFFSET} += CHUNK_SIZE; |
|
957
|
|
|
|
|
|
|
} |
|
958
|
|
|
|
|
|
|
my $refINPUT = \$yydata->{INPUT}; |
|
959
|
|
|
|
|
|
|
|
|
960
|
|
|
|
|
|
|
my $aux; # need this to store identifier/uri prefix for optimization |
|
961
|
|
|
|
|
|
|
|
|
962
|
|
|
|
|
|
|
$$refINPUT or return ('', undef); |
|
963
|
|
|
|
|
|
|
$$refINPUT =~ s/^[ \t]+//so; |
|
964
|
|
|
|
|
|
|
|
|
965
|
|
|
|
|
|
|
#warn "lexer ($parser->{USER}->{string}):>>>".$parser->YYData->{INPUT}."<<<"; |
|
966
|
|
|
|
|
|
|
|
|
967
|
|
|
|
|
|
|
$$refINPUT =~ s/^\n//so and return ('EOL', undef); |
|
968
|
|
|
|
|
|
|
$$refINPUT =~ s/^in\b(?![\.-])//o and return ('IN', undef); |
|
969
|
|
|
|
|
|
|
$$refINPUT =~ s/^rd\b(?![\.-])//o and return ('IN', undef); |
|
970
|
|
|
|
|
|
|
$$refINPUT =~ s/^oc\b(?![\.-])//o and return ('OC', undef); |
|
971
|
|
|
|
|
|
|
$$refINPUT =~ s/^ex\b(?![\.-])//o and return ('OC', undef); |
|
972
|
|
|
|
|
|
|
$$refINPUT =~ s/^bn\b(?![\.-])//o and return ('BN', undef); |
|
973
|
|
|
|
|
|
|
|
|
974
|
|
|
|
|
|
|
$$refINPUT =~ s/^sin\b(?![\.-])//o and return ('SIN', undef); |
|
975
|
|
|
|
|
|
|
$$refINPUT =~ s/^is-a\b(?![\.-])//o and return ('ISA', undef); |
|
976
|
|
|
|
|
|
|
$$refINPUT =~ s/^reifies\b(?![\.-])//o and return ('REIFIES', undef); |
|
977
|
|
|
|
|
|
|
$$refINPUT =~ s/^=//o and return ('REIFIES', undef); |
|
978
|
|
|
|
|
|
|
$$refINPUT =~ s/^is-reified-by\b(?![\.-])//o and return ('ISREIFIED', undef); |
|
979
|
|
|
|
|
|
|
$$refINPUT =~ s/^~//o and return ('ISINDICATEDBY', undef); |
|
980
|
|
|
|
|
|
|
|
|
981
|
|
|
|
|
|
|
if (my $t = $parser->{USER}->{string}) { # parser said we should expect a string now, defaults terminator to \n |
|
982
|
|
|
|
|
|
|
##warn "scanning for string (..$t..) in ...". $$refINPUT . "...."; |
|
983
|
|
|
|
|
|
|
$$refINPUT =~ s/^:\s*<<<\n/:/o and # we know it better, it is <<< |
|
984
|
|
|
|
|
|
|
$t = "\n<<<\n"; |
|
985
|
|
|
|
|
|
|
|
|
986
|
|
|
|
|
|
|
$$refINPUT =~ s/^:\s*<<(\w+)\n/:/o and # we know it better, it is <
|
|
987
|
|
|
|
|
|
|
$t = "\n<<$1\n"; |
|
988
|
|
|
|
|
|
|
|
|
989
|
|
|
|
|
|
|
##warn "try finding string ..$t.. " ; |
|
990
|
|
|
|
|
|
|
$$refINPUT =~ s/^:\s*(.*?)\s*$t/\n/s and |
|
991
|
|
|
|
|
|
|
## (warn "returning $1" or 1) and |
|
992
|
|
|
|
|
|
|
(undef $parser->{USER}->{string} or return ('STRING', $1)); |
|
993
|
|
|
|
|
|
|
##warn "no string"; |
|
994
|
|
|
|
|
|
|
} |
|
995
|
|
|
|
|
|
|
|
|
996
|
|
|
|
|
|
|
$$refINPUT =~ s/^://o and return ('COLON', undef); |
|
997
|
|
|
|
|
|
|
|
|
998
|
|
|
|
|
|
|
## unfortunately, this does not what I want |
|
999
|
|
|
|
|
|
|
## $$refINPUT =~ s/^([A-Za-z][A-Za-z0-9_-]*)(?!:)//o and return ('ID', $1); # negative look-ahead |
|
1000
|
|
|
|
|
|
|
## tricky optimization: don't ask |
|
1001
|
|
|
|
|
|
|
$$refINPUT =~ s/^([A-Za-z][.A-Za-z0-9_-]*)//o and $aux = $1 # save this for later |
|
1002
|
|
|
|
|
|
|
and $$refINPUT !~ /^:[\w\/]/ |
|
1003
|
|
|
|
|
|
|
and return ('ID', $aux); |
|
1004
|
|
|
|
|
|
|
|
|
1005
|
|
|
|
|
|
|
$$refINPUT =~ s/^\(//so and return ('LPAREN', undef); |
|
1006
|
|
|
|
|
|
|
$$refINPUT =~ s/^\)//so and return ('RPAREN', undef); |
|
1007
|
|
|
|
|
|
|
$$refINPUT =~ s/^@//so and return ('AT', undef); |
|
1008
|
|
|
|
|
|
|
|
|
1009
|
|
|
|
|
|
|
$$refINPUT =~ s/^(:[^\s\)\(\]\[]+)//o and return ('ID', $aux.$1); # is a URL/URN actually |
|
1010
|
|
|
|
|
|
|
|
|
1011
|
|
|
|
|
|
|
$$refINPUT =~ s/^(\d{4}-\d{1,2}-\d{1,2})(\s+(\d{1,2}):(\d{2}))?//o |
|
1012
|
|
|
|
|
|
|
and return ('ID', sprintf "urn:x-date:%s:%02d:%02d", $1, $3 || 0, $4 || 0); # is a date |
|
1013
|
|
|
|
|
|
|
|
|
1014
|
|
|
|
|
|
|
$$refINPUT =~ s/^%log\s+(.*?)(?=\n)//so and return ('LOG', $1); # positive look-ahead |
|
1015
|
|
|
|
|
|
|
$$refINPUT =~ s/^%cancel\s*(?=\n)//so and return ('CANCEL', $1); # positive look-ahead |
|
1016
|
|
|
|
|
|
|
$$refINPUT =~ s/^%trace\s+(.*?)(?=\n)//so and return ('TRACE', $1); # positive look-ahead |
|
1017
|
|
|
|
|
|
|
$$refINPUT =~ s/^%encoding\s+(.*?)(?=\n)//so and return ('ENCODING', $1); # positive look-ahead |
|
1018
|
|
|
|
|
|
|
|
|
1019
|
|
|
|
|
|
|
$$refINPUT =~ s/^\*//o and return ('ID', sprintf "uuid-%010d", $TM::toplet_ctr++); ## $parser->{USER}->{topic_count}++); |
|
1020
|
|
|
|
|
|
|
|
|
1021
|
|
|
|
|
|
|
$$refINPUT =~ s/^\[//so and return ('LBRACKET', undef); |
|
1022
|
|
|
|
|
|
|
$$refINPUT =~ s/^\]//so and return ('RBRACKET', undef); |
|
1023
|
|
|
|
|
|
|
# should not be an issue except on error |
|
1024
|
|
|
|
|
|
|
$$refINPUT =~ s/^(.)//so and return ($1, $1); |
|
1025
|
|
|
|
|
|
|
|
|
1026
|
|
|
|
|
|
|
} |
|
1027
|
|
|
|
|
|
|
|
|
1028
|
|
|
|
|
|
|
sub parse { |
|
1029
|
|
|
|
|
|
|
my $self = shift; |
|
1030
|
|
|
|
|
|
|
$_ = shift; |
|
1031
|
|
|
|
|
|
|
|
|
1032
|
|
|
|
|
|
|
s/\r\n/\n/sg; |
|
1033
|
|
|
|
|
|
|
s/\r/\n/sg; |
|
1034
|
|
|
|
|
|
|
s/(?
|
|
1035
|
|
|
|
|
|
|
s/ \~ /\n/g; # replace _~_ with \n |
|
1036
|
|
|
|
|
|
|
s/ \~\~ / \~ /g; # stuffed ~~ cleanout |
|
1037
|
|
|
|
|
|
|
s/^\#.*?\n/\n/mg; # # at the start of every line -> gone |
|
1038
|
|
|
|
|
|
|
s/\s\#.*?\n/\n/mg; # anything which starts with # -> gone |
|
1039
|
|
|
|
|
|
|
s/(?
|
|
1040
|
|
|
|
|
|
|
s/\n\n\n+/\n\n/sg; # canonicalize line break (line count is gone already) |
|
1041
|
|
|
|
|
|
|
|
|
1042
|
|
|
|
|
|
|
# we not only capture what is said EXPLICITELY in the map, we also collect implicit knowledge |
|
1043
|
|
|
|
|
|
|
# we could add this immediately into the map at parsing, but it would slow the process down and |
|
1044
|
|
|
|
|
|
|
# it would probably duplicate/complicate things |
|
1045
|
|
|
|
|
|
|
$self->{USER}->{implicits} = { |
|
1046
|
|
|
|
|
|
|
'isa-thing' => undef, # just let them spring into existence |
|
1047
|
|
|
|
|
|
|
'isa-scope' => undef, # just let them spring into existence |
|
1048
|
|
|
|
|
|
|
'subclasses' => undef |
|
1049
|
|
|
|
|
|
|
}; |
|
1050
|
|
|
|
|
|
|
# clone a pseudo map into which to store templates as assocs temporarily |
|
1051
|
|
|
|
|
|
|
$self->{USER}->{templates} = new TM (baseuri => $self->{USER}->{store}->baseuri); |
|
1052
|
|
|
|
|
|
|
|
|
1053
|
|
|
|
|
|
|
$self->YYData->{INPUT} = ''; |
|
1054
|
|
|
|
|
|
|
$self->YYData->{RESERVE} = $_; # here we park the whole string |
|
1055
|
|
|
|
|
|
|
$self->YYData->{TOTAL} = length ($_); # this is how much we have in the reserve |
|
1056
|
|
|
|
|
|
|
$self->YYData->{OFFSET} = 0; # and we start at index 0 |
|
1057
|
|
|
|
|
|
|
|
|
1058
|
|
|
|
|
|
|
eval { |
|
1059
|
|
|
|
|
|
|
$self->YYParse ( yylex => \&_Lexer, yyerror => \&_Error ); |
|
1060
|
|
|
|
|
|
|
}; if ($@ =~ /^Cancelled/) { |
|
1061
|
|
|
|
|
|
|
warn $@; # de-escalate Cancelling to warning |
|
1062
|
|
|
|
|
|
|
} elsif ($@) { |
|
1063
|
|
|
|
|
|
|
die $@; # otherwise re-raise the exception |
|
1064
|
|
|
|
|
|
|
} |
|
1065
|
|
|
|
|
|
|
|
|
1066
|
|
|
|
|
|
|
|
|
1067
|
|
|
|
|
|
|
{ # resolving implicit stuff |
|
1068
|
|
|
|
|
|
|
my $implicits = $self->{USER}->{implicits}; |
|
1069
|
|
|
|
|
|
|
my $store = $self->{USER}->{store}; |
|
1070
|
|
|
|
|
|
|
|
|
1071
|
|
|
|
|
|
|
{ # all super/subclasses |
|
1072
|
|
|
|
|
|
|
foreach my $superclass (keys %{$implicits->{'subclasses'}}) { |
|
1073
|
|
|
|
|
|
|
$store->assert ( map { |
|
1074
|
|
|
|
|
|
|
bless [ undef, undef, 'is-subclass-of', TM->ASSOC, [ 'superclass', 'subclass' ], [ $superclass, $_ ] ], 'Assertion' |
|
1075
|
|
|
|
|
|
|
} keys %{$implicits->{'subclasses'}->{$superclass}}); |
|
1076
|
|
|
|
|
|
|
} |
|
1077
|
|
|
|
|
|
|
#warn "done with subclasses"; |
|
1078
|
|
|
|
|
|
|
} |
|
1079
|
|
|
|
|
|
|
{ # all things in isa-things are THINGS, simply add them |
|
1080
|
|
|
|
|
|
|
##warn "isa things ".Dumper [keys %{$implicits->{'isa-thing'}}]; |
|
1081
|
|
|
|
|
|
|
$store->internalize (map { $_ => undef } keys %{$implicits->{'isa-thing'}}); |
|
1082
|
|
|
|
|
|
|
} |
|
1083
|
|
|
|
|
|
|
{ # establishing the scoping topics |
|
1084
|
|
|
|
|
|
|
$store->assert (map { |
|
1085
|
|
|
|
|
|
|
bless [ undef, undef, 'isa', TM->ASSOC, [ 'class', 'instance' ], [ 'scope', $_ ] ], 'Assertion' |
|
1086
|
|
|
|
|
|
|
} keys %{$implicits->{'isa-scope'}}); |
|
1087
|
|
|
|
|
|
|
} |
|
1088
|
|
|
|
|
|
|
} |
|
1089
|
|
|
|
|
|
|
|
|
1090
|
|
|
|
|
|
|
return $self->{USER}->{store}; |
|
1091
|
|
|
|
|
|
|
} |
|
1092
|
|
|
|
|
|
|
|
|
1093
|
|
|
|
|
|
|
#my $f = new TM::AsTMa::Fact; |
|
1094
|
|
|
|
|
|
|
#$f->Run; |
|
1095
|
|
|
|
|
|
|
|
|
1096
|
|
|
|
|
|
|
|
|
1097
|
|
|
|
|
|
|
1; |