diff options
Diffstat (limited to 'LuaSL/src/LuaSL_LSL_yaccer.y')
-rw-r--r-- | LuaSL/src/LuaSL_LSL_yaccer.y | 1474 |
1 files changed, 0 insertions, 1474 deletions
diff --git a/LuaSL/src/LuaSL_LSL_yaccer.y b/LuaSL/src/LuaSL_LSL_yaccer.y deleted file mode 100644 index 8cc433d..0000000 --- a/LuaSL/src/LuaSL_LSL_yaccer.y +++ /dev/null | |||
@@ -1,1474 +0,0 @@ | |||
1 | %{ | ||
2 | |||
3 | #include "LuaSL_LSL_tree.h" | ||
4 | |||
5 | //int yylex(void); | ||
6 | //int yyparse( void ); | ||
7 | //int yyerror(const char *fmt, ...); | ||
8 | |||
9 | #if LL_LINUX | ||
10 | // broken yacc codegen... --ryan. | ||
11 | #define getenv getenv_workaround | ||
12 | #endif | ||
13 | |||
14 | #ifdef LL_WINDOWS | ||
15 | #pragma warning (disable : 4702) // warning C4702: unreachable code | ||
16 | #pragma warning( disable : 4065 ) // warning: switch statement contains 'default' but no 'case' labels | ||
17 | #endif | ||
18 | |||
19 | %} | ||
20 | |||
21 | |||
22 | %token INTEGER | ||
23 | %token FLOAT_TYPE | ||
24 | %token STRING | ||
25 | %token LLKEY | ||
26 | %token VECTOR | ||
27 | %token QUATERNION | ||
28 | %token LIST | ||
29 | |||
30 | %token STATE | ||
31 | %token EVENT | ||
32 | %token JUMP | ||
33 | %token RETURN | ||
34 | |||
35 | %token STATE_ENTRY | ||
36 | %token STATE_EXIT | ||
37 | %token TOUCH_START | ||
38 | %token TOUCH | ||
39 | %token TOUCH_END | ||
40 | %token COLLISION_START | ||
41 | %token COLLISION | ||
42 | %token COLLISION_END | ||
43 | %token LAND_COLLISION_START | ||
44 | %token LAND_COLLISION | ||
45 | %token LAND_COLLISION_END | ||
46 | %token TIMER | ||
47 | %token CHAT | ||
48 | %token SENSOR | ||
49 | %token NO_SENSOR | ||
50 | %token CONTROL | ||
51 | %token AT_TARGET | ||
52 | %token NOT_AT_TARGET | ||
53 | %token AT_ROT_TARGET | ||
54 | %token NOT_AT_ROT_TARGET | ||
55 | %token MONEY | ||
56 | %token EMAIL | ||
57 | %token RUN_TIME_PERMISSIONS | ||
58 | %token INVENTORY | ||
59 | %token ATTACH | ||
60 | %token DATASERVER | ||
61 | %token MOVING_START | ||
62 | %token MOVING_END | ||
63 | %token REZ | ||
64 | %token OBJECT_REZ | ||
65 | %token LINK_MESSAGE | ||
66 | %token REMOTE_DATA | ||
67 | %token HTTP_RESPONSE | ||
68 | %token HTTP_REQUEST | ||
69 | |||
70 | %token <sval> IDENTIFIER | ||
71 | %token <sval> STATE_DEFAULT | ||
72 | |||
73 | %token <ival> INTEGER_CONSTANT | ||
74 | %token <ival> INTEGER_TRUE | ||
75 | %token <ival> INTEGER_FALSE | ||
76 | |||
77 | %token <fval> FP_CONSTANT | ||
78 | |||
79 | %token <sval> STRING_CONSTANT | ||
80 | |||
81 | %token INC_OP | ||
82 | %token DEC_OP | ||
83 | %token ADD_ASSIGN | ||
84 | %token SUB_ASSIGN | ||
85 | %token MUL_ASSIGN | ||
86 | %token DIV_ASSIGN | ||
87 | %token MOD_ASSIGN | ||
88 | |||
89 | %token EQ | ||
90 | %token NEQ | ||
91 | %token GEQ | ||
92 | %token LEQ | ||
93 | |||
94 | %token BOOLEAN_AND | ||
95 | %token BOOLEAN_OR | ||
96 | |||
97 | %token SHIFT_LEFT | ||
98 | %token SHIFT_RIGHT | ||
99 | |||
100 | %token IF | ||
101 | %token ELSE | ||
102 | %token FOR | ||
103 | %token DO | ||
104 | %token WHILE | ||
105 | |||
106 | %token PRINT | ||
107 | |||
108 | %token PERIOD | ||
109 | |||
110 | %token ZERO_VECTOR | ||
111 | %token ZERO_ROTATION | ||
112 | |||
113 | %token TOUCH_INVALID_VECTOR | ||
114 | %token TOUCH_INVALID_TEXCOORD | ||
115 | |||
116 | %nonassoc LOWER_THAN_ELSE | ||
117 | %nonassoc ELSE | ||
118 | |||
119 | |||
120 | %type <script> lscript_program | ||
121 | %type <global_store> globals | ||
122 | %type <global_store> global | ||
123 | %type <global> global_variable | ||
124 | %type <assignable> simple_assignable | ||
125 | %type <assignable> simple_assignable_no_list | ||
126 | %type <constant> constant | ||
127 | %type <ival> integer_constant | ||
128 | %type <fval> fp_constant | ||
129 | %type <assignable> special_constant | ||
130 | %type <assignable> vector_constant | ||
131 | %type <assignable> quaternion_constant | ||
132 | %type <assignable> list_constant | ||
133 | %type <assignable> list_entries | ||
134 | %type <assignable> list_entry | ||
135 | %type <type> typename | ||
136 | %type <global_funcs> global_function | ||
137 | %type <global_decl> function_parameters | ||
138 | %type <global_decl> function_parameter | ||
139 | %type <state> states | ||
140 | %type <state> other_states | ||
141 | %type <state> default | ||
142 | %type <state> state | ||
143 | %type <handler> state_body | ||
144 | %type <handler> event | ||
145 | %type <event> state_entry | ||
146 | %type <event> state_exit | ||
147 | %type <event> touch_start | ||
148 | %type <event> touch | ||
149 | %type <event> touch_end | ||
150 | %type <event> collision_start | ||
151 | %type <event> collision | ||
152 | %type <event> collision_end | ||
153 | %type <event> land_collision_start | ||
154 | %type <event> land_collision | ||
155 | %type <event> land_collision_end | ||
156 | %type <event> at_target | ||
157 | %type <event> not_at_target | ||
158 | %type <event> at_rot_target | ||
159 | %type <event> not_at_rot_target | ||
160 | %type <event> money | ||
161 | %type <event> email | ||
162 | %type <event> run_time_permissions | ||
163 | %type <event> inventory | ||
164 | %type <event> attach | ||
165 | %type <event> dataserver | ||
166 | %type <event> moving_start | ||
167 | %type <event> moving_end | ||
168 | %type <event> rez | ||
169 | %type <event> object_rez | ||
170 | %type <event> remote_data | ||
171 | %type <event> http_response | ||
172 | %type <event> http_request | ||
173 | %type <event> link_message | ||
174 | %type <event> timer | ||
175 | %type <event> chat | ||
176 | %type <event> sensor | ||
177 | %type <event> no_sensor | ||
178 | %type <event> control | ||
179 | %type <statement> compound_statement | ||
180 | %type <statement> statement | ||
181 | %type <statement> statements | ||
182 | %type <statement> declaration | ||
183 | %type <statement> ';' | ||
184 | %type <statement> '@' | ||
185 | %type <expression> nextforexpressionlist | ||
186 | %type <expression> forexpressionlist | ||
187 | %type <expression> nextfuncexpressionlist | ||
188 | %type <expression> funcexpressionlist | ||
189 | %type <expression> nextlistexpressionlist | ||
190 | %type <expression> listexpressionlist | ||
191 | %type <expression> unarypostfixexpression | ||
192 | %type <expression> vector_initializer | ||
193 | %type <expression> quaternion_initializer | ||
194 | %type <expression> list_initializer | ||
195 | %type <expression> lvalue | ||
196 | %type <expression> '-' | ||
197 | %type <expression> '!' | ||
198 | %type <expression> '~' | ||
199 | %type <expression> '=' | ||
200 | %type <expression> '<' | ||
201 | %type <expression> '>' | ||
202 | %type <expression> '+' | ||
203 | %type <expression> '*' | ||
204 | %type <expression> '/' | ||
205 | %type <expression> '%' | ||
206 | %type <expression> '&' | ||
207 | %type <expression> '|' | ||
208 | %type <expression> '^' | ||
209 | %type <expression> ADD_ASSIGN | ||
210 | %type <expression> SUB_ASSIGN | ||
211 | %type <expression> MUL_ASSIGN | ||
212 | %type <expression> DIV_ASSIGN | ||
213 | %type <expression> MOD_ASSIGN | ||
214 | %type <expression> EQ | ||
215 | %type <expression> NEQ | ||
216 | %type <expression> LEQ | ||
217 | %type <expression> GEQ | ||
218 | %type <expression> BOOLEAN_AND | ||
219 | %type <expression> BOOLEAN_OR | ||
220 | %type <expression> SHIFT_LEFT | ||
221 | %type <expression> SHIFT_RIGHT | ||
222 | %type <expression> INC_OP | ||
223 | %type <expression> DEC_OP | ||
224 | %type <expression> '(' | ||
225 | %type <expression> ')' | ||
226 | %type <expression> PRINT | ||
227 | %type <identifier> name_type | ||
228 | %type <expression> expression | ||
229 | %type <expression> unaryexpression | ||
230 | %type <expression> typecast | ||
231 | |||
232 | %right '=' MUL_ASSIGN DIV_ASSIGN MOD_ASSIGN ADD_ASSIGN SUB_ASSIGN | ||
233 | %left BOOLEAN_AND BOOLEAN_OR | ||
234 | %left '|' | ||
235 | %left '^' | ||
236 | %left '&' | ||
237 | %left EQ NEQ | ||
238 | %left '<' LEQ '>' GEQ | ||
239 | %left SHIFT_LEFT SHIFT_RIGHT | ||
240 | %left '+' '-' | ||
241 | %left '*' '/' '%' | ||
242 | %right '!' '~' INC_OP DEC_OP | ||
243 | %nonassoc INITIALIZER | ||
244 | |||
245 | %% | ||
246 | |||
247 | lscript_program | ||
248 | : globals states | ||
249 | { | ||
250 | $$ = new LLScriptScript($1, $2); | ||
251 | gScriptp = $$; | ||
252 | } | ||
253 | | states | ||
254 | { | ||
255 | $$ = new LLScriptScript(NULL, $1); | ||
256 | gScriptp = $$; | ||
257 | } | ||
258 | ; | ||
259 | |||
260 | globals | ||
261 | : global | ||
262 | { | ||
263 | $$ = $1; | ||
264 | } | ||
265 | | global globals | ||
266 | { | ||
267 | $$ = $1; | ||
268 | $1->addGlobal($2); | ||
269 | } | ||
270 | ; | ||
271 | |||
272 | global | ||
273 | : global_variable | ||
274 | { | ||
275 | $$ = new LLScritpGlobalStorage($1); | ||
276 | } | ||
277 | | global_function | ||
278 | { | ||
279 | $$ = new LLScritpGlobalStorage($1); | ||
280 | } | ||
281 | ; | ||
282 | |||
283 | name_type | ||
284 | : typename IDENTIFIER | ||
285 | { | ||
286 | $$ = new LLScriptIdentifier(gLine, gColumn, $2, $1); | ||
287 | } | ||
288 | ; | ||
289 | |||
290 | global_variable | ||
291 | : name_type ';' | ||
292 | { | ||
293 | $$ = new LLScriptGlobalVariable(gLine, gColumn, $1->mType, $1, NULL); | ||
294 | } | ||
295 | | name_type '=' simple_assignable ';' | ||
296 | { | ||
297 | $$ = new LLScriptGlobalVariable(gLine, gColumn, $1->mType, $1, $3); | ||
298 | } | ||
299 | ; | ||
300 | |||
301 | simple_assignable | ||
302 | : simple_assignable_no_list | ||
303 | { | ||
304 | $$ = $1; | ||
305 | } | ||
306 | | list_constant | ||
307 | { | ||
308 | $$ = $1; | ||
309 | } | ||
310 | ; | ||
311 | |||
312 | simple_assignable_no_list | ||
313 | : IDENTIFIER | ||
314 | { | ||
315 | LLScriptIdentifier *id = new LLScriptIdentifier(gLine, gColumn, $1); | ||
316 | $$ = new LLScriptSAIdentifier(gLine, gColumn, id); | ||
317 | } | ||
318 | | constant | ||
319 | { | ||
320 | $$ = new LLScriptSAConstant(gLine, gColumn, $1); | ||
321 | } | ||
322 | | special_constant | ||
323 | { | ||
324 | $$ = $1; | ||
325 | } | ||
326 | ; | ||
327 | |||
328 | constant | ||
329 | : integer_constant | ||
330 | { | ||
331 | $$ = new LLScriptConstantInteger(gLine, gColumn, $1); | ||
332 | } | ||
333 | | fp_constant | ||
334 | { | ||
335 | $$ = new LLScriptConstantFloat(gLine, gColumn, $1); | ||
336 | } | ||
337 | | STRING_CONSTANT | ||
338 | { | ||
339 | $$ = new LLScriptConstantString(gLine, gColumn, $1); | ||
340 | } | ||
341 | ; | ||
342 | |||
343 | fp_constant | ||
344 | : FP_CONSTANT | ||
345 | { | ||
346 | $$ = $1; | ||
347 | } | ||
348 | | '-' FP_CONSTANT | ||
349 | { | ||
350 | $$ = -$2; | ||
351 | } | ||
352 | ; | ||
353 | |||
354 | integer_constant | ||
355 | : INTEGER_CONSTANT | ||
356 | { | ||
357 | $$ = $1; | ||
358 | } | ||
359 | | INTEGER_TRUE | ||
360 | { | ||
361 | $$ = $1; | ||
362 | } | ||
363 | | INTEGER_FALSE | ||
364 | { | ||
365 | $$ = $1; | ||
366 | } | ||
367 | | '-' INTEGER_CONSTANT | ||
368 | { | ||
369 | $$ = -$2; | ||
370 | } | ||
371 | ; | ||
372 | |||
373 | special_constant | ||
374 | : vector_constant | ||
375 | { | ||
376 | $$ = $1; | ||
377 | } | ||
378 | | quaternion_constant | ||
379 | { | ||
380 | $$ = $1; | ||
381 | } | ||
382 | ; | ||
383 | |||
384 | vector_constant | ||
385 | : '<' simple_assignable ',' simple_assignable ',' simple_assignable '>' | ||
386 | { | ||
387 | $$ = new LLScriptSAVector(gLine, gColumn, $2, $4, $6); | ||
388 | } | ||
389 | | ZERO_VECTOR | ||
390 | { | ||
391 | LLScriptConstantFloat *cf0 = new LLScriptConstantFloat(gLine, gColumn, 0.f); | ||
392 | LLScriptSAConstant *sa0 = new LLScriptSAConstant(gLine, gColumn, cf0); | ||
393 | LLScriptConstantFloat *cf1 = new LLScriptConstantFloat(gLine, gColumn, 0.f); | ||
394 | LLScriptSAConstant *sa1 = new LLScriptSAConstant(gLine, gColumn, cf1); | ||
395 | LLScriptConstantFloat *cf2 = new LLScriptConstantFloat(gLine, gColumn, 0.f); | ||
396 | LLScriptSAConstant *sa2 = new LLScriptSAConstant(gLine, gColumn, cf2); | ||
397 | $$ = new LLScriptSAVector(gLine, gColumn, sa0, sa1, sa2); | ||
398 | } | ||
399 | | TOUCH_INVALID_VECTOR | ||
400 | { | ||
401 | LLScriptConstantFloat *cf0 = new LLScriptConstantFloat(gLine, gColumn, 0.f); | ||
402 | LLScriptSAConstant *sa0 = new LLScriptSAConstant(gLine, gColumn, cf0); | ||
403 | LLScriptConstantFloat *cf1 = new LLScriptConstantFloat(gLine, gColumn, 0.f); | ||
404 | LLScriptSAConstant *sa1 = new LLScriptSAConstant(gLine, gColumn, cf1); | ||
405 | LLScriptConstantFloat *cf2 = new LLScriptConstantFloat(gLine, gColumn, 0.f); | ||
406 | LLScriptSAConstant *sa2 = new LLScriptSAConstant(gLine, gColumn, cf2); | ||
407 | $$ = new LLScriptSAVector(gLine, gColumn, sa0, sa1, sa2); | ||
408 | } | ||
409 | | TOUCH_INVALID_TEXCOORD | ||
410 | { | ||
411 | LLScriptConstantFloat *cf0 = new LLScriptConstantFloat(gLine, gColumn, -1.f); | ||
412 | LLScriptSAConstant *sa0 = new LLScriptSAConstant(gLine, gColumn, cf0); | ||
413 | LLScriptConstantFloat *cf1 = new LLScriptConstantFloat(gLine, gColumn, -1.f); | ||
414 | LLScriptSAConstant *sa1 = new LLScriptSAConstant(gLine, gColumn, cf1); | ||
415 | LLScriptConstantFloat *cf2 = new LLScriptConstantFloat(gLine, gColumn, 0.f); | ||
416 | LLScriptSAConstant *sa2 = new LLScriptSAConstant(gLine, gColumn, cf2); | ||
417 | $$ = new LLScriptSAVector(gLine, gColumn, sa0, sa1, sa2); | ||
418 | } | ||
419 | ; | ||
420 | |||
421 | quaternion_constant | ||
422 | : '<' simple_assignable ',' simple_assignable ',' simple_assignable ',' simple_assignable '>' | ||
423 | { | ||
424 | $$ = new LLScriptSAQuaternion(gLine, gColumn, $2, $4, $6, $8); | ||
425 | } | ||
426 | | ZERO_ROTATION | ||
427 | { | ||
428 | LLScriptConstantFloat *cf0 = new LLScriptConstantFloat(gLine, gColumn, 0.f); | ||
429 | LLScriptSAConstant *sa0 = new LLScriptSAConstant(gLine, gColumn, cf0); | ||
430 | LLScriptConstantFloat *cf1 = new LLScriptConstantFloat(gLine, gColumn, 0.f); | ||
431 | LLScriptSAConstant *sa1 = new LLScriptSAConstant(gLine, gColumn, cf1); | ||
432 | LLScriptConstantFloat *cf2 = new LLScriptConstantFloat(gLine, gColumn, 0.f); | ||
433 | LLScriptSAConstant *sa2 = new LLScriptSAConstant(gLine, gColumn, cf2); | ||
434 | LLScriptConstantFloat *cf3 = new LLScriptConstantFloat(gLine, gColumn, 1.f); | ||
435 | LLScriptSAConstant *sa3 = new LLScriptSAConstant(gLine, gColumn, cf3); | ||
436 | $$ = new LLScriptSAQuaternion(gLine, gColumn, sa0, sa1, sa2, sa3); | ||
437 | } | ||
438 | ; | ||
439 | |||
440 | list_constant | ||
441 | : '[' list_entries ']' | ||
442 | { | ||
443 | $$ = new LLScriptSAList(gLine, gColumn, $2); | ||
444 | } | ||
445 | | '[' ']' | ||
446 | { | ||
447 | $$ = new LLScriptSAList(gLine, gColumn, NULL); | ||
448 | } | ||
449 | ; | ||
450 | |||
451 | list_entries | ||
452 | : list_entry | ||
453 | { | ||
454 | $$ = $1; | ||
455 | } | ||
456 | | list_entry ',' list_entries | ||
457 | { | ||
458 | $$ = $1; | ||
459 | $1->addAssignable($3); | ||
460 | } | ||
461 | ; | ||
462 | |||
463 | list_entry | ||
464 | : simple_assignable_no_list | ||
465 | { | ||
466 | $$ = $1; | ||
467 | } | ||
468 | ; | ||
469 | |||
470 | typename | ||
471 | : INTEGER | ||
472 | { | ||
473 | $$ = new LLScriptType(gLine, gColumn, LST_INTEGER); | ||
474 | } | ||
475 | | FLOAT_TYPE | ||
476 | { | ||
477 | $$ = new LLScriptType(gLine, gColumn, LST_FLOATINGPOINT); | ||
478 | } | ||
479 | | STRING | ||
480 | { | ||
481 | $$ = new LLScriptType(gLine, gColumn, LST_STRING); | ||
482 | } | ||
483 | | LLKEY | ||
484 | { | ||
485 | $$ = new LLScriptType(gLine, gColumn, LST_KEY); | ||
486 | } | ||
487 | | VECTOR | ||
488 | { | ||
489 | $$ = new LLScriptType(gLine, gColumn, LST_VECTOR); | ||
490 | } | ||
491 | | QUATERNION | ||
492 | { | ||
493 | $$ = new LLScriptType(gLine, gColumn, LST_QUATERNION); | ||
494 | } | ||
495 | | LIST | ||
496 | { | ||
497 | $$ = new LLScriptType(gLine, gColumn, LST_LIST); | ||
498 | } | ||
499 | ; | ||
500 | |||
501 | global_function | ||
502 | : IDENTIFIER '(' ')' compound_statement | ||
503 | { | ||
504 | LLScriptIdentifier *id = new LLScriptIdentifier(gLine, gColumn, $1); | ||
505 | $$ = new LLScriptGlobalFunctions(gLine, gColumn, NULL, id, NULL, $4); | ||
506 | } | ||
507 | | name_type '(' ')' compound_statement | ||
508 | { | ||
509 | $$ = new LLScriptGlobalFunctions(gLine, gColumn, $1->mType, $1, NULL, $4); | ||
510 | } | ||
511 | | IDENTIFIER '(' function_parameters ')' compound_statement | ||
512 | { | ||
513 | LLScriptIdentifier *id = new LLScriptIdentifier(gLine, gColumn, $1); | ||
514 | $$ = new LLScriptGlobalFunctions(gLine, gColumn, NULL, id, $3, $5); | ||
515 | } | ||
516 | | name_type '(' function_parameters ')' compound_statement | ||
517 | { | ||
518 | $$ = new LLScriptGlobalFunctions(gLine, gColumn, $1->mType, $1, $3, $5); | ||
519 | } | ||
520 | ; | ||
521 | |||
522 | function_parameters | ||
523 | : function_parameter | ||
524 | { | ||
525 | $$ = $1; | ||
526 | } | ||
527 | | function_parameter ',' function_parameters | ||
528 | { | ||
529 | $$ = $1; | ||
530 | $1->addFunctionParameter($3); | ||
531 | } | ||
532 | ; | ||
533 | |||
534 | function_parameter | ||
535 | : typename IDENTIFIER | ||
536 | { | ||
537 | LLScriptIdentifier *id = new LLScriptIdentifier(gLine, gColumn, $2); | ||
538 | $$ = new LLScriptFunctionDec(gLine, gColumn, $1, id); | ||
539 | } | ||
540 | ; | ||
541 | |||
542 | states | ||
543 | : default | ||
544 | { | ||
545 | $$ = $1; | ||
546 | } | ||
547 | | default other_states | ||
548 | { | ||
549 | $$ = $1; | ||
550 | $1->mNextp = $2; | ||
551 | } | ||
552 | ; | ||
553 | |||
554 | other_states | ||
555 | : state | ||
556 | { | ||
557 | $$ = $1; | ||
558 | } | ||
559 | | state other_states | ||
560 | { | ||
561 | $$ = $1; | ||
562 | $1->addState($2); | ||
563 | } | ||
564 | ; | ||
565 | |||
566 | default | ||
567 | : STATE_DEFAULT '{' state_body '}' | ||
568 | { | ||
569 | LLScriptIdentifier *id = new LLScriptIdentifier(gLine, gColumn, $1); | ||
570 | $$ = new LLScriptState(gLine, gColumn, LSSTYPE_DEFAULT, id, $3); | ||
571 | } | ||
572 | ; | ||
573 | |||
574 | state | ||
575 | : STATE IDENTIFIER '{' state_body '}' | ||
576 | { | ||
577 | LLScriptIdentifier *id = new LLScriptIdentifier(gLine, gColumn, $2); | ||
578 | $$ = new LLScriptState(gLine, gColumn, LSSTYPE_USER, id, $4); | ||
579 | } | ||
580 | ; | ||
581 | |||
582 | state_body | ||
583 | : event | ||
584 | { | ||
585 | $$ = $1; | ||
586 | } | ||
587 | | event state_body | ||
588 | { | ||
589 | $$ = $1; | ||
590 | $1->addEvent($2); | ||
591 | } | ||
592 | ; | ||
593 | |||
594 | event | ||
595 | : state_entry compound_statement | ||
596 | { | ||
597 | $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); | ||
598 | } | ||
599 | | state_exit compound_statement | ||
600 | { | ||
601 | $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); | ||
602 | } | ||
603 | | touch_start compound_statement | ||
604 | { | ||
605 | $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); | ||
606 | } | ||
607 | | touch compound_statement | ||
608 | { | ||
609 | $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); | ||
610 | } | ||
611 | | touch_end compound_statement | ||
612 | { | ||
613 | $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); | ||
614 | } | ||
615 | | collision_start compound_statement | ||
616 | { | ||
617 | $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); | ||
618 | } | ||
619 | | collision compound_statement | ||
620 | { | ||
621 | $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); | ||
622 | } | ||
623 | | collision_end compound_statement | ||
624 | { | ||
625 | $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); | ||
626 | } | ||
627 | | land_collision_start compound_statement | ||
628 | { | ||
629 | $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); | ||
630 | } | ||
631 | | land_collision compound_statement | ||
632 | { | ||
633 | $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); | ||
634 | } | ||
635 | | land_collision_end compound_statement | ||
636 | { | ||
637 | $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); | ||
638 | } | ||
639 | | timer compound_statement | ||
640 | { | ||
641 | $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); | ||
642 | } | ||
643 | | chat compound_statement | ||
644 | { | ||
645 | $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); | ||
646 | } | ||
647 | | sensor compound_statement | ||
648 | { | ||
649 | $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); | ||
650 | } | ||
651 | | no_sensor compound_statement | ||
652 | { | ||
653 | $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); | ||
654 | } | ||
655 | | at_target compound_statement | ||
656 | { | ||
657 | $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); | ||
658 | } | ||
659 | | not_at_target compound_statement | ||
660 | { | ||
661 | $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); | ||
662 | } | ||
663 | | at_rot_target compound_statement | ||
664 | { | ||
665 | $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); | ||
666 | } | ||
667 | | not_at_rot_target compound_statement | ||
668 | { | ||
669 | $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); | ||
670 | } | ||
671 | | money compound_statement | ||
672 | { | ||
673 | $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); | ||
674 | } | ||
675 | | email compound_statement | ||
676 | { | ||
677 | $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); | ||
678 | } | ||
679 | | run_time_permissions compound_statement | ||
680 | { | ||
681 | $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); | ||
682 | } | ||
683 | | inventory compound_statement | ||
684 | { | ||
685 | $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); | ||
686 | } | ||
687 | | attach compound_statement | ||
688 | { | ||
689 | $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); | ||
690 | } | ||
691 | | dataserver compound_statement | ||
692 | { | ||
693 | $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); | ||
694 | } | ||
695 | | control compound_statement | ||
696 | { | ||
697 | $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); | ||
698 | } | ||
699 | | moving_start compound_statement | ||
700 | { | ||
701 | $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); | ||
702 | } | ||
703 | | moving_end compound_statement | ||
704 | { | ||
705 | $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); | ||
706 | } | ||
707 | | rez compound_statement | ||
708 | { | ||
709 | $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); | ||
710 | } | ||
711 | | object_rez compound_statement | ||
712 | { | ||
713 | $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); | ||
714 | } | ||
715 | | link_message compound_statement | ||
716 | { | ||
717 | $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); | ||
718 | } | ||
719 | | remote_data compound_statement | ||
720 | { | ||
721 | $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); | ||
722 | } | ||
723 | | http_response compound_statement | ||
724 | { | ||
725 | $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); | ||
726 | } | ||
727 | | http_request compound_statement | ||
728 | { | ||
729 | $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); | ||
730 | } | ||
731 | ; | ||
732 | |||
733 | state_entry | ||
734 | : STATE_ENTRY '(' ')' | ||
735 | { | ||
736 | $$ = new LLScriptStateEntryEvent(gLine, gColumn); | ||
737 | } | ||
738 | ; | ||
739 | |||
740 | state_exit | ||
741 | : STATE_EXIT '(' ')' | ||
742 | { | ||
743 | $$ = new LLScriptStateExitEvent(gLine, gColumn); | ||
744 | } | ||
745 | ; | ||
746 | |||
747 | touch_start | ||
748 | : TOUCH_START '(' INTEGER IDENTIFIER ')' | ||
749 | { | ||
750 | LLScriptIdentifier *id1 = new LLScriptIdentifier(gLine, gColumn, $4); | ||
751 | $$ = new LLScriptTouchStartEvent(gLine, gColumn, id1); | ||
752 | } | ||
753 | ; | ||
754 | |||
755 | touch | ||
756 | : TOUCH '(' INTEGER IDENTIFIER ')' | ||
757 | { | ||
758 | LLScriptIdentifier *id1 = new LLScriptIdentifier(gLine, gColumn, $4); | ||
759 | $$ = new LLScriptTouchEvent(gLine, gColumn, id1); | ||
760 | } | ||
761 | ; | ||
762 | |||
763 | touch_end | ||
764 | : TOUCH_END '(' INTEGER IDENTIFIER ')' | ||
765 | { | ||
766 | LLScriptIdentifier *id1 = new LLScriptIdentifier(gLine, gColumn, $4); | ||
767 | $$ = new LLScriptTouchEndEvent(gLine, gColumn, id1); | ||
768 | } | ||
769 | ; | ||
770 | |||
771 | collision_start | ||
772 | : COLLISION_START '(' INTEGER IDENTIFIER ')' | ||
773 | { | ||
774 | LLScriptIdentifier *id1 = new LLScriptIdentifier(gLine, gColumn, $4); | ||
775 | $$ = new LLScriptCollisionStartEvent(gLine, gColumn, id1); | ||
776 | } | ||
777 | ; | ||
778 | |||
779 | collision | ||
780 | : COLLISION '(' INTEGER IDENTIFIER ')' | ||
781 | { | ||
782 | LLScriptIdentifier *id1 = new LLScriptIdentifier(gLine, gColumn, $4); | ||
783 | $$ = new LLScriptCollisionEvent(gLine, gColumn, id1); | ||
784 | } | ||
785 | ; | ||
786 | |||
787 | collision_end | ||
788 | : COLLISION_END '(' INTEGER IDENTIFIER ')' | ||
789 | { | ||
790 | LLScriptIdentifier *id1 = new LLScriptIdentifier(gLine, gColumn, $4); | ||
791 | $$ = new LLScriptCollisionEndEvent(gLine, gColumn, id1); | ||
792 | } | ||
793 | ; | ||
794 | |||
795 | land_collision_start | ||
796 | : LAND_COLLISION_START '(' VECTOR IDENTIFIER ')' | ||
797 | { | ||
798 | LLScriptIdentifier *id1 = new LLScriptIdentifier(gLine, gColumn, $4); | ||
799 | $$ = new LLScriptLandCollisionStartEvent(gLine, gColumn, id1); | ||
800 | } | ||
801 | ; | ||
802 | |||
803 | land_collision | ||
804 | : LAND_COLLISION '(' VECTOR IDENTIFIER ')' | ||
805 | { | ||
806 | LLScriptIdentifier *id1 = new LLScriptIdentifier(gLine, gColumn, $4); | ||
807 | $$ = new LLScriptLandCollisionEvent(gLine, gColumn, id1); | ||
808 | } | ||
809 | ; | ||
810 | |||
811 | land_collision_end | ||
812 | : LAND_COLLISION_END '(' VECTOR IDENTIFIER ')' | ||
813 | { | ||
814 | LLScriptIdentifier *id1 = new LLScriptIdentifier(gLine, gColumn, $4); | ||
815 | $$ = new LLScriptLandCollisionEndEvent(gLine, gColumn, id1); | ||
816 | } | ||
817 | ; | ||
818 | |||
819 | at_target | ||
820 | : AT_TARGET '(' INTEGER IDENTIFIER ',' VECTOR IDENTIFIER ',' VECTOR IDENTIFIER ')' | ||
821 | { | ||
822 | LLScriptIdentifier *id1 = new LLScriptIdentifier(gLine, gColumn, $4); | ||
823 | LLScriptIdentifier *id2 = new LLScriptIdentifier(gLine, gColumn, $7); | ||
824 | LLScriptIdentifier *id3 = new LLScriptIdentifier(gLine, gColumn, $10); | ||
825 | $$ = new LLScriptAtTarget(gLine, gColumn, id1, id2, id3); | ||
826 | } | ||
827 | ; | ||
828 | |||
829 | not_at_target | ||
830 | : NOT_AT_TARGET '(' ')' | ||
831 | { | ||
832 | $$ = new LLScriptNotAtTarget(gLine, gColumn); | ||
833 | } | ||
834 | ; | ||
835 | |||
836 | at_rot_target | ||
837 | : AT_ROT_TARGET '(' INTEGER IDENTIFIER ',' QUATERNION IDENTIFIER ',' QUATERNION IDENTIFIER ')' | ||
838 | { | ||
839 | LLScriptIdentifier *id1 = new LLScriptIdentifier(gLine, gColumn, $4); | ||
840 | LLScriptIdentifier *id2 = new LLScriptIdentifier(gLine, gColumn, $7); | ||
841 | LLScriptIdentifier *id3 = new LLScriptIdentifier(gLine, gColumn, $10); | ||
842 | $$ = new LLScriptAtRotTarget(gLine, gColumn, id1, id2, id3); | ||
843 | } | ||
844 | ; | ||
845 | |||
846 | not_at_rot_target | ||
847 | : NOT_AT_ROT_TARGET '(' ')' | ||
848 | { | ||
849 | $$ = new LLScriptNotAtRotTarget(gLine, gColumn); | ||
850 | } | ||
851 | ; | ||
852 | |||
853 | money | ||
854 | : MONEY '(' LLKEY IDENTIFIER ',' INTEGER IDENTIFIER ')' | ||
855 | { | ||
856 | LLScriptIdentifier *id1 = new LLScriptIdentifier(gLine, gColumn, $4); | ||
857 | LLScriptIdentifier *id2 = new LLScriptIdentifier(gLine, gColumn, $7); | ||
858 | $$ = new LLScriptMoneyEvent(gLine, gColumn, id1, id2); | ||
859 | } | ||
860 | ; | ||
861 | |||
862 | |||
863 | : EMAIL '(' STRING IDENTIFIER ',' STRING IDENTIFIER ',' STRING IDENTIFIER ',' STRING IDENTIFIER ',' INTEGER IDENTIFIER ')' | ||
864 | { | ||
865 | LLScriptIdentifier *id1 = new LLScriptIdentifier(gLine, gColumn, $4); | ||
866 | LLScriptIdentifier *id2 = new LLScriptIdentifier(gLine, gColumn, $7); | ||
867 | LLScriptIdentifier *id3 = new LLScriptIdentifier(gLine, gColumn, $10); | ||
868 | LLScriptIdentifier *id4 = new LLScriptIdentifier(gLine, gColumn, $13); | ||
869 | LLScriptIdentifier *id5 = new LLScriptIdentifier(gLine, gColumn, $16); | ||
870 | $$ = new LLScriptEmailEvent(gLine, gColumn, id1, id2, id3, id4, id5); | ||
871 | } | ||
872 | ; | ||
873 | |||
874 | run_time_permissions | ||
875 | : RUN_TIME_PERMISSIONS '(' INTEGER IDENTIFIER ')' | ||
876 | { | ||
877 | LLScriptIdentifier *id1 = new LLScriptIdentifier(gLine, gColumn, $4); | ||
878 | $$ = new LLScriptRTPEvent(gLine, gColumn, id1); | ||
879 | } | ||
880 | ; | ||
881 | |||
882 | inventory | ||
883 | : INVENTORY '(' INTEGER IDENTIFIER ')' | ||
884 | { | ||
885 | LLScriptIdentifier *id1 = new LLScriptIdentifier(gLine, gColumn, $4); | ||
886 | $$ = new LLScriptInventoryEvent(gLine, gColumn, id1); | ||
887 | } | ||
888 | ; | ||
889 | |||
890 | attach | ||
891 | : ATTACH '(' LLKEY IDENTIFIER ')' | ||
892 | { | ||
893 | LLScriptIdentifier *id1 = new LLScriptIdentifier(gLine, gColumn, $4); | ||
894 | $$ = new LLScriptAttachEvent(gLine, gColumn, id1); | ||
895 | } | ||
896 | ; | ||
897 | |||
898 | dataserver | ||
899 | : DATASERVER '(' LLKEY IDENTIFIER ',' STRING IDENTIFIER')' | ||
900 | { | ||
901 | LLScriptIdentifier *id1 = new LLScriptIdentifier(gLine, gColumn, $4); | ||
902 | LLScriptIdentifier *id2 = new LLScriptIdentifier(gLine, gColumn, $7); | ||
903 | $$ = new LLScriptDataserverEvent(gLine, gColumn, id1, id2); | ||
904 | } | ||
905 | ; | ||
906 | |||
907 | moving_start | ||
908 | : MOVING_START '(' ')' | ||
909 | { | ||
910 | $$ = new LLScriptMovingStartEvent(gLine, gColumn); | ||
911 | } | ||
912 | ; | ||
913 | |||
914 | moving_end | ||
915 | : MOVING_END '(' ')' | ||
916 | { | ||
917 | $$ = new LLScriptMovingEndEvent(gLine, gColumn); | ||
918 | } | ||
919 | ; | ||
920 | |||
921 | timer | ||
922 | : TIMER '(' ')' | ||
923 | { | ||
924 | $$ = new LLScriptTimerEvent(gLine, gColumn); | ||
925 | } | ||
926 | ; | ||
927 | |||
928 | chat | ||
929 | : CHAT '(' INTEGER IDENTIFIER ',' STRING IDENTIFIER ',' LLKEY IDENTIFIER ',' STRING IDENTIFIER ')' | ||
930 | { | ||
931 | LLScriptIdentifier *id1 = new LLScriptIdentifier(gLine, gColumn, $4); | ||
932 | LLScriptIdentifier *id2 = new LLScriptIdentifier(gLine, gColumn, $7); | ||
933 | LLScriptIdentifier *id3 = new LLScriptIdentifier(gLine, gColumn, $10); | ||
934 | LLScriptIdentifier *id4 = new LLScriptIdentifier(gLine, gColumn, $13); | ||
935 | $$ = new LLScriptChatEvent(gLine, gColumn, id1, id2, id3, id4); | ||
936 | } | ||
937 | ; | ||
938 | |||
939 | sensor | ||
940 | : SENSOR '(' INTEGER IDENTIFIER ')' | ||
941 | { | ||
942 | LLScriptIdentifier *id1 = new LLScriptIdentifier(gLine, gColumn, $4); | ||
943 | $$ = new LLScriptSensorEvent(gLine, gColumn, id1); | ||
944 | } | ||
945 | ; | ||
946 | |||
947 | no_sensor | ||
948 | : NO_SENSOR '(' ')' | ||
949 | { | ||
950 | $$ = new LLScriptNoSensorEvent(gLine, gColumn); | ||
951 | } | ||
952 | ; | ||
953 | |||
954 | control | ||
955 | : CONTROL '(' LLKEY IDENTIFIER ',' INTEGER IDENTIFIER ',' INTEGER IDENTIFIER ')' | ||
956 | { | ||
957 | LLScriptIdentifier *id1 = new LLScriptIdentifier(gLine, gColumn, $4); | ||
958 | LLScriptIdentifier *id2 = new LLScriptIdentifier(gLine, gColumn, $7); | ||
959 | LLScriptIdentifier *id3 = new LLScriptIdentifier(gLine, gColumn, $10); | ||
960 | $$ = new LLScriptControlEvent(gLine, gColumn, id1, id2, id3); | ||
961 | } | ||
962 | ; | ||
963 | |||
964 | rez | ||
965 | : REZ '(' INTEGER IDENTIFIER ')' | ||
966 | { | ||
967 | LLScriptIdentifier *id1 = new LLScriptIdentifier(gLine, gColumn, $4); | ||
968 | $$ = new LLScriptRezEvent(gLine, gColumn, id1); | ||
969 | } | ||
970 | ; | ||
971 | |||
972 | object_rez | ||
973 | : OBJECT_REZ '(' LLKEY IDENTIFIER ')' | ||
974 | { | ||
975 | LLScriptIdentifier *id1 = new LLScriptIdentifier(gLine, gColumn, $4); | ||
976 | $$ = new LLScriptObjectRezEvent(gLine, gColumn, id1); | ||
977 | } | ||
978 | ; | ||
979 | |||
980 | link_message | ||
981 | : LINK_MESSAGE '(' INTEGER IDENTIFIER ',' INTEGER IDENTIFIER ',' STRING IDENTIFIER ',' LLKEY IDENTIFIER ')' | ||
982 | { | ||
983 | LLScriptIdentifier *id1 = new LLScriptIdentifier(gLine, gColumn, $4); | ||
984 | LLScriptIdentifier *id2 = new LLScriptIdentifier(gLine, gColumn, $7); | ||
985 | LLScriptIdentifier *id3 = new LLScriptIdentifier(gLine, gColumn, $10); | ||
986 | LLScriptIdentifier *id4 = new LLScriptIdentifier(gLine, gColumn, $13); | ||
987 | $$ = new LLScriptLinkMessageEvent(gLine, gColumn, id1, id2, id3, id4); | ||
988 | } | ||
989 | ; | ||
990 | |||
991 | remote_data | ||
992 | : REMOTE_DATA '(' INTEGER IDENTIFIER ',' LLKEY IDENTIFIER ',' LLKEY IDENTIFIER ',' STRING IDENTIFIER ',' INTEGER IDENTIFIER ',' STRING IDENTIFIER ')' | ||
993 | { | ||
994 | LLScriptIdentifier *id1 = new LLScriptIdentifier(gLine, gColumn, $4); | ||
995 | LLScriptIdentifier *id2 = new LLScriptIdentifier(gLine, gColumn, $7); | ||
996 | LLScriptIdentifier *id3 = new LLScriptIdentifier(gLine, gColumn, $10); | ||
997 | LLScriptIdentifier *id4 = new LLScriptIdentifier(gLine, gColumn, $13); | ||
998 | LLScriptIdentifier *id5 = new LLScriptIdentifier(gLine, gColumn, $16); | ||
999 | LLScriptIdentifier *id6 = new LLScriptIdentifier(gLine, gColumn, $19); | ||
1000 | $$ = new LLScriptRemoteEvent(gLine, gColumn, id1, id2, id3, id4, id5, id6); | ||
1001 | } | ||
1002 | ; | ||
1003 | |||
1004 | http_response | ||
1005 | : HTTP_RESPONSE '(' LLKEY IDENTIFIER ',' INTEGER IDENTIFIER ',' LIST IDENTIFIER ',' STRING IDENTIFIER ')' | ||
1006 | { | ||
1007 | LLScriptIdentifier *id1 = new LLScriptIdentifier(gLine, gColumn, $4); | ||
1008 | LLScriptIdentifier *id2 = new LLScriptIdentifier(gLine, gColumn, $7); | ||
1009 | LLScriptIdentifier *id3 = new LLScriptIdentifier(gLine, gColumn, $10); | ||
1010 | LLScriptIdentifier *id4 = new LLScriptIdentifier(gLine, gColumn, $13); | ||
1011 | $$ = new LLScriptHTTPResponseEvent(gLine, gColumn, id1, id2, id3, id4); | ||
1012 | } | ||
1013 | ; | ||
1014 | |||
1015 | http_request | ||
1016 | : HTTP_REQUEST '(' LLKEY IDENTIFIER ',' STRING IDENTIFIER ',' STRING IDENTIFIER ')' | ||
1017 | { | ||
1018 | LLScriptIdentifier *id1 = new LLScriptIdentifier(gLine, gColumn, $4); | ||
1019 | LLScriptIdentifier *id2 = new LLScriptIdentifier(gLine, gColumn, $7); | ||
1020 | LLScriptIdentifier *id3 = new LLScriptIdentifier(gLine, gColumn, $10); | ||
1021 | $$ = new LLScriptHTTPRequestEvent(gLine, gColumn, id1, id2, id3); | ||
1022 | } | ||
1023 | ; | ||
1024 | |||
1025 | compound_statement | ||
1026 | : '{' '}' | ||
1027 | { | ||
1028 | $$ = new LLScriptCompoundStatement(gLine, gColumn, NULL); | ||
1029 | } | ||
1030 | | '{' statements '}' | ||
1031 | { | ||
1032 | $$ = new LLScriptCompoundStatement(gLine, gColumn, $2); | ||
1033 | } | ||
1034 | ; | ||
1035 | |||
1036 | statements | ||
1037 | : statement | ||
1038 | { | ||
1039 | $$ = $1; | ||
1040 | } | ||
1041 | | statements statement | ||
1042 | { | ||
1043 | $$ = new LLScriptStatementSequence(gLine, gColumn, $1, $2); | ||
1044 | } | ||
1045 | ; | ||
1046 | |||
1047 | statement | ||
1048 | : ';' | ||
1049 | { | ||
1050 | $$ = new LLScriptNOOP(gLine, gColumn); | ||
1051 | } | ||
1052 | | STATE IDENTIFIER ';' | ||
1053 | { | ||
1054 | LLScriptIdentifier *id = new LLScriptIdentifier(gLine, gColumn, $2); | ||
1055 | $$ = new LLScriptStateChange(gLine, gColumn, id); | ||
1056 | } | ||
1057 | | STATE STATE_DEFAULT ';' | ||
1058 | { | ||
1059 | LLScriptIdentifier *id = new LLScriptIdentifier(gLine, gColumn, $2); | ||
1060 | $$ = new LLScriptStateChange(gLine, gColumn, id); | ||
1061 | } | ||
1062 | | JUMP IDENTIFIER ';' | ||
1063 | { | ||
1064 | LLScriptIdentifier *id = new LLScriptIdentifier(gLine, gColumn, $2); | ||
1065 | $$ = new LLScriptJump(gLine, gColumn, id); | ||
1066 | } | ||
1067 | | '@' IDENTIFIER ';' | ||
1068 | { | ||
1069 | LLScriptIdentifier *id = new LLScriptIdentifier(gLine, gColumn, $2); | ||
1070 | $$ = new LLScriptLabel(gLine, gColumn, id); | ||
1071 | } | ||
1072 | | RETURN expression ';' | ||
1073 | { | ||
1074 | $$ = new LLScriptReturn(gLine, gColumn, $2); | ||
1075 | } | ||
1076 | | RETURN ';' | ||
1077 | { | ||
1078 | $$ = new LLScriptReturn(gLine, gColumn, NULL); | ||
1079 | } | ||
1080 | | expression ';' | ||
1081 | { | ||
1082 | $$ = new LLScriptExpressionStatement(gLine, gColumn, $1); | ||
1083 | } | ||
1084 | | declaration ';' | ||
1085 | { | ||
1086 | $$ = $1; | ||
1087 | } | ||
1088 | | compound_statement | ||
1089 | { | ||
1090 | $$ = $1; | ||
1091 | } | ||
1092 | | IF '(' expression ')' statement %prec LOWER_THAN_ELSE | ||
1093 | { | ||
1094 | $$ = new LLScriptIf(gLine, gColumn, $3, $5); | ||
1095 | $5->mAllowDeclarations = FALSE; | ||
1096 | } | ||
1097 | | IF '(' expression ')' statement ELSE statement | ||
1098 | { | ||
1099 | $$ = new LLScriptIfElse(gLine, gColumn, $3, $5, $7); | ||
1100 | $5->mAllowDeclarations = FALSE; | ||
1101 | $7->mAllowDeclarations = FALSE; | ||
1102 | } | ||
1103 | | FOR '(' forexpressionlist ';' expression ';' forexpressionlist ')' statement | ||
1104 | { | ||
1105 | $$ = new LLScriptFor(gLine, gColumn, $3, $5, $7, $9); | ||
1106 | $9->mAllowDeclarations = FALSE; | ||
1107 | } | ||
1108 | | DO statement WHILE '(' expression ')' ';' | ||
1109 | { | ||
1110 | $$ = new LLScriptDoWhile(gLine, gColumn, $2, $5); | ||
1111 | $2->mAllowDeclarations = FALSE; | ||
1112 | } | ||
1113 | | WHILE '(' expression ')' statement | ||
1114 | { | ||
1115 | $$ = new LLScriptWhile(gLine, gColumn, $3, $5); | ||
1116 | $5->mAllowDeclarations = FALSE; | ||
1117 | } | ||
1118 | ; | ||
1119 | |||
1120 | declaration | ||
1121 | : typename IDENTIFIER | ||
1122 | { | ||
1123 | LLScriptIdentifier *id = new LLScriptIdentifier(gLine, gColumn, $2); | ||
1124 | $$ = new LLScriptDeclaration(gLine, gColumn, $1, id, NULL); | ||
1125 | } | ||
1126 | | typename IDENTIFIER '=' expression | ||
1127 | { | ||
1128 | LLScriptIdentifier *id = new LLScriptIdentifier(gLine, gColumn, $2); | ||
1129 | $$ = new LLScriptDeclaration(gLine, gColumn, $1, id, $4); | ||
1130 | } | ||
1131 | ; | ||
1132 | |||
1133 | forexpressionlist | ||
1134 | : /* empty */ | ||
1135 | { | ||
1136 | $$ = NULL; | ||
1137 | } | ||
1138 | | nextforexpressionlist | ||
1139 | { | ||
1140 | $$ = $1; | ||
1141 | } | ||
1142 | ; | ||
1143 | |||
1144 | nextforexpressionlist | ||
1145 | : expression | ||
1146 | { | ||
1147 | $$ = new LLScriptForExpressionList(gLine, gColumn, $1, NULL); | ||
1148 | } | ||
1149 | | expression ',' nextforexpressionlist | ||
1150 | { | ||
1151 | $$ = new LLScriptForExpressionList(gLine, gColumn, $1, $3); | ||
1152 | } | ||
1153 | ; | ||
1154 | |||
1155 | funcexpressionlist | ||
1156 | : /* empty */ | ||
1157 | { | ||
1158 | $$ = NULL; | ||
1159 | } | ||
1160 | | nextfuncexpressionlist | ||
1161 | { | ||
1162 | $$ = $1; | ||
1163 | } | ||
1164 | ; | ||
1165 | |||
1166 | nextfuncexpressionlist | ||
1167 | : expression | ||
1168 | { | ||
1169 | $$ = new LLScriptFuncExpressionList(gLine, gColumn, $1, NULL); | ||
1170 | } | ||
1171 | | expression ',' nextfuncexpressionlist | ||
1172 | { | ||
1173 | $$ = new LLScriptFuncExpressionList(gLine, gColumn, $1, $3); | ||
1174 | } | ||
1175 | ; | ||
1176 | |||
1177 | listexpressionlist | ||
1178 | : /* empty */ | ||
1179 | { | ||
1180 | $$ = NULL; | ||
1181 | } | ||
1182 | | nextlistexpressionlist | ||
1183 | { | ||
1184 | $$ = $1; | ||
1185 | } | ||
1186 | ; | ||
1187 | |||
1188 | nextlistexpressionlist | ||
1189 | : expression | ||
1190 | { | ||
1191 | $$ = new LLScriptListExpressionList(gLine, gColumn, $1, NULL); | ||
1192 | } | ||
1193 | | expression ',' nextlistexpressionlist | ||
1194 | { | ||
1195 | $$ = new LLScriptListExpressionList(gLine, gColumn, $1, $3); | ||
1196 | } | ||
1197 | ; | ||
1198 | |||
1199 | expression | ||
1200 | : unaryexpression | ||
1201 | { | ||
1202 | $$ = $1; | ||
1203 | } | ||
1204 | | lvalue '=' expression | ||
1205 | { | ||
1206 | $$ = new LLScriptAssignment(gLine, gColumn, $1, $3); | ||
1207 | } | ||
1208 | | lvalue ADD_ASSIGN expression | ||
1209 | { | ||
1210 | $$ = new LLScriptAddAssignment(gLine, gColumn, $1, $3); | ||
1211 | } | ||
1212 | | lvalue SUB_ASSIGN expression | ||
1213 | { | ||
1214 | $$ = new LLScriptSubAssignment(gLine, gColumn, $1, $3); | ||
1215 | } | ||
1216 | | lvalue MUL_ASSIGN expression | ||
1217 | { | ||
1218 | $$ = new LLScriptMulAssignment(gLine, gColumn, $1, $3); | ||
1219 | } | ||
1220 | | lvalue DIV_ASSIGN expression | ||
1221 | { | ||
1222 | $$ = new LLScriptDivAssignment(gLine, gColumn, $1, $3); | ||
1223 | } | ||
1224 | | lvalue MOD_ASSIGN expression | ||
1225 | { | ||
1226 | $$ = new LLScriptModAssignment(gLine, gColumn, $1, $3); | ||
1227 | } | ||
1228 | | expression EQ expression | ||
1229 | { | ||
1230 | $$ = new LLScriptEquality(gLine, gColumn, $1, $3); | ||
1231 | } | ||
1232 | | expression NEQ expression | ||
1233 | { | ||
1234 | $$ = new LLScriptNotEquals(gLine, gColumn, $1, $3); | ||
1235 | } | ||
1236 | | expression LEQ expression | ||
1237 | { | ||
1238 | $$ = new LLScriptLessEquals(gLine, gColumn, $1, $3); | ||
1239 | } | ||
1240 | | expression GEQ expression | ||
1241 | { | ||
1242 | $$ = new LLScriptGreaterEquals(gLine, gColumn, $1, $3); | ||
1243 | } | ||
1244 | | expression '<' expression | ||
1245 | { | ||
1246 | $$ = new LLScriptLessThan(gLine, gColumn, $1, $3); | ||
1247 | } | ||
1248 | | expression '>' expression | ||
1249 | { | ||
1250 | $$ = new LLScriptGreaterThan(gLine, gColumn, $1, $3); | ||
1251 | } | ||
1252 | | expression '+' expression | ||
1253 | { | ||
1254 | $$ = new LLScriptPlus(gLine, gColumn, $1, $3); | ||
1255 | } | ||
1256 | | expression '-' expression | ||
1257 | { | ||
1258 | $$ = new LLScriptMinus(gLine, gColumn, $1, $3); | ||
1259 | } | ||
1260 | | expression '*' expression | ||
1261 | { | ||
1262 | $$ = new LLScriptTimes(gLine, gColumn, $1, $3); | ||
1263 | } | ||
1264 | | expression '/' expression | ||
1265 | { | ||
1266 | $$ = new LLScriptDivide(gLine, gColumn, $1, $3); | ||
1267 | } | ||
1268 | | expression '%' expression | ||
1269 | { | ||
1270 | $$ = new LLScriptMod(gLine, gColumn, $1, $3); | ||
1271 | } | ||
1272 | | expression '&' expression | ||
1273 | { | ||
1274 | $$ = new LLScriptBitAnd(gLine, gColumn, $1, $3); | ||
1275 | } | ||
1276 | | expression '|' expression | ||
1277 | { | ||
1278 | $$ = new LLScriptBitOr(gLine, gColumn, $1, $3); | ||
1279 | } | ||
1280 | | expression '^' expression | ||
1281 | { | ||
1282 | $$ = new LLScriptBitXor(gLine, gColumn, $1, $3); | ||
1283 | } | ||
1284 | | expression BOOLEAN_AND expression | ||
1285 | { | ||
1286 | $$ = new LLScriptBooleanAnd(gLine, gColumn, $1, $3); | ||
1287 | } | ||
1288 | | expression BOOLEAN_OR expression | ||
1289 | { | ||
1290 | $$ = new LLScriptBooleanOr(gLine, gColumn, $1, $3); | ||
1291 | } | ||
1292 | | expression SHIFT_LEFT expression | ||
1293 | { | ||
1294 | $$ = new LLScriptShiftLeft(gLine, gColumn, $1, $3); | ||
1295 | } | ||
1296 | | expression SHIFT_RIGHT expression | ||
1297 | { | ||
1298 | $$ = new LLScriptShiftRight(gLine, gColumn, $1, $3); | ||
1299 | } | ||
1300 | ; | ||
1301 | |||
1302 | unaryexpression | ||
1303 | : '-' expression | ||
1304 | { | ||
1305 | $$ = new LLScriptUnaryMinus(gLine, gColumn, $2); | ||
1306 | } | ||
1307 | | '!' expression | ||
1308 | { | ||
1309 | $$ = new LLScriptBooleanNot(gLine, gColumn, $2); | ||
1310 | } | ||
1311 | | '~' expression | ||
1312 | { | ||
1313 | $$ = new LLScriptBitNot(gLine, gColumn, $2); | ||
1314 | } | ||
1315 | | INC_OP lvalue | ||
1316 | { | ||
1317 | $$ = new LLScriptPreIncrement(gLine, gColumn, $2); | ||
1318 | } | ||
1319 | | DEC_OP lvalue | ||
1320 | { | ||
1321 | $$ = new LLScriptPreDecrement(gLine, gColumn, $2); | ||
1322 | } | ||
1323 | | typecast | ||
1324 | { | ||
1325 | $$ = $1; | ||
1326 | } | ||
1327 | | unarypostfixexpression | ||
1328 | { | ||
1329 | $$ = $1; | ||
1330 | } | ||
1331 | | '(' expression ')' | ||
1332 | { | ||
1333 | $$ = new LLScriptParenthesis(gLine, gColumn, $2); | ||
1334 | } | ||
1335 | ; | ||
1336 | |||
1337 | typecast | ||
1338 | : '(' typename ')' lvalue | ||
1339 | { | ||
1340 | $$ = new LLScriptTypeCast(gLine, gColumn, $2, $4); | ||
1341 | } | ||
1342 | | '(' typename ')' constant | ||
1343 | { | ||
1344 | LLScriptConstantExpression *temp = new LLScriptConstantExpression(gLine, gColumn, $4); | ||
1345 | $$ = new LLScriptTypeCast(gLine, gColumn, $2, temp); | ||
1346 | } | ||
1347 | | '(' typename ')' unarypostfixexpression | ||
1348 | { | ||
1349 | $$ = new LLScriptTypeCast(gLine, gColumn, $2, $4); | ||
1350 | } | ||
1351 | | '(' typename ')' '(' expression ')' | ||
1352 | { | ||
1353 | $$ = new LLScriptTypeCast(gLine, gColumn, $2, $5); | ||
1354 | } | ||
1355 | ; | ||
1356 | |||
1357 | unarypostfixexpression | ||
1358 | : vector_initializer | ||
1359 | { | ||
1360 | $$ = $1; | ||
1361 | } | ||
1362 | | quaternion_initializer | ||
1363 | { | ||
1364 | $$ = $1; | ||
1365 | } | ||
1366 | | list_initializer | ||
1367 | { | ||
1368 | $$ = $1; | ||
1369 | } | ||
1370 | | lvalue | ||
1371 | { | ||
1372 | $$ = $1; | ||
1373 | } | ||
1374 | | lvalue INC_OP | ||
1375 | { | ||
1376 | $$ = new LLScriptPostIncrement(gLine, gColumn, $1); | ||
1377 | } | ||
1378 | | lvalue DEC_OP | ||
1379 | { | ||
1380 | $$ = new LLScriptPostDecrement(gLine, gColumn, $1); | ||
1381 | } | ||
1382 | | IDENTIFIER '(' funcexpressionlist ')' | ||
1383 | { | ||
1384 | LLScriptIdentifier *id = new LLScriptIdentifier(gLine, gColumn, $1); | ||
1385 | $$ = new LLScriptFunctionCall(gLine, gColumn, id, $3); | ||
1386 | } | ||
1387 | | PRINT '(' expression ')' | ||
1388 | { | ||
1389 | $$ = new LLScriptPrint(gLine, gColumn, $3); | ||
1390 | } | ||
1391 | | constant | ||
1392 | { | ||
1393 | $$ = new LLScriptConstantExpression(gLine, gColumn, $1); | ||
1394 | } | ||
1395 | ; | ||
1396 | |||
1397 | vector_initializer | ||
1398 | : '<' expression ',' expression ',' expression '>' %prec INITIALIZER | ||
1399 | { | ||
1400 | $$ = new LLScriptVectorInitializer(gLine, gColumn, $2, $4, $6); | ||
1401 | } | ||
1402 | | ZERO_VECTOR | ||
1403 | { | ||
1404 | LLScriptConstantFloat *cf0 = new LLScriptConstantFloat(gLine, gColumn, 0.f); | ||
1405 | LLScriptConstantExpression *sa0 = new LLScriptConstantExpression(gLine, gColumn, cf0); | ||
1406 | LLScriptConstantFloat *cf1 = new LLScriptConstantFloat(gLine, gColumn, 0.f); | ||
1407 | LLScriptConstantExpression *sa1 = new LLScriptConstantExpression(gLine, gColumn, cf1); | ||
1408 | LLScriptConstantFloat *cf2 = new LLScriptConstantFloat(gLine, gColumn, 0.f); | ||
1409 | LLScriptConstantExpression *sa2 = new LLScriptConstantExpression(gLine, gColumn, cf2); | ||
1410 | $$ = new LLScriptVectorInitializer(gLine, gColumn, sa0, sa1, sa2); | ||
1411 | } | ||
1412 | | TOUCH_INVALID_VECTOR | ||
1413 | { | ||
1414 | LLScriptConstantFloat *cf0 = new LLScriptConstantFloat(gLine, gColumn, 0.f); | ||
1415 | LLScriptConstantExpression *sa0 = new LLScriptConstantExpression(gLine, gColumn, cf0); | ||
1416 | LLScriptConstantFloat *cf1 = new LLScriptConstantFloat(gLine, gColumn, 0.f); | ||
1417 | LLScriptConstantExpression *sa1 = new LLScriptConstantExpression(gLine, gColumn, cf1); | ||
1418 | LLScriptConstantFloat *cf2 = new LLScriptConstantFloat(gLine, gColumn, 0.f); | ||
1419 | LLScriptConstantExpression *sa2 = new LLScriptConstantExpression(gLine, gColumn, cf2); | ||
1420 | $$ = new LLScriptVectorInitializer(gLine, gColumn, sa0, sa1, sa2); | ||
1421 | } | ||
1422 | | TOUCH_INVALID_TEXCOORD | ||
1423 | { | ||
1424 | LLScriptConstantFloat *cf0 = new LLScriptConstantFloat(gLine, gColumn, -1.f); | ||
1425 | LLScriptConstantExpression *sa0 = new LLScriptConstantExpression(gLine, gColumn, cf0); | ||
1426 | LLScriptConstantFloat *cf1 = new LLScriptConstantFloat(gLine, gColumn, -1.f); | ||
1427 | LLScriptConstantExpression *sa1 = new LLScriptConstantExpression(gLine, gColumn, cf1); | ||
1428 | LLScriptConstantFloat *cf2 = new LLScriptConstantFloat(gLine, gColumn, 0.f); | ||
1429 | LLScriptConstantExpression *sa2 = new LLScriptConstantExpression(gLine, gColumn, cf2); | ||
1430 | $$ = new LLScriptVectorInitializer(gLine, gColumn, sa0, sa1, sa2); | ||
1431 | } | ||
1432 | ; | ||
1433 | |||
1434 | quaternion_initializer | ||
1435 | : '<' expression ',' expression ',' expression ',' expression '>' %prec INITIALIZER | ||
1436 | { | ||
1437 | $$ = new LLScriptQuaternionInitializer(gLine, gColumn, $2, $4, $6, $8); | ||
1438 | } | ||
1439 | | ZERO_ROTATION | ||
1440 | { | ||
1441 | LLScriptConstantFloat *cf0 = new LLScriptConstantFloat(gLine, gColumn, 0.f); | ||
1442 | LLScriptConstantExpression *sa0 = new LLScriptConstantExpression(gLine, gColumn, cf0); | ||
1443 | LLScriptConstantFloat *cf1 = new LLScriptConstantFloat(gLine, gColumn, 0.f); | ||
1444 | LLScriptConstantExpression *sa1 = new LLScriptConstantExpression(gLine, gColumn, cf1); | ||
1445 | LLScriptConstantFloat *cf2 = new LLScriptConstantFloat(gLine, gColumn, 0.f); | ||
1446 | LLScriptConstantExpression *sa2 = new LLScriptConstantExpression(gLine, gColumn, cf2); | ||
1447 | LLScriptConstantFloat *cf3 = new LLScriptConstantFloat(gLine, gColumn, 1.f); | ||
1448 | LLScriptConstantExpression *sa3 = new LLScriptConstantExpression(gLine, gColumn, cf3); | ||
1449 | $$ = new LLScriptQuaternionInitializer(gLine, gColumn, sa0, sa1, sa2, sa3); | ||
1450 | } | ||
1451 | ; | ||
1452 | |||
1453 | list_initializer | ||
1454 | : '[' listexpressionlist ']' %prec INITIALIZER | ||
1455 | { | ||
1456 | $$ = new LLScriptListInitializer(gLine, gColumn, $2); | ||
1457 | } | ||
1458 | ; | ||
1459 | |||
1460 | lvalue | ||
1461 | : IDENTIFIER | ||
1462 | { | ||
1463 | LLScriptIdentifier *id = new LLScriptIdentifier(gLine, gColumn, $1); | ||
1464 | $$ = new LLScriptLValue(gLine, gColumn, id, NULL); | ||
1465 | } | ||
1466 | | IDENTIFIER PERIOD IDENTIFIER | ||
1467 | { | ||
1468 | LLScriptIdentifier *id = new LLScriptIdentifier(gLine, gColumn, $1); | ||
1469 | LLScriptIdentifier *ac = new LLScriptIdentifier(gLine, gColumn, $3); | ||
1470 | $$ = new LLScriptLValue(gLine, gColumn, id, ac); | ||
1471 | } | ||
1472 | ; | ||
1473 | |||
1474 | %% | ||