Merge branch 'master' of https://github.com/pascalabcnet/pascalabcnet
# Conflicts: # Parsers/PascalABCParserNewSaushkin/ABCPascal.cs # Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs
This commit is contained in:
commit
d31e0f6404
|
|
@ -2,7 +2,7 @@
|
|||
// This CSharp output file generated by Gardens Point LEX
|
||||
// Version: 1.1.3.301
|
||||
// Machine: DESKTOP-A6LT9RI
|
||||
// DateTime: 22.05.2018 10:42:20
|
||||
// DateTime: 22.05.2018 22:30:38
|
||||
// UserName: ?????????
|
||||
// GPLEX input file <ABCPascal.lex>
|
||||
// GPLEX frame file <embedded resource>
|
||||
|
|
|
|||
|
|
@ -173,8 +173,8 @@
|
|||
%type <stn> full_lambda_fp_list lambda_simple_fp_sect lambda_function_body lambda_procedure_body optional_full_lambda_fp_list
|
||||
%type <ob> field_in_unnamed_object list_fields_in_unnamed_object func_class_name_ident_list rem_lambda variable_list var_ident_list
|
||||
%type <ti> tkAssignOrEqual
|
||||
%type <stn> pattern match_with pattern_case pattern_cases pattern_out_param
|
||||
%type <ob> pattern_out_param_list
|
||||
%type <stn> pattern pattern_optional_var match_with pattern_case pattern_cases pattern_out_param pattern_out_param_optional_var
|
||||
%type <ob> pattern_out_param_list pattern_out_param_list_optional_var
|
||||
%%
|
||||
|
||||
parse_goal
|
||||
|
|
@ -2575,11 +2575,11 @@ pattern_cases
|
|||
pattern_case
|
||||
:
|
||||
{ $$ = new empty_statement(); }
|
||||
| pattern tkWhen expr_l1 tkColon unlabelled_stmt
|
||||
| pattern_optional_var tkWhen expr_l1 tkColon unlabelled_stmt
|
||||
{
|
||||
$$ = new pattern_case($1 as pattern_node, $5 as statement, $3, @$);
|
||||
}
|
||||
| pattern tkColon unlabelled_stmt
|
||||
| pattern_optional_var tkColon unlabelled_stmt
|
||||
{
|
||||
$$ = new pattern_case($1 as pattern_node, $3 as statement, null, @$);
|
||||
}
|
||||
|
|
@ -3042,7 +3042,34 @@ pattern
|
|||
$$ = new deconstructor_pattern($3 as List<pattern_deconstructor_parameter>, $1, @$);
|
||||
}
|
||||
;
|
||||
|
||||
pattern_optional_var
|
||||
: simple_or_template_type_reference tkRoundOpen pattern_out_param_list_optional_var tkRoundClose
|
||||
{
|
||||
$$ = new deconstructor_pattern($3 as List<pattern_deconstructor_parameter>, $1, @$);
|
||||
}
|
||||
;
|
||||
|
||||
pattern_out_param_list_optional_var
|
||||
: pattern_out_param_optional_var
|
||||
{
|
||||
$$ = new List<pattern_deconstructor_parameter>();
|
||||
($$ as List<pattern_deconstructor_parameter>).Add($1 as pattern_deconstructor_parameter);
|
||||
}
|
||||
| pattern_out_param_list_optional_var tkSemiColon pattern_out_param_optional_var
|
||||
{
|
||||
var list = $1 as List<pattern_deconstructor_parameter>;
|
||||
list.Add($3 as pattern_deconstructor_parameter);
|
||||
$$ = list;
|
||||
}
|
||||
| pattern_out_param_list_optional_var tkComma pattern_out_param_optional_var
|
||||
{
|
||||
var list = $1 as List<pattern_deconstructor_parameter>;
|
||||
list.Add($3 as pattern_deconstructor_parameter);
|
||||
$$ = list;
|
||||
}
|
||||
;
|
||||
|
||||
pattern_out_param_list
|
||||
: pattern_out_param
|
||||
{
|
||||
|
|
@ -3061,9 +3088,24 @@ pattern_out_param_list
|
|||
list.Add($3 as pattern_deconstructor_parameter);
|
||||
$$ = list;
|
||||
}
|
||||
;
|
||||
|
||||
;
|
||||
|
||||
pattern_out_param
|
||||
: tkVar identifier tkColon type_ref
|
||||
{
|
||||
$$ = new var_deconstructor_parameter($2, $4, @$);
|
||||
}
|
||||
| tkVar identifier
|
||||
{
|
||||
$$ = new var_deconstructor_parameter($2, null, @$);
|
||||
}
|
||||
| pattern
|
||||
{
|
||||
$$ = new recursive_deconstructor_parameter($1 as pattern_node, @$);
|
||||
}
|
||||
;
|
||||
|
||||
pattern_out_param_optional_var
|
||||
: identifier tkColon type_ref
|
||||
{
|
||||
$$ = new var_deconstructor_parameter($1, $3, @$);
|
||||
|
|
@ -3072,7 +3114,15 @@ pattern_out_param
|
|||
{
|
||||
$$ = new var_deconstructor_parameter($1, null, @$);
|
||||
}
|
||||
| pattern
|
||||
| tkVar identifier tkColon type_ref
|
||||
{
|
||||
$$ = new var_deconstructor_parameter($2, $4, @$);
|
||||
}
|
||||
| tkVar identifier
|
||||
{
|
||||
$$ = new var_deconstructor_parameter($2, null, @$);
|
||||
}
|
||||
| pattern_optional_var
|
||||
{
|
||||
$$ = new recursive_deconstructor_parameter($1 as pattern_node, @$);
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,4 +1,4 @@
|
|||
begin
|
||||
var res := Arr(object(new List<integer>), object('asd'), object(1), object(2.0)).First(x -> x is string(s));
|
||||
var res := Arr(object(new List<integer>), object('asd'), object(1), object(2.0)).First(x -> x is string(var s));
|
||||
Assert(res = 'asd');
|
||||
end.
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
begin
|
||||
var a:='asd';
|
||||
if (a is string(s)) and (s is string(s1)) then
|
||||
if (s1 is string(s2)) and (s2 is string(s3)) and (s3 = 'asd') then
|
||||
if (a is string(var s)) and (s is string(var s1)) then
|
||||
if (s1 is string(var s2)) and (s2 is string(var s3)) and (s3 = 'asd') then
|
||||
Assert(s3 = 'asd')
|
||||
else
|
||||
Assert(false)
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ begin
|
|||
var p := new Pair<integer, string>;
|
||||
p._a := 1;
|
||||
p._b := 'asd';
|
||||
if p is Pair<integer, string>(integer(a), string(b)) then
|
||||
if p is Pair<integer, string>(integer(var a), string(var b)) then
|
||||
Assert((a = 1) and (b = 'asd'))
|
||||
else
|
||||
Assert(false);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
function Y1(): sequence of integer;
|
||||
begin
|
||||
if 1 is integer(i) then
|
||||
if 1 is integer(var i) then
|
||||
yield i;
|
||||
end;
|
||||
|
||||
Loading…
Reference in a new issue