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