PageRenderTime 54ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/lscript/lscript_compile/indra.y

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