or_out or_in references added

This commit is contained in:
ProgramSnail 2023-07-29 12:06:22 +03:00
parent a75ea8012d
commit 1a237adf0e
3 changed files with 45 additions and 20 deletions

View file

@ -6,10 +6,10 @@ Test
:: module; // import module to current namespace
:: _ = module; // import module to current namespace and use functions inside without namespace
:: _ = module_2; // import module to current namespace and use functions inside without namespace
:: module : func1 func2 func3;
:: module_namespace = module;
:: module_3 : func1 func2 func3;
:: module_namespace = module_4;
func = {
@ -44,7 +44,7 @@ sum 'a? 'b? =
: example that shows that default annotations are argument names (without ')
@a is integer
@b also integer
sum 'a 'b = 'a + 'b;
sum_2 'a 'b = 'a + 'b;
: this function can be used to calculate Fibonacci sequence elements
: it is important is some algorithmic tasks
@ -141,7 +141,7 @@ bubble_sort 'arr : <> Array['A] = {
}
: bubble_sort with names instead of symbols
bubble_sort 'arr : ref Array['A] = {
bubble_sort_2 'arr : ref Array['A] = {
var swap_occured := true;
for swap_occured do {
swap_occured = false;
@ -155,9 +155,7 @@ bubble_sort 'arr : ref Array['A] = {
& @key Key
& @value Value
& @left ^TreeNode['Key 'Value]
& @right ^TreeNode['Key 'Value];
TreeNode {
& @right ^TreeNode['Key 'Value] {
new = do_something; // static methods
$insert 'key = do_something; // const methods
@ -190,7 +188,7 @@ print_two 'a 'b = print 'a, print 'b;
swap 'a 'b : <> 'A <> 'A = %c := <- 'a, 'a := <- 'b, 'b := <- c;
: previous example with automatic type deduction
swap <> 'a <> 'b = %c := <- 'a, 'a := <- 'b, 'b := <- c;
swap_2 <> 'a <> 'b = %c := <- 'a, 'a := <- 'b, 'b := <- c;
: several outputs example
scan_three : -> String -> String -> String = scan & scan & scan;
@ -221,6 +219,7 @@ parse_number : Unit! = {
bring ();
}
( & ) <-| 'a <-| 'b |-> 'x |-> 'y = (<-| 'a := |-> 'x) && (<-| 'b := |-> 'y);
--------------------------------------------------------------------------------
@ -877,10 +876,7 @@ parse_number : Unit! = {
(type
(argument_type_identifier))
(type
(argument_type_identifier))))))
(empty_lines)
(type_definition
(simple_type_identifier)
(argument_type_identifier)))))
(function_definition
(simple_name_identifier)
(name_expression
@ -1185,4 +1181,25 @@ parse_number : Unit! = {
(name_expression
(simple_name_identifier))
(return
(unit_literal)))))
(unit_literal))))
(empty_lines)
(function_definition
(operator)
(argument_name_identifier)
(argument_name_identifier)
(argument_name_identifier)
(argument_name_identifier)
(operator_expression
(match
(reference_expression
(argument_name_identifier))
(case
(reference_expression
(argument_name_identifier))))
(operator)
(match
(reference_expression
(argument_name_identifier))
(case
(reference_expression
(argument_name_identifier)))))))