indra.y
上传用户:king477883
上传日期:2021-03-01
资源大小:9553k
文件大小:49k
源码类别:

游戏引擎

开发平台:

C++ Builder

  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. $$ = $1;
  1230. }
  1231. | IF '(' expression ')' statement %prec LOWER_THAN_ELSE
  1232. {  
  1233. $$ = new LLScriptIf(gLine, gColumn, $3, $5);
  1234. $5->mAllowDeclarations = FALSE;
  1235. gAllocationManager->addAllocation($$);
  1236. }
  1237. | IF '(' expression ')' statement ELSE statement
  1238. {  
  1239. $$ = new LLScriptIfElse(gLine, gColumn, $3, $5, $7);
  1240. $5->mAllowDeclarations = FALSE;
  1241. $7->mAllowDeclarations = FALSE;
  1242. gAllocationManager->addAllocation($$);
  1243. }
  1244. | FOR '(' forexpressionlist ';' expression ';' forexpressionlist ')' statement
  1245. {  
  1246. $$ = new LLScriptFor(gLine, gColumn, $3, $5, $7, $9);
  1247. $9->mAllowDeclarations = FALSE;
  1248. gAllocationManager->addAllocation($$);
  1249. }
  1250. | DO statement WHILE '(' expression ')' ';' 
  1251. {  
  1252. $$ = new LLScriptDoWhile(gLine, gColumn, $2, $5);
  1253. $2->mAllowDeclarations = FALSE;
  1254. gAllocationManager->addAllocation($$);
  1255. }
  1256. | WHILE '(' expression ')' statement
  1257. {  
  1258. $$ = new LLScriptWhile(gLine, gColumn, $3, $5);
  1259. $5->mAllowDeclarations = FALSE;
  1260. gAllocationManager->addAllocation($$);
  1261. }
  1262. ;
  1263. declaration
  1264. : typename IDENTIFIER
  1265. {  
  1266. LLScriptIdentifier *id = new LLScriptIdentifier(gLine, gColumn, $2);
  1267. gAllocationManager->addAllocation(id);
  1268. $$ = new LLScriptDeclaration(gLine, gColumn, $1, id, NULL);
  1269. gAllocationManager->addAllocation($$);
  1270. }
  1271. | typename IDENTIFIER '=' expression
  1272. {  
  1273. LLScriptIdentifier *id = new LLScriptIdentifier(gLine, gColumn, $2);
  1274. gAllocationManager->addAllocation(id);
  1275. $$ = new LLScriptDeclaration(gLine, gColumn, $1, id, $4);
  1276. gAllocationManager->addAllocation($$);
  1277. }
  1278. ;
  1279. forexpressionlist
  1280. : /* empty */
  1281. {  
  1282. $$ = NULL;
  1283. }
  1284. | nextforexpressionlist
  1285. {
  1286. $$ = $1;
  1287. }
  1288. ;
  1289. nextforexpressionlist
  1290. : expression
  1291. {  
  1292. $$ = new LLScriptForExpressionList(gLine, gColumn, $1, NULL);
  1293. gAllocationManager->addAllocation($$);
  1294. }
  1295. | expression ',' nextforexpressionlist
  1296. {
  1297. $$ = new LLScriptForExpressionList(gLine, gColumn, $1, $3);
  1298. gAllocationManager->addAllocation($$);
  1299. }
  1300. ;
  1301. funcexpressionlist
  1302. : /* empty */
  1303. {  
  1304. $$ = NULL;
  1305. }
  1306. | nextfuncexpressionlist
  1307. {
  1308. $$ = $1;
  1309. }
  1310. ;
  1311. nextfuncexpressionlist
  1312. : expression
  1313. {  
  1314. $$ = new LLScriptFuncExpressionList(gLine, gColumn, $1, NULL);
  1315. gAllocationManager->addAllocation($$);
  1316. }
  1317. | expression ',' nextfuncexpressionlist
  1318. {
  1319. $$ = new LLScriptFuncExpressionList(gLine, gColumn, $1, $3);
  1320. gAllocationManager->addAllocation($$);
  1321. }
  1322. ;
  1323. listexpressionlist
  1324. : /* empty */
  1325. {  
  1326. $$ = NULL;
  1327. }
  1328. | nextlistexpressionlist
  1329. {
  1330. $$ = $1;
  1331. }
  1332. ;
  1333. nextlistexpressionlist
  1334. : expression
  1335. {  
  1336. $$ = new LLScriptListExpressionList(gLine, gColumn, $1, NULL);
  1337. gAllocationManager->addAllocation($$);
  1338. }
  1339. | expression ',' nextlistexpressionlist
  1340. {
  1341. $$ = new LLScriptListExpressionList(gLine, gColumn, $1, $3);
  1342. gAllocationManager->addAllocation($$);
  1343. }
  1344. ;
  1345. expression
  1346. : unaryexpression
  1347. {  
  1348. $$ = $1;
  1349. }
  1350. | lvalue '=' expression
  1351. {  
  1352. $$ = new LLScriptAssignment(gLine, gColumn, $1, $3);
  1353. gAllocationManager->addAllocation($$);
  1354. }
  1355. | lvalue ADD_ASSIGN expression
  1356. {  
  1357. $$ = new LLScriptAddAssignment(gLine, gColumn, $1, $3);
  1358. gAllocationManager->addAllocation($$);
  1359. }
  1360. | lvalue SUB_ASSIGN expression
  1361. {  
  1362. $$ = new LLScriptSubAssignment(gLine, gColumn, $1, $3);
  1363. gAllocationManager->addAllocation($$);
  1364. }
  1365. | lvalue MUL_ASSIGN expression
  1366. {  
  1367. $$ = new LLScriptMulAssignment(gLine, gColumn, $1, $3);
  1368. gAllocationManager->addAllocation($$);
  1369. }
  1370. | lvalue DIV_ASSIGN expression
  1371. {  
  1372. $$ = new LLScriptDivAssignment(gLine, gColumn, $1, $3);
  1373. gAllocationManager->addAllocation($$);
  1374. }
  1375. | lvalue MOD_ASSIGN expression
  1376. {  
  1377. $$ = new LLScriptModAssignment(gLine, gColumn, $1, $3);
  1378. gAllocationManager->addAllocation($$);
  1379. }
  1380. | expression EQ expression
  1381. {  
  1382. $$ = new LLScriptEquality(gLine, gColumn, $1, $3);
  1383. gAllocationManager->addAllocation($$);
  1384. }
  1385. | expression NEQ expression
  1386. {  
  1387. $$ = new LLScriptNotEquals(gLine, gColumn, $1, $3);
  1388. gAllocationManager->addAllocation($$);
  1389. }
  1390. | expression LEQ expression
  1391. {  
  1392. $$ = new LLScriptLessEquals(gLine, gColumn, $1, $3);
  1393. gAllocationManager->addAllocation($$);
  1394. }
  1395. | expression GEQ expression
  1396. {  
  1397. $$ = new LLScriptGreaterEquals(gLine, gColumn, $1, $3);
  1398. gAllocationManager->addAllocation($$);
  1399. }
  1400. | expression '<' expression
  1401. {  
  1402. $$ = new LLScriptLessThan(gLine, gColumn, $1, $3);
  1403. gAllocationManager->addAllocation($$);
  1404. }
  1405. | expression '>' expression
  1406. {  
  1407. $$ = new LLScriptGreaterThan(gLine, gColumn, $1, $3);
  1408. gAllocationManager->addAllocation($$);
  1409. }
  1410. | expression '+' expression
  1411. {  
  1412. $$ = new LLScriptPlus(gLine, gColumn, $1, $3);
  1413. gAllocationManager->addAllocation($$);
  1414. }
  1415. | expression '-' expression
  1416. {  
  1417. $$ = new LLScriptMinus(gLine, gColumn, $1, $3);
  1418. gAllocationManager->addAllocation($$);
  1419. }
  1420. | expression '*' expression
  1421. {  
  1422. $$ = new LLScriptTimes(gLine, gColumn, $1, $3);
  1423. gAllocationManager->addAllocation($$);
  1424. }
  1425. | expression '/' expression
  1426. {  
  1427. $$ = new LLScriptDivide(gLine, gColumn, $1, $3);
  1428. gAllocationManager->addAllocation($$);
  1429. }
  1430. | expression '%' expression
  1431. {  
  1432. $$ = new LLScriptMod(gLine, gColumn, $1, $3);
  1433. gAllocationManager->addAllocation($$);
  1434. }
  1435. | expression '&' expression
  1436. {  
  1437. $$ = new LLScriptBitAnd(gLine, gColumn, $1, $3);
  1438. gAllocationManager->addAllocation($$);
  1439. }
  1440. | expression '|' expression
  1441. {  
  1442. $$ = new LLScriptBitOr(gLine, gColumn, $1, $3);
  1443. gAllocationManager->addAllocation($$);
  1444. }
  1445. | expression '^' expression
  1446. {  
  1447. $$ = new LLScriptBitXor(gLine, gColumn, $1, $3);
  1448. gAllocationManager->addAllocation($$);
  1449. }
  1450. | expression BOOLEAN_AND expression
  1451. {  
  1452. $$ = new LLScriptBooleanAnd(gLine, gColumn, $1, $3);
  1453. gAllocationManager->addAllocation($$);
  1454. }
  1455. | expression BOOLEAN_OR expression
  1456. {  
  1457. $$ = new LLScriptBooleanOr(gLine, gColumn, $1, $3);
  1458. gAllocationManager->addAllocation($$);
  1459. }
  1460. | expression SHIFT_LEFT expression
  1461. {
  1462. $$ = new LLScriptShiftLeft(gLine, gColumn, $1, $3);
  1463. gAllocationManager->addAllocation($$);
  1464. }
  1465. | expression SHIFT_RIGHT expression
  1466. {
  1467. $$ = new LLScriptShiftRight(gLine, gColumn, $1, $3);
  1468. gAllocationManager->addAllocation($$);
  1469. }
  1470. ;
  1471. unaryexpression
  1472. : '-' expression
  1473. {  
  1474. $$ = new LLScriptUnaryMinus(gLine, gColumn, $2);
  1475. gAllocationManager->addAllocation($$);
  1476. }
  1477. | '!' expression
  1478. {  
  1479. $$ = new LLScriptBooleanNot(gLine, gColumn, $2);
  1480. gAllocationManager->addAllocation($$);
  1481. }
  1482. | '~' expression
  1483. {  
  1484. $$ = new LLScriptBitNot(gLine, gColumn, $2);
  1485. gAllocationManager->addAllocation($$);
  1486. }
  1487. | INC_OP lvalue
  1488. {  
  1489. $$ = new LLScriptPreIncrement(gLine, gColumn, $2);
  1490. gAllocationManager->addAllocation($$);
  1491. }
  1492. | DEC_OP lvalue
  1493. {  
  1494. $$ = new LLScriptPreDecrement(gLine, gColumn, $2);
  1495. gAllocationManager->addAllocation($$);
  1496. }
  1497. | typecast
  1498. {
  1499. $$ = $1;
  1500. }
  1501. | unarypostfixexpression
  1502. {  
  1503. $$ = $1;
  1504. }
  1505. | '(' expression ')'
  1506. {  
  1507. $$ = new LLScriptParenthesis(gLine, gColumn, $2);
  1508. gAllocationManager->addAllocation($$);
  1509. }
  1510. ;
  1511. typecast
  1512. : '(' typename ')' lvalue
  1513. {
  1514. $$ = new LLScriptTypeCast(gLine, gColumn, $2, $4);
  1515. gAllocationManager->addAllocation($$);
  1516. }
  1517. | '(' typename ')' constant
  1518. {
  1519. LLScriptConstantExpression *temp =  new LLScriptConstantExpression(gLine, gColumn, $4);
  1520. gAllocationManager->addAllocation(temp);
  1521. $$ = new LLScriptTypeCast(gLine, gColumn, $2, temp);
  1522. gAllocationManager->addAllocation($$);
  1523. }
  1524. | '(' typename ')' unarypostfixexpression
  1525. {
  1526. $$ = new LLScriptTypeCast(gLine, gColumn, $2, $4);
  1527. gAllocationManager->addAllocation($$);
  1528. }
  1529. | '(' typename ')' '(' expression ')'
  1530. {
  1531. $$ = new LLScriptTypeCast(gLine, gColumn, $2, $5);
  1532. gAllocationManager->addAllocation($$);
  1533. }
  1534. ;
  1535. unarypostfixexpression
  1536. : vector_initializer 
  1537. {  
  1538. $$ = $1;
  1539. }
  1540. | quaternion_initializer
  1541. {
  1542. $$ = $1;
  1543. }
  1544. | list_initializer
  1545. {  
  1546. $$ = $1;
  1547. }
  1548. | lvalue
  1549. {  
  1550. $$ = $1;
  1551. }
  1552. | lvalue INC_OP
  1553. {  
  1554. $$ = new LLScriptPostIncrement(gLine, gColumn, $1);
  1555. gAllocationManager->addAllocation($$);
  1556. }
  1557. | lvalue DEC_OP
  1558. {  
  1559. $$ = new LLScriptPostDecrement(gLine, gColumn, $1);
  1560. gAllocationManager->addAllocation($$);
  1561. }
  1562. | IDENTIFIER '(' funcexpressionlist ')'
  1563. {  
  1564. LLScriptIdentifier *id = new LLScriptIdentifier(gLine, gColumn, $1);
  1565. gAllocationManager->addAllocation(id);
  1566. $$ = new LLScriptFunctionCall(gLine, gColumn, id, $3);
  1567. gAllocationManager->addAllocation($$);
  1568. }
  1569. | PRINT '(' expression ')'
  1570. {  
  1571. $$ = new LLScriptPrint(gLine, gColumn, $3);
  1572. gAllocationManager->addAllocation($$);
  1573. }
  1574. | constant
  1575. {  
  1576. $$ = new LLScriptConstantExpression(gLine, gColumn, $1);
  1577. gAllocationManager->addAllocation($$);
  1578. }
  1579. ;
  1580. vector_initializer
  1581. : '<' expression ',' expression ',' expression '>' %prec INITIALIZER
  1582. {
  1583. $$ = new LLScriptVectorInitializer(gLine, gColumn, $2, $4, $6);
  1584. gAllocationManager->addAllocation($$);
  1585. }
  1586. | ZERO_VECTOR
  1587. {
  1588. LLScriptConstantFloat *cf0 = new LLScriptConstantFloat(gLine, gColumn, 0.f);
  1589. gAllocationManager->addAllocation(cf0);
  1590. LLScriptConstantExpression *sa0 = new LLScriptConstantExpression(gLine, gColumn, cf0);
  1591. gAllocationManager->addAllocation(sa0);
  1592. LLScriptConstantFloat *cf1 = new LLScriptConstantFloat(gLine, gColumn, 0.f);
  1593. gAllocationManager->addAllocation(cf1);
  1594. LLScriptConstantExpression *sa1 = new LLScriptConstantExpression(gLine, gColumn, cf1);
  1595. gAllocationManager->addAllocation(sa1);
  1596. LLScriptConstantFloat *cf2 = new LLScriptConstantFloat(gLine, gColumn, 0.f);
  1597. gAllocationManager->addAllocation(cf2);
  1598. LLScriptConstantExpression *sa2 = new LLScriptConstantExpression(gLine, gColumn, cf2);
  1599. gAllocationManager->addAllocation(sa2);
  1600. $$ = new LLScriptVectorInitializer(gLine, gColumn, sa0, sa1, sa2);
  1601. gAllocationManager->addAllocation($$);
  1602. }
  1603. | TOUCH_INVALID_VECTOR
  1604. {
  1605. LLScriptConstantFloat *cf0 = new LLScriptConstantFloat(gLine, gColumn, 0.f);
  1606. gAllocationManager->addAllocation(cf0);
  1607. LLScriptConstantExpression *sa0 = new LLScriptConstantExpression(gLine, gColumn, cf0);
  1608. gAllocationManager->addAllocation(sa0);
  1609. LLScriptConstantFloat *cf1 = new LLScriptConstantFloat(gLine, gColumn, 0.f);
  1610. gAllocationManager->addAllocation(cf1);
  1611. LLScriptConstantExpression *sa1 = new LLScriptConstantExpression(gLine, gColumn, cf1);
  1612. gAllocationManager->addAllocation(sa1);
  1613. LLScriptConstantFloat *cf2 = new LLScriptConstantFloat(gLine, gColumn, 0.f);
  1614. gAllocationManager->addAllocation(cf2);
  1615. LLScriptConstantExpression *sa2 = new LLScriptConstantExpression(gLine, gColumn, cf2);
  1616. gAllocationManager->addAllocation(sa2);
  1617. $$ = new LLScriptVectorInitializer(gLine, gColumn, sa0, sa1, sa2);
  1618. gAllocationManager->addAllocation($$);
  1619. }
  1620. | TOUCH_INVALID_TEXCOORD
  1621. {
  1622. LLScriptConstantFloat *cf0 = new LLScriptConstantFloat(gLine, gColumn, -1.f);
  1623. gAllocationManager->addAllocation(cf0);
  1624. LLScriptConstantExpression *sa0 = new LLScriptConstantExpression(gLine, gColumn, cf0);
  1625. gAllocationManager->addAllocation(sa0);
  1626. LLScriptConstantFloat *cf1 = new LLScriptConstantFloat(gLine, gColumn, -1.f);
  1627. gAllocationManager->addAllocation(cf1);
  1628. LLScriptConstantExpression *sa1 = new LLScriptConstantExpression(gLine, gColumn, cf1);
  1629. gAllocationManager->addAllocation(sa1);
  1630. LLScriptConstantFloat *cf2 = new LLScriptConstantFloat(gLine, gColumn, 0.f);
  1631. gAllocationManager->addAllocation(cf2);
  1632. LLScriptConstantExpression *sa2 = new LLScriptConstantExpression(gLine, gColumn, cf2);
  1633. gAllocationManager->addAllocation(sa2);
  1634. $$ = new LLScriptVectorInitializer(gLine, gColumn, sa0, sa1, sa2);
  1635. gAllocationManager->addAllocation($$);
  1636. }
  1637. ;
  1638. quaternion_initializer
  1639. : '<' expression ',' expression ',' expression ',' expression '>' %prec INITIALIZER
  1640. {
  1641. $$ = new LLScriptQuaternionInitializer(gLine, gColumn, $2, $4, $6, $8);
  1642. gAllocationManager->addAllocation($$);
  1643. }
  1644. | ZERO_ROTATION
  1645. {
  1646. LLScriptConstantFloat *cf0 = new LLScriptConstantFloat(gLine, gColumn, 0.f);
  1647. gAllocationManager->addAllocation(cf0);
  1648. LLScriptConstantExpression *sa0 = new LLScriptConstantExpression(gLine, gColumn, cf0);
  1649. gAllocationManager->addAllocation(sa0);
  1650. LLScriptConstantFloat *cf1 = new LLScriptConstantFloat(gLine, gColumn, 0.f);
  1651. gAllocationManager->addAllocation(cf1);
  1652. LLScriptConstantExpression *sa1 = new LLScriptConstantExpression(gLine, gColumn, cf1);
  1653. gAllocationManager->addAllocation(sa1);
  1654. LLScriptConstantFloat *cf2 = new LLScriptConstantFloat(gLine, gColumn, 0.f);
  1655. gAllocationManager->addAllocation(cf2);
  1656. LLScriptConstantExpression *sa2 = new LLScriptConstantExpression(gLine, gColumn, cf2);
  1657. gAllocationManager->addAllocation(sa2);
  1658. LLScriptConstantFloat *cf3 = new LLScriptConstantFloat(gLine, gColumn, 1.f);
  1659. gAllocationManager->addAllocation(cf3);
  1660. LLScriptConstantExpression *sa3 = new LLScriptConstantExpression(gLine, gColumn, cf3);
  1661. gAllocationManager->addAllocation(sa3);
  1662. $$ = new LLScriptQuaternionInitializer(gLine, gColumn, sa0, sa1, sa2, sa3);
  1663. gAllocationManager->addAllocation($$);
  1664. }
  1665. ;
  1666. list_initializer
  1667. : '[' listexpressionlist ']' %prec INITIALIZER
  1668. {  
  1669. $$ = new LLScriptListInitializer(gLine, gColumn, $2);
  1670. gAllocationManager->addAllocation($$);
  1671. }
  1672. ;
  1673. lvalue 
  1674. : IDENTIFIER
  1675. {  
  1676. LLScriptIdentifier *id = new LLScriptIdentifier(gLine, gColumn, $1);
  1677. gAllocationManager->addAllocation(id);
  1678. $$ = new LLScriptLValue(gLine, gColumn, id, NULL);
  1679. gAllocationManager->addAllocation($$);
  1680. }
  1681. | IDENTIFIER PERIOD IDENTIFIER
  1682. {
  1683. LLScriptIdentifier *id = new LLScriptIdentifier(gLine, gColumn, $1);
  1684. gAllocationManager->addAllocation(id);
  1685. LLScriptIdentifier *ac = new LLScriptIdentifier(gLine, gColumn, $3);
  1686. gAllocationManager->addAllocation(id);
  1687. $$ = new LLScriptLValue(gLine, gColumn, id, ac);
  1688. gAllocationManager->addAllocation($$);
  1689. }
  1690. ;
  1691. %%