summaryrefslogtreecommitdiff
path: root/indra/lscript/lscript_compile/indra.y
diff options
context:
space:
mode:
Diffstat (limited to 'indra/lscript/lscript_compile/indra.y')
-rw-r--r--indra/lscript/lscript_compile/indra.y44
1 files changed, 33 insertions, 11 deletions
diff --git a/indra/lscript/lscript_compile/indra.y b/indra/lscript/lscript_compile/indra.y
index 7744649a92..c7a4fd6289 100644
--- a/indra/lscript/lscript_compile/indra.y
+++ b/indra/lscript/lscript_compile/indra.y
@@ -143,6 +143,8 @@
%type <assignable> simple_assignable
%type <assignable> simple_assignable_no_list
%type <constant> constant
+%type <ival> integer_constant
+%type <fval> fp_constant
%type <assignable> special_constant
%type <assignable> vector_constant
%type <assignable> quaternion_constant
@@ -352,30 +354,50 @@ simple_assignable_no_list
;
constant
- : INTEGER_CONSTANT
+ : integer_constant
{
$$ = new LLScriptConstantInteger(gLine, gColumn, $1);
gAllocationManager->addAllocation($$);
}
- | INTEGER_TRUE
+ | fp_constant
{
- $$ = new LLScriptConstantInteger(gLine, gColumn, $1);
+ $$ = new LLScriptConstantFloat(gLine, gColumn, $1);
gAllocationManager->addAllocation($$);
}
- | INTEGER_FALSE
+ | STRING_CONSTANT
{
- $$ = new LLScriptConstantInteger(gLine, gColumn, $1);
+ $$ = new LLScriptConstantString(gLine, gColumn, $1);
gAllocationManager->addAllocation($$);
}
- | FP_CONSTANT
+ ;
+
+fp_constant
+ : FP_CONSTANT
{
- $$ = new LLScriptConstantFloat(gLine, gColumn, $1);
- gAllocationManager->addAllocation($$);
+ $$ = $1;
}
- | STRING_CONSTANT
+ | '-' FP_CONSTANT
{
- $$ = new LLScriptConstantString(gLine, gColumn, $1);
- gAllocationManager->addAllocation($$);
+ $$ = -$2;
+ }
+ ;
+
+integer_constant
+ : INTEGER_CONSTANT
+ {
+ $$ = $1;
+ }
+ | INTEGER_TRUE
+ {
+ $$ = $1;
+ }
+ | INTEGER_FALSE
+ {
+ $$ = $1;
+ }
+ | '-' INTEGER_CONSTANT
+ {
+ $$ = -$2;
}
;