|
@@ -96,7 +96,9 @@ let test_negative_numeric_expression () =
|
|
|
|
|
|
let test_negative_numeric_expression2 () =
|
|
let test_negative_numeric_expression2 () =
|
|
let index = None in
|
|
let index = None in
|
|
- let var = { Ast.pos = _position; name = "CURTIMESUN"; index } in
|
|
|
|
|
|
+ let var =
|
|
|
|
+ { Ast.pos = _position; name = "CURTIMESUN"; index; local = false }
|
|
|
|
+ in
|
|
_test_instruction "-(780-CurTimeSun)"
|
|
_test_instruction "-(780-CurTimeSun)"
|
|
Ast.
|
|
Ast.
|
|
[
|
|
[
|
|
@@ -110,22 +112,22 @@ let test_negative_numeric_expression2 () =
|
|
|
|
|
|
let test_str_variable () =
|
|
let test_str_variable () =
|
|
let index = None in
|
|
let index = None in
|
|
- let var = { Ast.pos = _position; name = "$VALUE"; index } in
|
|
|
|
|
|
+ let var = { Ast.pos = _position; name = "$VALUE"; index; local = false } in
|
|
_test_instruction "$value" [ Expression (Ident var) ]
|
|
_test_instruction "$value" [ Expression (Ident var) ]
|
|
|
|
|
|
let test_variable () =
|
|
let test_variable () =
|
|
let index = None in
|
|
let index = None in
|
|
- let var = { Ast.pos = _position; name = "VALUE"; index } in
|
|
|
|
|
|
+ let var = { Ast.pos = _position; name = "VALUE"; index; local = false } in
|
|
_test_instruction "value" [ Expression (Ident var) ]
|
|
_test_instruction "value" [ Expression (Ident var) ]
|
|
|
|
|
|
let test_indexed_variable () =
|
|
let test_indexed_variable () =
|
|
let index = Some Ast.(Integer (_position, "1")) in
|
|
let index = Some Ast.(Integer (_position, "1")) in
|
|
- let var = { Ast.pos = _position; name = "VALUE"; index } in
|
|
|
|
|
|
+ let var = { Ast.pos = _position; name = "VALUE"; index; local = false } in
|
|
_test_instruction "value[1]" [ Expression (Ident var) ]
|
|
_test_instruction "value[1]" [ Expression (Ident var) ]
|
|
|
|
|
|
let test_let_literal () =
|
|
let test_let_literal () =
|
|
let index = None in
|
|
let index = None in
|
|
- let var = { Ast.pos = _position; name = "VALUE"; index } in
|
|
|
|
|
|
+ let var = { Ast.pos = _position; name = "VALUE"; index; local = false } in
|
|
_test_instruction "let value = '123'"
|
|
_test_instruction "let value = '123'"
|
|
Ast.
|
|
Ast.
|
|
[
|
|
[
|
|
@@ -133,14 +135,16 @@ let test_let_literal () =
|
|
]
|
|
]
|
|
|
|
|
|
let test_set_array_append () =
|
|
let test_set_array_append () =
|
|
- let var = { Ast.pos = _position; name = "$VALUE"; index = None } in
|
|
|
|
|
|
+ let var =
|
|
|
|
+ { Ast.pos = _position; name = "$VALUE"; index = None; local = false }
|
|
|
|
+ in
|
|
_test_instruction "set $value[] = ''"
|
|
_test_instruction "set $value[] = ''"
|
|
Ast.
|
|
Ast.
|
|
[ Declaration (_position, var, Eq', Literal (_position, [ T.Text "" ])) ]
|
|
[ Declaration (_position, var, Eq', Literal (_position, [ T.Text "" ])) ]
|
|
|
|
|
|
let test_direct_assignation () =
|
|
let test_direct_assignation () =
|
|
let index = None in
|
|
let index = None in
|
|
- let var = { Ast.pos = _position; name = "VALUE"; index } in
|
|
|
|
|
|
+ let var = { Ast.pos = _position; name = "VALUE"; index; local = false } in
|
|
_test_instruction "value = '123'"
|
|
_test_instruction "value = '123'"
|
|
Ast.
|
|
Ast.
|
|
[
|
|
[
|
|
@@ -149,7 +153,7 @@ let test_direct_assignation () =
|
|
|
|
|
|
let test_command_assignation () =
|
|
let test_command_assignation () =
|
|
let index = None in
|
|
let index = None in
|
|
- let st_1 = { Ast.pos = _position; name = "ST_1"; index } in
|
|
|
|
|
|
+ let st_1 = { Ast.pos = _position; name = "ST_1"; index; local = false } in
|
|
_test_instruction "st_1 = input 'Enter the amount'"
|
|
_test_instruction "st_1 = input 'Enter the amount'"
|
|
Ast.
|
|
Ast.
|
|
[
|
|
[
|
|
@@ -165,13 +169,13 @@ let test_command_assignation () =
|
|
|
|
|
|
let test_assignation2 () =
|
|
let test_assignation2 () =
|
|
let index = None in
|
|
let index = None in
|
|
- let var = { Ast.pos = _position; name = "VALUE"; index } in
|
|
|
|
|
|
+ let var = { Ast.pos = _position; name = "VALUE"; index; local = false } in
|
|
_test_instruction "set value += 123"
|
|
_test_instruction "set value += 123"
|
|
Ast.[ Declaration (_position, var, Inc, Integer (_position, "123")) ]
|
|
Ast.[ Declaration (_position, var, Inc, Integer (_position, "123")) ]
|
|
|
|
|
|
let test_multilie_literal () =
|
|
let test_multilie_literal () =
|
|
let index = None in
|
|
let index = None in
|
|
- let var = { Ast.pos = _position; name = "VALUE"; index } in
|
|
|
|
|
|
+ let var = { Ast.pos = _position; name = "VALUE"; index; local = false } in
|
|
_test_instruction {|
|
|
_test_instruction {|
|
|
value = {
|
|
value = {
|
|
$a = '123'
|
|
$a = '123'
|
|
@@ -194,7 +198,7 @@ let test_nested_literal () =
|
|
[
|
|
[
|
|
Ast.Declaration
|
|
Ast.Declaration
|
|
( _position,
|
|
( _position,
|
|
- { Ast.pos = _position; name = "VALUE"; index = None },
|
|
|
|
|
|
+ { Ast.pos = _position; name = "VALUE"; index = None; local = false },
|
|
Qsp_syntax.T.Eq',
|
|
Qsp_syntax.T.Eq',
|
|
Ast.Literal (_position, [ T.Text "\n\n {\n\n }\n" ]) );
|
|
Ast.Literal (_position, [ T.Text "\n\n {\n\n }\n" ]) );
|
|
]
|
|
]
|
|
@@ -228,8 +232,8 @@ pears = 10
|
|
|} in
|
|
|} in
|
|
|
|
|
|
let index = None in
|
|
let index = None in
|
|
- let apples = { Ast.pos = _position; name = "APPLES"; index }
|
|
|
|
- and pears = { Ast.pos = _position; name = "PEARS"; index }
|
|
|
|
|
|
+ let apples = { Ast.pos = _position; name = "APPLES"; index; local = false }
|
|
|
|
+ and pears = { Ast.pos = _position; name = "PEARS"; index; local = false }
|
|
and value_5 = Ast.Integer (_position, "5")
|
|
and value_5 = Ast.Integer (_position, "5")
|
|
and value_10 = Ast.Integer (_position, "10") in
|
|
and value_10 = Ast.Integer (_position, "10") in
|
|
_test_instruction content
|
|
_test_instruction content
|
|
@@ -243,8 +247,8 @@ let test_multiline2 () =
|
|
let content = "apples = 5 & pears = 10" in
|
|
let content = "apples = 5 & pears = 10" in
|
|
|
|
|
|
let index = None in
|
|
let index = None in
|
|
- let apples = { Ast.pos = _position; name = "APPLES"; index }
|
|
|
|
- and pears = { Ast.pos = _position; name = "PEARS"; index }
|
|
|
|
|
|
+ let apples = { Ast.pos = _position; name = "APPLES"; index; local = false }
|
|
|
|
+ and pears = { Ast.pos = _position; name = "PEARS"; index; local = false }
|
|
and value_5 = Ast.Integer (_position, "5")
|
|
and value_5 = Ast.Integer (_position, "5")
|
|
and value_10 = Ast.Integer (_position, "10") in
|
|
and value_10 = Ast.Integer (_position, "10") in
|
|
_test_instruction content
|
|
_test_instruction content
|
|
@@ -256,8 +260,8 @@ let test_multiline2 () =
|
|
let test_equality () =
|
|
let test_equality () =
|
|
let content = "apples = 5 = pears" in
|
|
let content = "apples = 5 = pears" in
|
|
let index = None in
|
|
let index = None in
|
|
- let apples = { Ast.pos = _position; name = "APPLES"; index }
|
|
|
|
- and pears = { Ast.pos = _position; name = "PEARS"; index }
|
|
|
|
|
|
+ let apples = { Ast.pos = _position; name = "APPLES"; index; local = false }
|
|
|
|
+ and pears = { Ast.pos = _position; name = "PEARS"; index; local = false }
|
|
and value_5 = Ast.Integer (_position, "5") in
|
|
and value_5 = Ast.Integer (_position, "5") in
|
|
_test_instruction content
|
|
_test_instruction content
|
|
[
|
|
[
|
|
@@ -270,8 +274,8 @@ let test_plus () =
|
|
apples = 5 + pears
|
|
apples = 5 + pears
|
|
|} in
|
|
|} in
|
|
let index = None in
|
|
let index = None in
|
|
- let apples = { Ast.pos = _position; name = "APPLES"; index }
|
|
|
|
- and pears = { Ast.pos = _position; name = "PEARS"; index }
|
|
|
|
|
|
+ let apples = { Ast.pos = _position; name = "APPLES"; index; local = false }
|
|
|
|
+ and pears = { Ast.pos = _position; name = "PEARS"; index; local = false }
|
|
and value_5 = Ast.Integer (_position, "5") in
|
|
and value_5 = Ast.Integer (_position, "5") in
|
|
_test_instruction content
|
|
_test_instruction content
|
|
[
|
|
[
|
|
@@ -287,7 +291,7 @@ let test_plus_litt () =
|
|
'five'+ pears
|
|
'five'+ pears
|
|
|} in
|
|
|} in
|
|
let index = None in
|
|
let index = None in
|
|
- let pears = { Ast.pos = _position; name = "PEARS"; index } in
|
|
|
|
|
|
+ let pears = { Ast.pos = _position; name = "PEARS"; index; local = false } in
|
|
_test_instruction content
|
|
_test_instruction content
|
|
[
|
|
[
|
|
Ast.(
|
|
Ast.(
|
|
@@ -317,10 +321,16 @@ $firstName + ' ' + $lastName
|
|
Tree.Ast.pos = _position;
|
|
Tree.Ast.pos = _position;
|
|
name = "$FIRSTNAME";
|
|
name = "$FIRSTNAME";
|
|
index = None;
|
|
index = None;
|
|
|
|
+ local = false;
|
|
},
|
|
},
|
|
Tree.Ast.Literal (_position, [ T.Text " " ]) ),
|
|
Tree.Ast.Literal (_position, [ T.Text " " ]) ),
|
|
Tree.Ast.Ident
|
|
Tree.Ast.Ident
|
|
- { Tree.Ast.pos = _position; name = "$LASTNAME"; index = None } ));
|
|
|
|
|
|
+ {
|
|
|
|
+ Tree.Ast.pos = _position;
|
|
|
|
+ name = "$LASTNAME";
|
|
|
|
+ index = None;
|
|
|
|
+ local = false;
|
|
|
|
+ } ));
|
|
]
|
|
]
|
|
|
|
|
|
let test_mod () =
|
|
let test_mod () =
|
|
@@ -338,7 +348,7 @@ let test_comment () = _test_instruction "! Comment" [ Comment _position ]
|
|
|
|
|
|
let test_comment2 () =
|
|
let test_comment2 () =
|
|
let index = None in
|
|
let index = None in
|
|
- let a = { Ast.pos = _position; name = "A"; index }
|
|
|
|
|
|
+ let a = { Ast.pos = _position; name = "A"; index; local = false }
|
|
and value_0 = Ast.Integer (_position, "0") in
|
|
and value_0 = Ast.Integer (_position, "0") in
|
|
_test_instruction "a = 0 &! Comment"
|
|
_test_instruction "a = 0 &! Comment"
|
|
Ast.[ Declaration (_position, a, Eq', value_0); Comment _position ]
|
|
Ast.[ Declaration (_position, a, Eq', value_0); Comment _position ]
|
|
@@ -349,7 +359,7 @@ let test_comment3 () = _test_instruction {|!!1234
|
|
(** The exclamation mark here is an operation and not a comment *)
|
|
(** The exclamation mark here is an operation and not a comment *)
|
|
let test_comment4 () =
|
|
let test_comment4 () =
|
|
let index = None in
|
|
let index = None in
|
|
- let a = { Ast.pos = _position; name = "A"; index }
|
|
|
|
|
|
+ let a = { Ast.pos = _position; name = "A"; index; local = false }
|
|
and value_0 = Ast.Integer (_position, "0") in
|
|
and value_0 = Ast.Integer (_position, "0") in
|
|
_test_instruction "a = rand(0, 1) ! 0"
|
|
_test_instruction "a = rand(0, 1) ! 0"
|
|
[
|
|
[
|
|
@@ -373,7 +383,7 @@ let test_comment5 () =
|
|
[
|
|
[
|
|
Ast.Declaration
|
|
Ast.Declaration
|
|
( _position,
|
|
( _position,
|
|
- { Ast.pos = _position; name = "A"; index = None },
|
|
|
|
|
|
+ { Ast.pos = _position; name = "A"; index = None; local = false },
|
|
Qsp_syntax.T.Eq',
|
|
Qsp_syntax.T.Eq',
|
|
Ast.Function (_position, Rand, []) );
|
|
Ast.Function (_position, Rand, []) );
|
|
Ast.Comment _position;
|
|
Ast.Comment _position;
|
|
@@ -404,8 +414,8 @@ also count}. This is still the same comment. |}
|
|
*)
|
|
*)
|
|
let test_precedence () =
|
|
let test_precedence () =
|
|
let index = None in
|
|
let index = None in
|
|
- let x = Ast.Ident { Ast.pos = _position; name = "X"; index }
|
|
|
|
- and y = Ast.Ident { Ast.pos = _position; name = "Y"; index } in
|
|
|
|
|
|
+ let x = Ast.Ident { Ast.pos = _position; name = "X"; index; local = false }
|
|
|
|
+ and y = Ast.Ident { Ast.pos = _position; name = "Y"; index; local = false } in
|
|
_test_instruction "no x = y"
|
|
_test_instruction "no x = y"
|
|
Ast.[ Expression (Op (_position, No, BinaryOp (_position, Eq, x, y))) ]
|
|
Ast.[ Expression (Op (_position, No, BinaryOp (_position, Eq, x, y))) ]
|
|
|
|
|
|
@@ -413,8 +423,8 @@ let test_precedence () =
|
|
expression *)
|
|
expression *)
|
|
let test_precedence2 () =
|
|
let test_precedence2 () =
|
|
let index = None in
|
|
let index = None in
|
|
- let x = { Ast.pos = _position; name = "X"; index }
|
|
|
|
- and y = Ast.Ident { Ast.pos = _position; name = "Y"; index } in
|
|
|
|
|
|
+ let x = { Ast.pos = _position; name = "X"; index; local = false }
|
|
|
|
+ and y = Ast.Ident { Ast.pos = _position; name = "Y"; index; local = false } in
|
|
_test_instruction "x = y ! 0"
|
|
_test_instruction "x = y ! 0"
|
|
Ast.
|
|
Ast.
|
|
[
|
|
[
|
|
@@ -427,7 +437,8 @@ let test_precedence2 () =
|
|
|
|
|
|
let test_if () =
|
|
let test_if () =
|
|
let index = Some Ast.(Integer (_position, "0")) in
|
|
let index = Some Ast.(Integer (_position, "0")) in
|
|
- let args = Ast.(Ident { pos = _position; name = "$ARGS"; index })
|
|
|
|
|
|
+ let args =
|
|
|
|
+ Ast.(Ident { pos = _position; name = "$ARGS"; index; local = false })
|
|
and expr1 = Ast.(Literal (_position, [ T.Text "blockA" ]))
|
|
and expr1 = Ast.(Literal (_position, [ T.Text "blockA" ]))
|
|
and expr2 =
|
|
and expr2 =
|
|
Ast.(Expression (Literal (_position, [ T.Text "You are in block A" ])))
|
|
Ast.(Expression (Literal (_position, [ T.Text "You are in block A" ])))
|
|
@@ -549,12 +560,22 @@ let test_if_inline_act () =
|
|
( _position,
|
|
( _position,
|
|
Qsp_syntax.T.Gte,
|
|
Qsp_syntax.T.Gte,
|
|
Ast.Ident
|
|
Ast.Ident
|
|
- { Ast.pos = _position; name = "HOUR"; index = None },
|
|
|
|
|
|
+ {
|
|
|
|
+ Ast.pos = _position;
|
|
|
|
+ name = "HOUR";
|
|
|
|
+ index = None;
|
|
|
|
+ local = false;
|
|
|
|
+ },
|
|
Ast.Integer (_position, "8") ) ),
|
|
Ast.Integer (_position, "8") ) ),
|
|
[
|
|
[
|
|
Ast.Declaration
|
|
Ast.Declaration
|
|
( _position,
|
|
( _position,
|
|
- { Ast.pos = _position; name = "MINUT"; index = None },
|
|
|
|
|
|
+ {
|
|
|
|
+ Ast.pos = _position;
|
|
|
|
+ name = "MINUT";
|
|
|
|
+ index = None;
|
|
|
|
+ local = false;
|
|
|
|
+ },
|
|
Qsp_syntax.T.Inc,
|
|
Qsp_syntax.T.Inc,
|
|
Ast.Integer (_position, "1") );
|
|
Ast.Integer (_position, "1") );
|
|
Ast.Act
|
|
Ast.Act
|
|
@@ -592,7 +613,12 @@ let test_if_multiline () =
|
|
( _position,
|
|
( _position,
|
|
Qsp_syntax.T.Gte,
|
|
Qsp_syntax.T.Gte,
|
|
Ast.Ident
|
|
Ast.Ident
|
|
- { Ast.pos = _position; name = "_HOUR"; index = None },
|
|
|
|
|
|
+ {
|
|
|
|
+ Ast.pos = _position;
|
|
|
|
+ name = "_HOUR";
|
|
|
|
+ index = None;
|
|
|
|
+ local = false;
|
|
|
|
+ },
|
|
Ast.Integer (_position, "8") ) ),
|
|
Ast.Integer (_position, "8") ) ),
|
|
[ Tree.Ast.Expression (Tree.Ast.Integer (_position, "1")) ] );
|
|
[ Tree.Ast.Expression (Tree.Ast.Integer (_position, "1")) ] );
|
|
elifs = [];
|
|
elifs = [];
|
|
@@ -631,7 +657,8 @@ let test_if_inline_act2 () =
|
|
|
|
|
|
let test_precedence3 () =
|
|
let test_precedence3 () =
|
|
let index = Some Ast.(Integer (_position, "0")) in
|
|
let index = Some Ast.(Integer (_position, "0")) in
|
|
- let args = Ast.(Ident { pos = _position; name = "$ARGS"; index })
|
|
|
|
|
|
+ let args =
|
|
|
|
+ Ast.(Ident { pos = _position; name = "$ARGS"; index; local = false })
|
|
and expr1 = Ast.(Literal (_position, [ T.Text "blockA" ]))
|
|
and expr1 = Ast.(Literal (_position, [ T.Text "blockA" ]))
|
|
and expr2 =
|
|
and expr2 =
|
|
Ast.(Expression (Literal (_position, [ T.Text "You are in block A" ])))
|
|
Ast.(Expression (Literal (_position, [ T.Text "You are in block A" ])))
|
|
@@ -667,8 +694,15 @@ let test_gt () =
|
|
Ast.Call
|
|
Ast.Call
|
|
( _position,
|
|
( _position,
|
|
Qsp_syntax.T.Goto,
|
|
Qsp_syntax.T.Goto,
|
|
- [ Ast.Ident { Ast.pos = _position; name = "$CURLOC"; index = None } ]
|
|
|
|
- );
|
|
|
|
|
|
+ [
|
|
|
|
+ Ast.Ident
|
|
|
|
+ {
|
|
|
|
+ Ast.pos = _position;
|
|
|
|
+ name = "$CURLOC";
|
|
|
|
+ index = None;
|
|
|
|
+ local = false;
|
|
|
|
+ };
|
|
|
|
+ ] );
|
|
]
|
|
]
|
|
|
|
|
|
let test_nl () =
|
|
let test_nl () =
|
|
@@ -742,7 +776,7 @@ let test_precedence6 () =
|
|
identifier *)
|
|
identifier *)
|
|
let test_operator () =
|
|
let test_operator () =
|
|
let index = None in
|
|
let index = None in
|
|
- let a = { Ast.pos = _position; name = "A"; index }
|
|
|
|
|
|
+ let a = { Ast.pos = _position; name = "A"; index; local = false }
|
|
and value_0 = Ast.Integer (_position, "0") in
|
|
and value_0 = Ast.Integer (_position, "0") in
|
|
_test_instruction "a *0"
|
|
_test_instruction "a *0"
|
|
Ast.[ Expression (BinaryOp (_position, Product, Ident a, value_0)) ]
|
|
Ast.[ Expression (BinaryOp (_position, Product, Ident a, value_0)) ]
|
|
@@ -866,7 +900,12 @@ let minus_operator () =
|
|
( _position,
|
|
( _position,
|
|
T.Minus,
|
|
T.Minus,
|
|
Tree.Ast.Ident
|
|
Tree.Ast.Ident
|
|
- { Tree.Ast.pos = _position; name = "DAY"; index = None },
|
|
|
|
|
|
+ {
|
|
|
|
+ Tree.Ast.pos = _position;
|
|
|
|
+ name = "DAY";
|
|
|
|
+ index = None;
|
|
|
|
+ local = false;
|
|
|
|
+ },
|
|
Tree.Ast.Integer (_position, "7") ));
|
|
Tree.Ast.Integer (_position, "7") ));
|
|
]
|
|
]
|
|
|
|
|
|
@@ -876,10 +915,20 @@ let test_stattxt () =
|
|
[
|
|
[
|
|
Tree.Ast.Declaration
|
|
Tree.Ast.Declaration
|
|
( _position,
|
|
( _position,
|
|
- { Tree.Ast.pos = _position; name = "$VALUE"; index = None },
|
|
|
|
|
|
+ {
|
|
|
|
+ Tree.Ast.pos = _position;
|
|
|
|
+ name = "$VALUE";
|
|
|
|
+ index = None;
|
|
|
|
+ local = false;
|
|
|
|
+ },
|
|
T.Eq',
|
|
T.Eq',
|
|
Tree.Ast.Ident
|
|
Tree.Ast.Ident
|
|
- { Tree.Ast.pos = _position; name = "$STATTXT"; index = None } );
|
|
|
|
|
|
+ {
|
|
|
|
+ Tree.Ast.pos = _position;
|
|
|
|
+ name = "$STATTXT";
|
|
|
|
+ index = None;
|
|
|
|
+ local = false;
|
|
|
|
+ } );
|
|
]
|
|
]
|
|
|
|
|
|
let test_for_end () =
|
|
let test_for_end () =
|
|
@@ -889,7 +938,13 @@ end|}
|
|
Tree.Ast.For
|
|
Tree.Ast.For
|
|
{
|
|
{
|
|
loc = _position;
|
|
loc = _position;
|
|
- variable = { Tree.Ast.pos = _position; name = "A"; index = None };
|
|
|
|
|
|
+ variable =
|
|
|
|
+ {
|
|
|
|
+ Tree.Ast.pos = _position;
|
|
|
|
+ name = "A";
|
|
|
|
+ index = None;
|
|
|
|
+ local = false;
|
|
|
|
+ };
|
|
start = Tree.Ast.Integer (_position, "1");
|
|
start = Tree.Ast.Integer (_position, "1");
|
|
to_ = Tree.Ast.Integer (_position, "10");
|
|
to_ = Tree.Ast.Integer (_position, "10");
|
|
step = None;
|
|
step = None;
|
|
@@ -904,7 +959,13 @@ end|}
|
|
Tree.Ast.For
|
|
Tree.Ast.For
|
|
{
|
|
{
|
|
loc = _position;
|
|
loc = _position;
|
|
- variable = { Tree.Ast.pos = _position; name = "A"; index = None };
|
|
|
|
|
|
+ variable =
|
|
|
|
+ {
|
|
|
|
+ Tree.Ast.pos = _position;
|
|
|
|
+ name = "A";
|
|
|
|
+ index = None;
|
|
|
|
+ local = false;
|
|
|
|
+ };
|
|
start = Tree.Ast.Integer (_position, "1");
|
|
start = Tree.Ast.Integer (_position, "1");
|
|
to_ = Tree.Ast.Integer (_position, "10");
|
|
to_ = Tree.Ast.Integer (_position, "10");
|
|
step = Some (Tree.Ast.Function (_position, T.Rnd, []));
|
|
step = Some (Tree.Ast.Function (_position, T.Rnd, []));
|
|
@@ -912,6 +973,21 @@ end|}
|
|
};
|
|
};
|
|
]
|
|
]
|
|
|
|
|
|
|
|
+let test_local () =
|
|
|
|
+ _test_instruction {|local tempora = 12|}
|
|
|
|
+ [
|
|
|
|
+ Tree.Ast.Declaration
|
|
|
|
+ ( _position,
|
|
|
|
+ {
|
|
|
|
+ Tree.Ast.pos = _position;
|
|
|
|
+ name = "TEMPORA";
|
|
|
|
+ index = None;
|
|
|
|
+ local = true;
|
|
|
|
+ },
|
|
|
|
+ T.Eq',
|
|
|
|
+ Tree.Ast.Integer (_position, "12") );
|
|
|
|
+ ]
|
|
|
|
+
|
|
let test =
|
|
let test =
|
|
( "Syntax",
|
|
( "Syntax",
|
|
[
|
|
[
|
|
@@ -983,4 +1059,5 @@ let test =
|
|
Alcotest.test_case "stattxt" `Quick test_stattxt;
|
|
Alcotest.test_case "stattxt" `Quick test_stattxt;
|
|
Alcotest.test_case "for ... end" `Quick test_for_end;
|
|
Alcotest.test_case "for ... end" `Quick test_for_end;
|
|
Alcotest.test_case "for step ... end" `Quick test_for_end_with_step;
|
|
Alcotest.test_case "for step ... end" `Quick test_for_end_with_step;
|
|
|
|
+ Alcotest.test_case "local variable" `Quick test_local;
|
|
] )
|
|
] )
|