fix #265
This commit is contained in:
parent
a1e1363347
commit
70c85a0c6a
|
|
@ -15,7 +15,7 @@ internal static class RevisionClass
|
|||
public const string Major = "3";
|
||||
public const string Minor = "4";
|
||||
public const string Build = "0";
|
||||
public const string Revision = "1682";
|
||||
public const string Revision = "1684";
|
||||
|
||||
public const string MainVersion = Major + "." + Minor;
|
||||
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
%MINOR%=4
|
||||
%REVISION%=1682
|
||||
%REVISION%=1684
|
||||
%COREVERSION%=0
|
||||
%MAJOR%=3
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// This CSharp output file generated by Gardens Point LEX
|
||||
// Version: 1.1.3.301
|
||||
// Machine: DESKTOP-A6LT9RI
|
||||
// DateTime: 28.06.2018 21:28:15
|
||||
// DateTime: 01.07.2018 11:33:54
|
||||
// UserName: ?????????
|
||||
// GPLEX input file <ABCPascal.lex>
|
||||
// GPLEX frame file <embedded resource>
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
// GPPG error listing for yacc source file <ABCPascal.y>
|
||||
// ==========================================================================
|
||||
// Version: 1.3.6
|
||||
// Machine: ALEXANDER-PC
|
||||
// DateTime: 11.05.2018 11:34:59
|
||||
// UserName: Alexander
|
||||
// Machine: DESKTOP-A6LT9RI
|
||||
// DateTime: 01.07.2018 10:55:30
|
||||
// UserName: Станислав
|
||||
// ==========================================================================
|
||||
|
||||
|
||||
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
%token <ti> tkDirectiveName tkAmpersend tkColon tkDotDot tkPoint tkRoundOpen tkRoundClose tkSemiColon tkSquareOpen tkSquareClose tkQuestion tkQuestionPoint tkDoubleQuestion tkQuestionSquareOpen
|
||||
%token <ti> tkSizeOf tkTypeOf tkWhere tkArray tkCase tkClass tkAuto tkConst tkConstructor tkDestructor tkElse tkExcept tkFile tkFor tkForeach tkFunction tkMatch tkWhen
|
||||
%token <ti> tkIf tkImplementation tkInherited tkInterface tkProcedure tkOperator tkProperty tkRaise tkRecord tkSet tkType tkThen tkUses tkVar tkWhile tkWith tkNil
|
||||
%token <ti> tkIf tkImplementation tkInherited tkInterface tkTypeclass tkInstance tkProcedure tkOperator tkProperty tkRaise tkRecord tkSet tkType tkThen tkUses tkVar tkWhile tkWith tkNil
|
||||
%token <ti> tkGoto tkOf tkLabel tkLock tkProgram tkEvent tkDefault tkTemplate tkPacked tkExports tkResourceString tkThreadvar tkSealed tkPartial tkTo tkDownto
|
||||
%token <ti> tkLoop
|
||||
%token <ti> tkSequence tkYield
|
||||
|
|
@ -92,7 +92,7 @@
|
|||
%type <stn> enumeration_id expr_l1_list
|
||||
%type <stn> enumeration_id_list
|
||||
%type <ex> const_simple_expr term simple_term typed_const typed_const_plus typed_var_init_expression expr expr_with_func_decl_lambda const_expr elem range_expr const_elem array_const factor relop_expr expr_dq expr_l1 simple_expr range_term range_factor
|
||||
%type <ex> external_directive_ident init_const_expr case_label variable var_reference simple_expr_or_nothing var_question_point
|
||||
%type <ex> external_directive_ident init_const_expr case_label variable var_reference /*optional_write_expr*/ optional_read_expr simple_expr_or_nothing var_question_point
|
||||
%type <ob> for_cycle_type
|
||||
%type <ex> format_expr
|
||||
%type <stn> foreach_stmt
|
||||
|
|
@ -102,8 +102,9 @@
|
|||
%type <stn> var_address
|
||||
%type <stn> goto_stmt
|
||||
%type <id> func_name_ident param_name const_field_name func_name_with_template_args identifier_or_keyword unit_name exception_variable const_name func_meth_name_ident label_name type_decl_identifier template_identifier_with_equal
|
||||
%type <id> program_param identifier identifier_keyword_operatorname func_class_name_ident optional_identifier visibility_specifier
|
||||
%type <id> program_param identifier identifier_keyword_operatorname func_class_name_ident /*optional_identifier*/ visibility_specifier
|
||||
%type <id> property_specifier_directives non_reserved
|
||||
%type <id> typeclass_restriction
|
||||
%type <stn> if_stmt
|
||||
%type <stn> initialization_part
|
||||
%type <stn> template_arguments label_list ident_or_keyword_pointseparator_list ident_list param_name_list
|
||||
|
|
@ -153,7 +154,7 @@
|
|||
%type <td> string_type
|
||||
%type <ex> sizeof_expr
|
||||
%type <stn> simple_prim_property_definition simple_property_definition
|
||||
%type <stn> stmt_or_expression unlabelled_stmt stmt case_item
|
||||
%type <stn> stmt_or_expression unlabelled_stmt optional_unlabelled_stmt stmt case_item
|
||||
%type <td> set_type
|
||||
%type <ex> as_is_expr as_is_constexpr is_expr as_expr power_expr power_constexpr
|
||||
%type <td> unsized_array_type simple_type_or_ simple_type array_name_for_new_expr foreach_stmt_ident_dype_opt fptype type_ref fptype_noproctype array_type
|
||||
|
|
@ -164,7 +165,8 @@
|
|||
%type <ti> class_or_interface_keyword optional_tk_do keyword reserved_keyword
|
||||
%type <ex> typeof_expr
|
||||
%type <stn> simple_fp_sect
|
||||
%type <stn> template_param_list template_type_params
|
||||
%type <stn> template_param_list template_type_params
|
||||
%type <stn> template_type_or_typeclass_params typeclass_params
|
||||
%type <td> template_type
|
||||
%type <stn> try_stmt
|
||||
%type <stn> uses_clause used_units_list
|
||||
|
|
@ -184,9 +186,16 @@
|
|||
%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
|
||||
%%
|
||||
// Warning: NonTerminal symbol "optional_unlabelled_stmt" is unreachable
|
||||
// Error: NonTerminal symbol "optional_unlabelled_stmt" has no productions
|
||||
// Error: There are 1 non-terminating NonTerminal Symbols
|
||||
// {optional_unlabelled_stmt}
|
||||
// Warning: Terminating optional_unlabelled_stmt fixes the following size-1 NonTerminal set
|
||||
// {optional_unlabelled_stmt}
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
parse_goal
|
||||
: program_file
|
||||
|
|
@ -323,17 +332,27 @@ uses_clause
|
|||
if (parsertools.build_tree_for_formatter)
|
||||
{
|
||||
if ($1 == null)
|
||||
$1 = new uses_closure($3 as uses_list,@$);
|
||||
else ($1 as uses_closure).AddUsesList($3 as uses_list,@$);
|
||||
$$ = $1;
|
||||
{
|
||||
$$ = new uses_closure($3 as uses_list,@$);
|
||||
}
|
||||
else {
|
||||
($1 as uses_closure).AddUsesList($3 as uses_list,@$);
|
||||
$$ = $1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($1 == null)
|
||||
$1 = $3;
|
||||
else ($1 as uses_list).AddUsesList($3 as uses_list,@$);
|
||||
$$ = $1;
|
||||
$$.source_context = @$;
|
||||
{
|
||||
$$ = $3;
|
||||
$$.source_context = @$;
|
||||
}
|
||||
else
|
||||
{
|
||||
($1 as uses_list).AddUsesList($3 as uses_list,@$);
|
||||
$$ = $1;
|
||||
$$.source_context = @$;
|
||||
}
|
||||
}
|
||||
}
|
||||
;
|
||||
|
|
@ -835,6 +854,28 @@ const_factor
|
|||
}
|
||||
| sign const_factor
|
||||
{
|
||||
// ðó÷íàß êîððåêöèß öåëûõ êîíñòàíò
|
||||
if ($1.type == Operators.Minus)
|
||||
{
|
||||
var i64 = $2 as int64_const;
|
||||
if (i64 != null && i64.val == (Int64)Int32.MaxValue + 1)
|
||||
{
|
||||
$$ = new int32_const(Int32.MinValue);
|
||||
break;
|
||||
}
|
||||
var ui64 = $2 as uint64_const;
|
||||
if (ui64 != null && ui64.val == (UInt64)Int64.MaxValue + 1)
|
||||
{
|
||||
$$ = new int64_const(Int64.MinValue);
|
||||
break;
|
||||
}
|
||||
if (ui64 != null && ui64.val > (UInt64)Int64.MaxValue + 1)
|
||||
{
|
||||
parsertools.AddErrorFromResource("BAD_INT2",@$);
|
||||
break;
|
||||
}
|
||||
// ìîæíî ñäåëàòü âû÷èñëåíèå êîíñòàíòû ñ âìîíòèðîâàííûì ìèíóñîì
|
||||
}
|
||||
$$ = new un_expr($2, $1.type, @$);
|
||||
}
|
||||
| new_expr
|
||||
|
|
@ -862,15 +903,28 @@ sign
|
|||
const_variable
|
||||
: identifier
|
||||
{ $$ = $1; }
|
||||
| tkInherited identifier
|
||||
{
|
||||
$$ = new inherited_ident($2.name, @$);
|
||||
}
|
||||
| sizeof_expr
|
||||
{ $$ = $1; }
|
||||
| typeof_expr
|
||||
{ $$ = $1; }
|
||||
/* | tkRoundOpen const_expr tkRoundClose
|
||||
{
|
||||
if (!parsertools.build_tree_for_formatter)
|
||||
{
|
||||
$2.source_context = @$;
|
||||
$$ = $2;
|
||||
}
|
||||
else $$ = new bracket_expr($2, @$);
|
||||
}*/
|
||||
| const_variable const_variable_2
|
||||
{
|
||||
$$ = NewConstVariable($1, $2, @$);
|
||||
}
|
||||
| const_variable tkAmpersend template_type_params
|
||||
| const_variable tkAmpersend template_type_or_typeclass_params
|
||||
{
|
||||
$$ = new ident_with_templateparams($1 as addressed_value, $3 as template_param_list, @$);
|
||||
}
|
||||
|
|
@ -1084,8 +1138,40 @@ simple_type_decl
|
|||
{
|
||||
$$ = new type_declaration($1, $2, @$);
|
||||
}
|
||||
| typeclass_restriction tkEqual tkTypeclass optional_base_classes optional_component_list_seq_end tkSemiColon
|
||||
{
|
||||
$$ = new type_declaration($1 as typeclass_restriction, new typeclass_definition($4 as named_type_reference_list, $5 as class_body_list, @$), @$);
|
||||
}
|
||||
| typeclass_restriction tkEqual tkInstance optional_component_list_seq_end tkSemiColon
|
||||
{
|
||||
$$ = new type_declaration($1 as typeclass_restriction, new instance_definition($4 as class_body_list, @$), @$);
|
||||
}
|
||||
;
|
||||
|
||||
typeclass_restriction
|
||||
: simple_type_identifier typeclass_params
|
||||
{
|
||||
$$ = new typeclass_restriction(($1 as named_type_reference).ToString(), $2 as template_param_list, @$);
|
||||
}
|
||||
;
|
||||
|
||||
typeclass_params
|
||||
: tkSquareOpen template_param_list tkSquareClose
|
||||
{
|
||||
$$ = new typeclass_param_list($2 as template_param_list);
|
||||
}
|
||||
;
|
||||
|
||||
template_type_or_typeclass_params
|
||||
: template_type_params
|
||||
{
|
||||
$$ = $1;
|
||||
}
|
||||
| typeclass_params
|
||||
{
|
||||
$$ = $1;
|
||||
}
|
||||
;
|
||||
type_decl_identifier
|
||||
: identifier
|
||||
{ $$ = $1; }
|
||||
|
|
@ -1430,6 +1516,25 @@ object_type
|
|||
: class_attributes class_or_interface_keyword optional_base_classes optional_where_section optional_component_list_seq_end
|
||||
{
|
||||
$$ = NewObjectType((class_attribute)$1, $2, $3 as named_type_reference_list, $4 as where_definition_list, $5 as class_body_list, @$);
|
||||
class_definition cd = $$ as class_definition;
|
||||
var ccnt = cd.body.DescendantNodes().OfType<simple_property>().ToArray();
|
||||
var cm = new class_members(access_modifer.private_modifer);
|
||||
foreach (var prop in ccnt)
|
||||
{
|
||||
var td = prop.property_type;
|
||||
if (prop.accessors.read_accessor != null && prop.accessors.read_accessor.pr != null)
|
||||
{
|
||||
(prop.accessors.read_accessor.pr.proc_header as function_header).return_type = td;
|
||||
cm.Add(prop.accessors.read_accessor.pr);
|
||||
}
|
||||
if (prop.accessors.write_accessor != null && prop.accessors.write_accessor.pr != null)
|
||||
{
|
||||
prop.accessors.write_accessor.pr.proc_header.parameters.params_list[0].vars_type = td;
|
||||
cm.Add(prop.accessors.write_accessor.pr);
|
||||
}
|
||||
}
|
||||
if (cm.Count>0)
|
||||
cd.body.Insert(0, cm);
|
||||
}
|
||||
;
|
||||
|
||||
|
|
@ -1469,8 +1574,8 @@ class_attributes1
|
|||
}
|
||||
| class_attributes1 class_attribute
|
||||
{
|
||||
$1 = ((class_attribute)$1) | ((class_attribute)$2);
|
||||
$$ = $1;
|
||||
$$ = ((class_attribute)$1) | ((class_attribute)$2);
|
||||
//$$ = $1;
|
||||
}
|
||||
;
|
||||
|
||||
|
|
@ -1529,6 +1634,11 @@ base_class_name
|
|||
{ $$ = $1; }
|
||||
| template_type
|
||||
{ $$ = $1; }
|
||||
| typeclass_restriction
|
||||
{
|
||||
var names = new List<ident>();
|
||||
names.Add(($1 as typeclass_restriction).name);
|
||||
$$ = new typeclass_reference(null, names, ($1 as typeclass_restriction).restriction_args); }
|
||||
;
|
||||
|
||||
template_arguments
|
||||
|
|
@ -1562,6 +1672,10 @@ where_part
|
|||
{
|
||||
$$ = new where_definition($2 as ident_list, $4 as where_type_specificator_list, @$);
|
||||
}
|
||||
| tkWhere typeclass_restriction tkSemiColon
|
||||
{
|
||||
$$ = new where_typeclass_constraint($2 as typeclass_restriction);
|
||||
}
|
||||
;
|
||||
|
||||
type_ref_and_secific_list
|
||||
|
|
@ -1724,6 +1838,8 @@ method_decl_withattr
|
|||
| attribute_declarations method_decl
|
||||
{
|
||||
($2 as declaration).attributes = $1 as attribute_list;
|
||||
if ($2 is procedure_definition && ($2 as procedure_definition).proc_header != null)
|
||||
($2 as procedure_definition).proc_header.attributes = $1 as attribute_list;
|
||||
$$ = $2;
|
||||
}
|
||||
;
|
||||
|
|
@ -1874,37 +1990,105 @@ parameter_decl
|
|||
}
|
||||
;
|
||||
|
||||
optional_identifier
|
||||
/*optional_identifier
|
||||
: identifier
|
||||
{ $$ = $1; }
|
||||
|
|
||||
{ $$ = null; }
|
||||
;
|
||||
|
||||
optional_write_expr
|
||||
: var_reference
|
||||
{ $$ = $1; }
|
||||
|
|
||||
{ $$ = null; }
|
||||
;*/
|
||||
|
||||
/*optional_unlabelled_stmt
|
||||
: unlabelled_stmt
|
||||
{ $$ = $1; }
|
||||
|
|
||||
{ $$ = null; }
|
||||
;*/
|
||||
|
||||
optional_read_expr
|
||||
: expr_with_func_decl_lambda
|
||||
{ $$ = $1; }
|
||||
|
|
||||
{ $$ = null; }
|
||||
;
|
||||
|
||||
property_specifiers
|
||||
:
|
||||
| tkRead optional_identifier write_property_specifiers
|
||||
| tkRead optional_read_expr write_property_specifiers
|
||||
{
|
||||
$$ = NewPropertySpecifiersRead($1, $2, $3 as property_accessors, @$);
|
||||
if ($2 == null || $2 is ident)
|
||||
{
|
||||
$$ = NewPropertySpecifiersRead($1, $2 as ident, null, $3 as property_accessors, @$);
|
||||
}
|
||||
else
|
||||
{
|
||||
var id = NewId("#GetGen");
|
||||
var pr = CreateAndAddToClassReadFunc($2,id,@2);
|
||||
$$ = NewPropertySpecifiersRead($1, id, pr, $3 as property_accessors, @$);
|
||||
}
|
||||
}
|
||||
| tkWrite optional_identifier read_property_specifiers
|
||||
| tkWrite unlabelled_stmt read_property_specifiers
|
||||
{
|
||||
$$ = NewPropertySpecifiersWrite($1, $2, $3 as property_accessors, @$);
|
||||
if ($2 is empty_statement)
|
||||
{
|
||||
|
||||
$$ = NewPropertySpecifiersWrite($1, null, null, $3 as property_accessors, @$);
|
||||
}
|
||||
else if ($2 is procedure_call && ($2 as procedure_call).func_name.is_ident)
|
||||
{
|
||||
|
||||
$$ = NewPropertySpecifiersWrite($1, ($2 as procedure_call).func_name as ident, null, $3 as property_accessors, @$);
|
||||
}
|
||||
else
|
||||
{
|
||||
var id = NewId("#SetGen");
|
||||
//var pr = CreateAndAddToClassWriteProc($2,id,@2);
|
||||
$$ = NewPropertySpecifiersWrite($1, id, null, $3 as property_accessors, @$);
|
||||
}
|
||||
}
|
||||
;
|
||||
write_property_specifiers
|
||||
:
|
||||
| tkWrite optional_identifier
|
||||
| tkWrite unlabelled_stmt
|
||||
{
|
||||
$$ = NewPropertySpecifiersWrite($1, $2, null, @$);
|
||||
if ($2 is empty_statement)
|
||||
{
|
||||
|
||||
$$ = NewPropertySpecifiersWrite($1, null, null, null, @$);
|
||||
}
|
||||
else if ($2 is procedure_call && ($2 as procedure_call).func_name.is_ident)
|
||||
{
|
||||
$$ = NewPropertySpecifiersWrite($1, ($2 as procedure_call).func_name as ident, null, null, @$);
|
||||
}
|
||||
else
|
||||
{
|
||||
var id = NewId("#SetGen");
|
||||
//var pr = CreateAndAddToClassWriteProc($2,id,@2);
|
||||
$$ = NewPropertySpecifiersWrite($1, id, null, null, @$);
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
read_property_specifiers
|
||||
:
|
||||
| tkRead optional_identifier
|
||||
| tkRead optional_read_expr
|
||||
{
|
||||
$$ = NewPropertySpecifiersRead($1, $2, null, @$);
|
||||
if ($2 == null || $2 is ident)
|
||||
{
|
||||
$$ = NewPropertySpecifiersRead($1, $2 as ident, null, null, @$);
|
||||
}
|
||||
else
|
||||
{
|
||||
var id = NewId("#GetGen");
|
||||
var pr = CreateAndAddToClassReadFunc($2,id,@2);
|
||||
$$ = NewPropertySpecifiersRead($1, id, pr, null, @$);
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
|
|
@ -2014,6 +2198,15 @@ constr_destr_decl
|
|||
if (parsertools.build_tree_for_formatter)
|
||||
$$ = new short_func_definition($$ as procedure_definition);
|
||||
}
|
||||
| tkClass tkConstructor optional_proc_name fp_list tkAssign unlabelled_stmt tkSemiColon
|
||||
{
|
||||
if ($6 is empty_statement)
|
||||
parsertools.AddErrorFromResource("EMPTY_STATEMENT_IN_SHORT_PROC_DEFINITION",@7);
|
||||
var tmp = new constructor(null,$4 as formal_parameters,new procedure_attributes_list(new List<procedure_attribute>(),@$),$3 as method_name,false,true,null,null,@$);
|
||||
$$ = new procedure_definition(tmp as procedure_header, new block(null,new statement_list($6 as statement,@6),@6), @$);
|
||||
if (parsertools.build_tree_for_formatter)
|
||||
$$ = new short_func_definition($$ as procedure_definition);
|
||||
}
|
||||
;
|
||||
|
||||
inclass_constr_destr_decl
|
||||
|
|
@ -2025,11 +2218,20 @@ inclass_constr_destr_decl
|
|||
{
|
||||
if ($5 is empty_statement)
|
||||
parsertools.AddErrorFromResource("EMPTY_STATEMENT_IN_SHORT_PROC_DEFINITION",@6);
|
||||
var tmp = new constructor(null,$3 as formal_parameters,new procedure_attributes_list(new List<procedure_attribute>(),@$),$2 as method_name,false,false,null,null,LexLocation.MergeAll(@1,@2,@3));
|
||||
var tmp = new constructor(null,$3 as formal_parameters,new procedure_attributes_list(new List<procedure_attribute>(),@$),$2 as method_name,false,false,null,null,LexLocation.MergeAll(@1,@2,@3,@4));
|
||||
$$ = new procedure_definition(tmp as procedure_header, new block(null,new statement_list($5 as statement,@5),@5), @$);
|
||||
if (parsertools.build_tree_for_formatter)
|
||||
$$ = new short_func_definition($$ as procedure_definition);
|
||||
}
|
||||
| tkClass tkConstructor optional_proc_name fp_list tkAssign unlabelled_stmt tkSemiColon
|
||||
{
|
||||
if ($6 is empty_statement)
|
||||
parsertools.AddErrorFromResource("EMPTY_STATEMENT_IN_SHORT_PROC_DEFINITION",@7);
|
||||
var tmp = new constructor(null,$4 as formal_parameters,new procedure_attributes_list(new List<procedure_attribute>(),@$),$3 as method_name,false,true,null,null,LexLocation.MergeAll(@1,@2,@3,@4));
|
||||
$$ = new procedure_definition(tmp as procedure_header, new block(null,new statement_list($6 as statement,@6),@6), @$);
|
||||
if (parsertools.build_tree_for_formatter)
|
||||
$$ = new short_func_definition($$ as procedure_definition);
|
||||
}
|
||||
;
|
||||
|
||||
proc_func_decl
|
||||
|
|
@ -2053,6 +2255,9 @@ proc_func_decl_noclass
|
|||
}
|
||||
| tkFunction func_name fp_list optional_method_modificators1 tkAssign expr_l1 tkSemiColon
|
||||
{
|
||||
if ($6 is dot_question_node)
|
||||
parsertools.AddErrorFromResource("DOT_QUECTION_IN_SHORT_FUN",@6);
|
||||
|
||||
$$ = SyntaxTreeBuilder.BuildShortFuncDefinition($3 as formal_parameters, $4 as procedure_attributes_list, $2 as method_name, null, $6, @1.Merge(@4));
|
||||
}
|
||||
| tkFunction func_name fp_list tkColon fptype optional_method_modificators1 tkAssign func_decl_lambda tkSemiColon
|
||||
|
|
@ -2483,7 +2688,7 @@ var_ident_list
|
|||
proc_call
|
||||
: var_reference
|
||||
{
|
||||
$$ = new procedure_call($1 as addressed_value, @$);
|
||||
$$ = new procedure_call($1 as addressed_value, $1 is ident, @$);
|
||||
}
|
||||
;
|
||||
|
||||
|
|
@ -2527,9 +2732,9 @@ if_stmt
|
|||
;
|
||||
|
||||
match_with
|
||||
: tkMatch expr_l1 tkWith pattern_cases tkEnd
|
||||
: tkMatch expr_l1 tkWith pattern_cases else_case tkEnd
|
||||
{
|
||||
$$ = new match_with($2, $4 as pattern_cases);
|
||||
$$ = new match_with($2, $4 as pattern_cases, $5 as statement, @$);
|
||||
}
|
||||
;
|
||||
|
||||
|
|
@ -2545,13 +2750,15 @@ pattern_cases
|
|||
;
|
||||
|
||||
pattern_case
|
||||
: pattern tkWhen expr_l1 tkColon unlabelled_stmt
|
||||
:
|
||||
{ $$ = new empty_statement(); }
|
||||
| pattern_optional_var tkWhen expr_l1 tkColon unlabelled_stmt
|
||||
{
|
||||
$$ = new pattern_case($1 as pattern_node, $5 as statement, $3);
|
||||
$$ = 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);
|
||||
$$ = new pattern_case($1 as pattern_node, $3 as statement, null, @$);
|
||||
}
|
||||
;
|
||||
|
||||
|
|
@ -2873,6 +3080,8 @@ typeof_expr
|
|||
question_expr
|
||||
: expr_l1 tkQuestion expr_l1 tkColon expr_l1
|
||||
{
|
||||
if ($3 is nil_const && $5 is nil_const)
|
||||
parsertools.AddErrorFromResource("TWO_NILS_IN_QUESTION_EXPR",@3);
|
||||
$$ = new question_colon_expression($1, $3, $5, @$);
|
||||
}
|
||||
;
|
||||
|
|
@ -2886,7 +3095,7 @@ simple_or_template_type_reference
|
|||
{
|
||||
$$ = new template_type_reference((named_type_reference)$1, (template_param_list)$2, @$);
|
||||
}
|
||||
| simple_type_identifier tkAmpersend template_type_params
|
||||
| simple_type_identifier tkAmpersend template_type_or_typeclass_params
|
||||
{
|
||||
$$ = new template_type_reference((named_type_reference)$1, (template_param_list)$3, @$);
|
||||
}
|
||||
|
|
@ -2998,12 +3207,11 @@ relop_expr
|
|||
{
|
||||
$$ = new bin_expr($1, $3, $2.type, @$);
|
||||
}
|
||||
| is_expr tkRoundOpen tkVar identifier tkRoundClose
|
||||
| is_expr tkRoundOpen pattern_out_param_list tkRoundClose
|
||||
{
|
||||
var isTypeCheck = $1 as typecast_node;
|
||||
var typeDef = isTypeCheck.type_def;
|
||||
var pattern = new type_pattern($4, typeDef, typeDef.source_context);
|
||||
$$ = new is_pattern_expr(isTypeCheck.expr, pattern, @$);
|
||||
var deconstructorPattern = new deconstructor_pattern($3 as List<pattern_deconstructor_parameter>, isTypeCheck.type_def, @$);
|
||||
$$ = new is_pattern_expr(isTypeCheck.expr, deconstructorPattern, @$);
|
||||
}
|
||||
;
|
||||
|
||||
|
|
@ -3013,7 +3221,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
|
||||
{
|
||||
|
|
@ -3026,22 +3261,49 @@ pattern_out_param_list
|
|||
list.Add($3 as pattern_deconstructor_parameter);
|
||||
$$ = list;
|
||||
}
|
||||
;
|
||||
|
||||
| pattern_out_param_list tkComma pattern_out_param
|
||||
{
|
||||
var list = $1 as List<pattern_deconstructor_parameter>;
|
||||
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 pattern_deconstructor_parameter($2, $4, @$);
|
||||
//-------------------------------------------------------^^
|
||||
// Error: Semantic action index is out of bounds
|
||||
// ---------------------------------------------
|
||||
$$ = new var_deconstructor_parameter($1, $3, @$);
|
||||
}
|
||||
| identifier
|
||||
{
|
||||
$$ = new pattern_deconstructor_parameter($2, null, @$);
|
||||
//---------------------------------------------------^^
|
||||
// Error: Semantic action index is out of bounds
|
||||
// ---------------------------------------------
|
||||
$$ = new var_deconstructor_parameter($1, null, @$);
|
||||
}
|
||||
| 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, @$);
|
||||
}
|
||||
;
|
||||
|
||||
|
|
@ -3203,7 +3465,7 @@ tuple
|
|||
if ($6 != null)
|
||||
parsertools.AddErrorFromResource("BAD_TUPLE",@6);*/
|
||||
|
||||
if (($4 as expression_list).Count>7)
|
||||
if (($4 as expression_list).Count>6)
|
||||
parsertools.AddErrorFromResource("TUPLE_ELEMENTS_COUNT_MUST_BE_LESSEQUAL_7",@$);
|
||||
($4 as expression_list).Insert(0,$2);
|
||||
$$ = new tuple_node($4 as expression_list,@$);
|
||||
|
|
@ -3229,7 +3491,29 @@ factor
|
|||
$$ = new un_expr($2, $1.type, @$);
|
||||
}
|
||||
| sign factor
|
||||
{
|
||||
{
|
||||
if ($1.type == Operators.Minus)
|
||||
{
|
||||
var i64 = $2 as int64_const;
|
||||
if (i64 != null && i64.val == (Int64)Int32.MaxValue + 1)
|
||||
{
|
||||
$$ = new int32_const(Int32.MinValue);
|
||||
break;
|
||||
}
|
||||
var ui64 = $2 as uint64_const;
|
||||
if (ui64 != null && ui64.val == (UInt64)Int64.MaxValue + 1)
|
||||
{
|
||||
$$ = new int64_const(Int64.MinValue);
|
||||
break;
|
||||
}
|
||||
if (ui64 != null && ui64.val > (UInt64)Int64.MaxValue + 1)
|
||||
{
|
||||
parsertools.AddErrorFromResource("BAD_INT2",@$);
|
||||
break;
|
||||
}
|
||||
// ìîæíî ñäåëàòü âû÷èñëåíèå êîíñòàíòû ñ âìîíòèðîâàííûì ìèíóñîì
|
||||
}
|
||||
|
||||
$$ = new un_expr($2, $1.type, @$);
|
||||
}
|
||||
| tkDeref factor
|
||||
|
|
@ -3336,10 +3620,13 @@ variable
|
|||
if (el.Count==1 && el.expressions[0] is format_expr)
|
||||
{
|
||||
var fe = el.expressions[0] as format_expr;
|
||||
if (fe.expr == null)
|
||||
fe.expr = new int32_const(int.MaxValue,@3);
|
||||
if (fe.format1 == null)
|
||||
fe.format1 = new int32_const(int.MaxValue,@3);
|
||||
if (!parsertools.build_tree_for_formatter)
|
||||
{
|
||||
if (fe.expr == null)
|
||||
fe.expr = new int32_const(int.MaxValue,@3);
|
||||
if (fe.format1 == null)
|
||||
fe.format1 = new int32_const(int.MaxValue,@3);
|
||||
}
|
||||
$$ = new slice_expr($1 as addressed_value,fe.expr,fe.format1,fe.format2,@$);
|
||||
}
|
||||
else $$ = new indexer($1 as addressed_value,el, @$);
|
||||
|
|
@ -3373,7 +3660,7 @@ variable
|
|||
{
|
||||
$$ = new roof_dereference($1 as addressed_value,@$);
|
||||
}
|
||||
| variable tkAmpersend template_type_params
|
||||
| variable tkAmpersend template_type_or_typeclass_params
|
||||
{
|
||||
$$ = new ident_with_templateparams($1 as addressed_value, $3 as template_param_list, @$);
|
||||
}
|
||||
|
|
@ -3707,6 +3994,10 @@ keyword
|
|||
{ $$ = $1; }
|
||||
| tkYield
|
||||
{ $$ = $1; }
|
||||
| tkMatch
|
||||
{ $$ = $1; }
|
||||
| tkWhen
|
||||
{ $$ = $1; }
|
||||
;
|
||||
|
||||
reserved_keyword
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@
|
|||
%type <stn> enumeration_id expr_l1_list
|
||||
%type <stn> enumeration_id_list
|
||||
%type <ex> const_simple_expr term simple_term typed_const typed_const_plus typed_var_init_expression expr expr_with_func_decl_lambda const_expr elem range_expr const_elem array_const factor relop_expr expr_dq expr_l1 simple_expr range_term range_factor
|
||||
%type <ex> external_directive_ident init_const_expr case_label variable var_reference simple_expr_or_nothing var_question_point
|
||||
%type <ex> external_directive_ident init_const_expr case_label variable var_reference /*optional_write_expr*/ optional_read_expr simple_expr_or_nothing var_question_point
|
||||
%type <ob> for_cycle_type
|
||||
%type <ex> format_expr
|
||||
%type <stn> foreach_stmt
|
||||
|
|
@ -91,7 +91,7 @@
|
|||
%type <stn> var_address
|
||||
%type <stn> goto_stmt
|
||||
%type <id> func_name_ident param_name const_field_name func_name_with_template_args identifier_or_keyword unit_name exception_variable const_name func_meth_name_ident label_name type_decl_identifier template_identifier_with_equal
|
||||
%type <id> program_param identifier identifier_keyword_operatorname func_class_name_ident optional_identifier visibility_specifier
|
||||
%type <id> program_param identifier identifier_keyword_operatorname func_class_name_ident /*optional_identifier*/ visibility_specifier
|
||||
%type <id> property_specifier_directives non_reserved
|
||||
%type <id> typeclass_restriction
|
||||
%type <stn> if_stmt
|
||||
|
|
@ -1498,6 +1498,27 @@ object_type
|
|||
: class_attributes class_or_interface_keyword optional_base_classes optional_where_section optional_component_list_seq_end
|
||||
{
|
||||
$$ = NewObjectType((class_attribute)$1, $2, $3 as named_type_reference_list, $4 as where_definition_list, $5 as class_body_list, @$);
|
||||
class_definition cd = $$ as class_definition;
|
||||
if (cd == null || cd.body == null)
|
||||
break;
|
||||
var ccnt = cd.body.DescendantNodes().OfType<simple_property>().ToArray();
|
||||
var cm = new class_members(access_modifer.private_modifer);
|
||||
foreach (var prop in ccnt)
|
||||
{
|
||||
var td = prop.property_type;
|
||||
if (prop.accessors.read_accessor != null && prop.accessors.read_accessor.pr != null)
|
||||
{
|
||||
(prop.accessors.read_accessor.pr.proc_header as function_header).return_type = td;
|
||||
cm.Add(prop.accessors.read_accessor.pr);
|
||||
}
|
||||
if (prop.accessors.write_accessor != null && prop.accessors.write_accessor.pr != null)
|
||||
{
|
||||
prop.accessors.write_accessor.pr.proc_header.parameters.params_list[0].vars_type = td;
|
||||
cm.Add(prop.accessors.write_accessor.pr);
|
||||
}
|
||||
}
|
||||
if (cm.Count>0)
|
||||
cd.body.Insert(0, cm);
|
||||
}
|
||||
;
|
||||
|
||||
|
|
@ -1953,37 +1974,98 @@ parameter_decl
|
|||
}
|
||||
;
|
||||
|
||||
optional_identifier
|
||||
/*optional_identifier
|
||||
: identifier
|
||||
{ $$ = $1; }
|
||||
|
|
||||
{ $$ = null; }
|
||||
;
|
||||
|
||||
optional_write_expr
|
||||
: var_reference
|
||||
{ $$ = $1; }
|
||||
|
|
||||
{ $$ = null; }
|
||||
;*/
|
||||
|
||||
optional_read_expr
|
||||
: expr_with_func_decl_lambda
|
||||
{ $$ = $1; }
|
||||
|
|
||||
{ $$ = null; }
|
||||
;
|
||||
|
||||
property_specifiers
|
||||
:
|
||||
| tkRead optional_identifier write_property_specifiers
|
||||
| tkRead optional_read_expr write_property_specifiers
|
||||
{
|
||||
$$ = NewPropertySpecifiersRead($1, $2, $3 as property_accessors, @$);
|
||||
if ($2 == null || $2 is ident)
|
||||
{
|
||||
$$ = NewPropertySpecifiersRead($1, $2 as ident, null, $3 as property_accessors, @$);
|
||||
}
|
||||
else
|
||||
{
|
||||
var id = NewId("#GetGen");
|
||||
var pr = CreateAndAddToClassReadFunc($2,id,@2);
|
||||
$$ = NewPropertySpecifiersRead($1, id, pr, $3 as property_accessors, @$);
|
||||
}
|
||||
}
|
||||
| tkWrite optional_identifier read_property_specifiers
|
||||
| tkWrite unlabelled_stmt read_property_specifiers
|
||||
{
|
||||
$$ = NewPropertySpecifiersWrite($1, $2, $3 as property_accessors, @$);
|
||||
if ($2 is empty_statement)
|
||||
{
|
||||
|
||||
$$ = NewPropertySpecifiersWrite($1, null, null, $3 as property_accessors, @$);
|
||||
}
|
||||
else if ($2 is procedure_call && ($2 as procedure_call).is_ident)
|
||||
{
|
||||
|
||||
$$ = NewPropertySpecifiersWrite($1, ($2 as procedure_call).func_name as ident, null, $3 as property_accessors, @$); // ñòàðûå ñâîéñòâà - ñ èäåíòèôèêàòîðîì
|
||||
}
|
||||
else
|
||||
{
|
||||
var id = NewId("#SetGen");
|
||||
var pr = CreateAndAddToClassWriteProc($2 as statement,id,@2);
|
||||
$$ = NewPropertySpecifiersWrite($1, id, pr, $3 as property_accessors, @$);
|
||||
}
|
||||
}
|
||||
;
|
||||
write_property_specifiers
|
||||
:
|
||||
| tkWrite optional_identifier
|
||||
| tkWrite unlabelled_stmt
|
||||
{
|
||||
$$ = NewPropertySpecifiersWrite($1, $2, null, @$);
|
||||
if ($2 is empty_statement)
|
||||
{
|
||||
|
||||
$$ = NewPropertySpecifiersWrite($1, null, null, null, @$);
|
||||
}
|
||||
else if ($2 is procedure_call && ($2 as procedure_call).is_ident)
|
||||
{
|
||||
$$ = NewPropertySpecifiersWrite($1, ($2 as procedure_call).func_name as ident, null, null, @$); // ñòàðûå ñâîéñòâà - ñ èäåíòèôèêàòîðîì
|
||||
}
|
||||
else
|
||||
{
|
||||
var id = NewId("#SetGen");
|
||||
var pr = CreateAndAddToClassWriteProc($2 as statement,id,@2);
|
||||
$$ = NewPropertySpecifiersWrite($1, id, pr, null, @$);
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
read_property_specifiers
|
||||
:
|
||||
| tkRead optional_identifier
|
||||
| tkRead optional_read_expr
|
||||
{
|
||||
$$ = NewPropertySpecifiersRead($1, $2, null, @$);
|
||||
if ($2 == null || $2 is ident)
|
||||
{
|
||||
$$ = NewPropertySpecifiersRead($1, $2 as ident, null, null, @$);
|
||||
}
|
||||
else
|
||||
{
|
||||
var id = NewId("#GetGen");
|
||||
var pr = CreateAndAddToClassReadFunc($2,id,@2);
|
||||
$$ = NewPropertySpecifiersRead($1, id, pr, null, @$);
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
|
|
@ -2583,7 +2665,7 @@ var_ident_list
|
|||
proc_call
|
||||
: var_reference
|
||||
{
|
||||
$$ = new procedure_call($1 as addressed_value, @$);
|
||||
$$ = new procedure_call($1 as addressed_value, $1 is ident, @$);
|
||||
}
|
||||
;
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -220,7 +220,6 @@
|
|||
<name value="template_identifier_with_equal" />
|
||||
<name value="simple_type_identifier" />
|
||||
<name value="qualified_identifier" />
|
||||
<name value="optional_identifier" />
|
||||
<name value="proc_name" />
|
||||
<name value="func_name" />
|
||||
<name value="func_class_name_ident" />
|
||||
|
|
|
|||
|
|
@ -195,5 +195,6 @@ script=
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ namespace GPPGParserScanner
|
|||
return nnspd;
|
||||
}
|
||||
|
||||
public property_accessors NewPropertySpecifiersRead(ident tkRead, ident opt_identifier, property_accessors property_specifiers, LexLocation loc)
|
||||
public property_accessors NewPropertySpecifiersRead(ident tkRead, ident opt_identifier, procedure_definition pr, property_accessors property_specifiers, LexLocation loc)
|
||||
{
|
||||
var nnps = property_specifiers;
|
||||
if (nnps == null)
|
||||
|
|
@ -225,23 +225,23 @@ namespace GPPGParserScanner
|
|||
}
|
||||
if (opt_identifier != null && opt_identifier.name.ToLower() == "write")
|
||||
{
|
||||
nnps.read_accessor = new read_accessor_name(null);
|
||||
nnps.write_accessor = new write_accessor_name(null);
|
||||
nnps.read_accessor = new read_accessor_name(null, null);
|
||||
nnps.write_accessor = new write_accessor_name(null, null);
|
||||
nnps.read_accessor.source_context = tkRead.source_context;
|
||||
nnps.write_accessor.source_context = opt_identifier.source_context;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (opt_identifier != null)
|
||||
nnps.read_accessor = new read_accessor_name(opt_identifier, tkRead.source_context.Merge(opt_identifier.source_context));
|
||||
else nnps.read_accessor = new read_accessor_name(opt_identifier, tkRead.source_context);
|
||||
nnps.read_accessor = new read_accessor_name(opt_identifier, pr, tkRead.source_context.Merge(opt_identifier.source_context));
|
||||
else nnps.read_accessor = new read_accessor_name(opt_identifier, pr, tkRead.source_context);
|
||||
|
||||
}
|
||||
nnps.source_context = loc;
|
||||
return nnps;
|
||||
}
|
||||
|
||||
public property_accessors NewPropertySpecifiersWrite(ident tkWrite, ident opt_identifier, property_accessors property_specifiers, LexLocation loc)
|
||||
public property_accessors NewPropertySpecifiersWrite(ident tkWrite, ident opt_identifier, procedure_definition pr, property_accessors property_specifiers, LexLocation loc)
|
||||
{
|
||||
var nnpsw = property_specifiers;
|
||||
if (nnpsw == null)
|
||||
|
|
@ -249,8 +249,8 @@ namespace GPPGParserScanner
|
|||
nnpsw = new property_accessors();
|
||||
}
|
||||
if (opt_identifier != null)
|
||||
nnpsw.write_accessor = new write_accessor_name(opt_identifier,tkWrite.source_context.Merge(opt_identifier.source_context));
|
||||
else nnpsw.write_accessor = new write_accessor_name(opt_identifier,tkWrite.source_context);
|
||||
nnpsw.write_accessor = new write_accessor_name(opt_identifier,pr,tkWrite.source_context.Merge(opt_identifier.source_context));
|
||||
else nnpsw.write_accessor = new write_accessor_name(opt_identifier,pr,tkWrite.source_context);
|
||||
nnpsw.source_context = loc;
|
||||
return nnpsw;
|
||||
}
|
||||
|
|
@ -509,5 +509,25 @@ namespace GPPGParserScanner
|
|||
sl.source_context = loc;
|
||||
return sl;
|
||||
}
|
||||
}
|
||||
|
||||
public procedure_definition CreateAndAddToClassReadFunc(expression ex, ident id, SourceContext sc)
|
||||
{
|
||||
var fd = SyntaxTreeBuilder.BuildShortFuncDefinition(new formal_parameters(), null, new method_name(id.name, sc), new no_type(), ex, sc);
|
||||
return fd;
|
||||
}
|
||||
public procedure_definition CreateAndAddToClassWriteProc(statement st, ident id, SourceContext sc)
|
||||
{
|
||||
var fp = SyntaxTreeBuilder.BuildFormalParameters(new List<ident>() { new ident("value") }, new List<type_definition>() { new no_type() });
|
||||
var pd = SyntaxTreeBuilder.BuildShortProcDefinition(fp, null, new method_name(id.name, sc), st, sc);
|
||||
return pd;
|
||||
}
|
||||
|
||||
private int num1 = 0;
|
||||
|
||||
public ident NewId(string prefix)
|
||||
{
|
||||
num1++;
|
||||
return new ident(prefix + num1.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
!define VERSION '3.4.0.1682'
|
||||
!define VERSION '3.4.0.1684'
|
||||
|
|
|
|||
|
|
@ -2545,6 +2545,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
DefaultVisit(_write_accessor_name);
|
||||
pre_do_visit(_write_accessor_name);
|
||||
visit(write_accessor_name.accessor_name);
|
||||
visit(write_accessor_name.pr);
|
||||
post_do_visit(_write_accessor_name);
|
||||
}
|
||||
|
||||
|
|
@ -2553,6 +2554,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
DefaultVisit(_read_accessor_name);
|
||||
pre_do_visit(_read_accessor_name);
|
||||
visit(read_accessor_name.accessor_name);
|
||||
visit(read_accessor_name.pr);
|
||||
post_do_visit(_read_accessor_name);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
|
||||
public static simple_property BuildSimpleReadWriteProperty(ident name, ident field, type_definition type)
|
||||
{
|
||||
return new simple_property(name, type, new property_accessors(new read_accessor_name(field), new write_accessor_name(field)));
|
||||
return new simple_property(name, type, new property_accessors(new read_accessor_name(field,null), new write_accessor_name(field, null)));
|
||||
}
|
||||
|
||||
public static class_members BuildSimpleReadPropertiesSection(List<ident> names, List<ident> fields, List<type_definition> types)
|
||||
|
|
|
|||
|
|
@ -1650,6 +1650,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
{
|
||||
read_syntax_tree_node(_write_accessor_name);
|
||||
_write_accessor_name.accessor_name = _read_node() as ident;
|
||||
_write_accessor_name.pr = _read_node() as procedure_definition;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1662,6 +1663,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
{
|
||||
read_syntax_tree_node(_read_accessor_name);
|
||||
_read_accessor_name.accessor_name = _read_node() as ident;
|
||||
_read_accessor_name.pr = _read_node() as procedure_definition;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -2057,6 +2059,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
{
|
||||
read_statement(_procedure_call);
|
||||
_procedure_call.func_name = _read_node() as addressed_value;
|
||||
_procedure_call.is_ident = br.ReadBoolean();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2066,6 +2066,15 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
bw.Write((byte)1);
|
||||
_write_accessor_name.accessor_name.visit(this);
|
||||
}
|
||||
if (_write_accessor_name.pr == null)
|
||||
{
|
||||
bw.Write((byte)0);
|
||||
}
|
||||
else
|
||||
{
|
||||
bw.Write((byte)1);
|
||||
_write_accessor_name.pr.visit(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -2087,6 +2096,15 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
bw.Write((byte)1);
|
||||
_read_accessor_name.accessor_name.visit(this);
|
||||
}
|
||||
if (_read_accessor_name.pr == null)
|
||||
{
|
||||
bw.Write((byte)0);
|
||||
}
|
||||
else
|
||||
{
|
||||
bw.Write((byte)1);
|
||||
_read_accessor_name.pr.visit(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -2819,6 +2837,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
bw.Write((byte)1);
|
||||
_procedure_call.func_name.visit(this);
|
||||
}
|
||||
bw.Write(_procedure_call.is_ident);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13949,7 +13949,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
FillParentsInDirectChilds();
|
||||
}
|
||||
|
||||
protected List<ident> _ln;
|
||||
protected List<ident> _ln=new List<ident>();
|
||||
protected ident _class_name;
|
||||
protected ident _meth_name;
|
||||
protected ident _explicit_interface_name;
|
||||
|
|
@ -15665,7 +15665,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
|
||||
|
||||
///<summary>
|
||||
///
|
||||
///procedure_definition pr != null если метод сгенерирован по выражению
|
||||
///</summary>
|
||||
[Serializable]
|
||||
public partial class write_accessor_name : syntax_tree_node
|
||||
|
|
@ -15682,22 +15682,25 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
///<summary>
|
||||
///Конструктор с параметрами.
|
||||
///</summary>
|
||||
public write_accessor_name(ident _accessor_name)
|
||||
public write_accessor_name(ident _accessor_name,procedure_definition _pr)
|
||||
{
|
||||
this._accessor_name=_accessor_name;
|
||||
this._pr=_pr;
|
||||
FillParentsInDirectChilds();
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Конструктор с параметрами.
|
||||
///</summary>
|
||||
public write_accessor_name(ident _accessor_name,SourceContext sc)
|
||||
public write_accessor_name(ident _accessor_name,procedure_definition _pr,SourceContext sc)
|
||||
{
|
||||
this._accessor_name=_accessor_name;
|
||||
this._pr=_pr;
|
||||
source_context = sc;
|
||||
FillParentsInDirectChilds();
|
||||
}
|
||||
protected ident _accessor_name;
|
||||
protected procedure_definition _pr;
|
||||
|
||||
///<summary>
|
||||
///
|
||||
|
|
@ -15716,6 +15719,23 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
}
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///
|
||||
///</summary>
|
||||
public procedure_definition pr
|
||||
{
|
||||
get
|
||||
{
|
||||
return _pr;
|
||||
}
|
||||
set
|
||||
{
|
||||
_pr=value;
|
||||
if (_pr != null)
|
||||
_pr.Parent = this;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary> Создает копию узла </summary>
|
||||
public override syntax_tree_node Clone()
|
||||
|
|
@ -15729,6 +15749,11 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
copy.accessor_name = (ident)accessor_name.Clone();
|
||||
copy.accessor_name.Parent = copy;
|
||||
}
|
||||
if (pr != null)
|
||||
{
|
||||
copy.pr = (procedure_definition)pr.Clone();
|
||||
copy.pr.Parent = copy;
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
|
@ -15743,6 +15768,8 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
{
|
||||
if (accessor_name != null)
|
||||
accessor_name.Parent = this;
|
||||
if (pr != null)
|
||||
pr.Parent = this;
|
||||
}
|
||||
|
||||
///<summary> Заполняет поля Parent во всем поддереве </summary>
|
||||
|
|
@ -15750,6 +15777,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
{
|
||||
FillParentsInDirectChilds();
|
||||
accessor_name?.FillParentsInAllChilds();
|
||||
pr?.FillParentsInAllChilds();
|
||||
}
|
||||
|
||||
///<summary>
|
||||
|
|
@ -15759,7 +15787,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
{
|
||||
get
|
||||
{
|
||||
return 1;
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
///<summary>
|
||||
|
|
@ -15769,7 +15797,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
{
|
||||
get
|
||||
{
|
||||
return 1;
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
///<summary>
|
||||
|
|
@ -15785,6 +15813,8 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
{
|
||||
case 0:
|
||||
return accessor_name;
|
||||
case 1:
|
||||
return pr;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
@ -15797,6 +15827,9 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
case 0:
|
||||
accessor_name = (ident)value;
|
||||
break;
|
||||
case 1:
|
||||
pr = (procedure_definition)value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -15814,7 +15847,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
|
||||
|
||||
///<summary>
|
||||
///
|
||||
///procedure_definition pr != null если метод сгенерирован по выражению
|
||||
///</summary>
|
||||
[Serializable]
|
||||
public partial class read_accessor_name : syntax_tree_node
|
||||
|
|
@ -15831,22 +15864,25 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
///<summary>
|
||||
///Конструктор с параметрами.
|
||||
///</summary>
|
||||
public read_accessor_name(ident _accessor_name)
|
||||
public read_accessor_name(ident _accessor_name,procedure_definition _pr)
|
||||
{
|
||||
this._accessor_name=_accessor_name;
|
||||
this._pr=_pr;
|
||||
FillParentsInDirectChilds();
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Конструктор с параметрами.
|
||||
///</summary>
|
||||
public read_accessor_name(ident _accessor_name,SourceContext sc)
|
||||
public read_accessor_name(ident _accessor_name,procedure_definition _pr,SourceContext sc)
|
||||
{
|
||||
this._accessor_name=_accessor_name;
|
||||
this._pr=_pr;
|
||||
source_context = sc;
|
||||
FillParentsInDirectChilds();
|
||||
}
|
||||
protected ident _accessor_name;
|
||||
protected procedure_definition _pr;
|
||||
|
||||
///<summary>
|
||||
///
|
||||
|
|
@ -15865,6 +15901,23 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
}
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///
|
||||
///</summary>
|
||||
public procedure_definition pr
|
||||
{
|
||||
get
|
||||
{
|
||||
return _pr;
|
||||
}
|
||||
set
|
||||
{
|
||||
_pr=value;
|
||||
if (_pr != null)
|
||||
_pr.Parent = this;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary> Создает копию узла </summary>
|
||||
public override syntax_tree_node Clone()
|
||||
|
|
@ -15878,6 +15931,11 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
copy.accessor_name = (ident)accessor_name.Clone();
|
||||
copy.accessor_name.Parent = copy;
|
||||
}
|
||||
if (pr != null)
|
||||
{
|
||||
copy.pr = (procedure_definition)pr.Clone();
|
||||
copy.pr.Parent = copy;
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
|
@ -15892,6 +15950,8 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
{
|
||||
if (accessor_name != null)
|
||||
accessor_name.Parent = this;
|
||||
if (pr != null)
|
||||
pr.Parent = this;
|
||||
}
|
||||
|
||||
///<summary> Заполняет поля Parent во всем поддереве </summary>
|
||||
|
|
@ -15899,6 +15959,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
{
|
||||
FillParentsInDirectChilds();
|
||||
accessor_name?.FillParentsInAllChilds();
|
||||
pr?.FillParentsInAllChilds();
|
||||
}
|
||||
|
||||
///<summary>
|
||||
|
|
@ -15908,7 +15969,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
{
|
||||
get
|
||||
{
|
||||
return 1;
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
///<summary>
|
||||
|
|
@ -15918,7 +15979,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
{
|
||||
get
|
||||
{
|
||||
return 1;
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
///<summary>
|
||||
|
|
@ -15934,6 +15995,8 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
{
|
||||
case 0:
|
||||
return accessor_name;
|
||||
case 1:
|
||||
return pr;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
@ -15946,6 +16009,9 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
case 0:
|
||||
accessor_name = (ident)value;
|
||||
break;
|
||||
case 1:
|
||||
pr = (procedure_definition)value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -21631,7 +21697,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
|
||||
|
||||
///<summary>
|
||||
///
|
||||
///bool is_ident; // является ли вызов процедуры идентификатором. Нужно исключительно для секции write свойств
|
||||
///</summary>
|
||||
[Serializable]
|
||||
public partial class procedure_call : statement
|
||||
|
|
@ -21648,22 +21714,25 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
///<summary>
|
||||
///Конструктор с параметрами.
|
||||
///</summary>
|
||||
public procedure_call(addressed_value _func_name)
|
||||
public procedure_call(addressed_value _func_name,bool _is_ident)
|
||||
{
|
||||
this._func_name=_func_name;
|
||||
this._is_ident=_is_ident;
|
||||
FillParentsInDirectChilds();
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Конструктор с параметрами.
|
||||
///</summary>
|
||||
public procedure_call(addressed_value _func_name,SourceContext sc)
|
||||
public procedure_call(addressed_value _func_name,bool _is_ident,SourceContext sc)
|
||||
{
|
||||
this._func_name=_func_name;
|
||||
this._is_ident=_is_ident;
|
||||
source_context = sc;
|
||||
FillParentsInDirectChilds();
|
||||
}
|
||||
protected addressed_value _func_name;
|
||||
protected bool _is_ident;
|
||||
|
||||
///<summary>
|
||||
///
|
||||
|
|
@ -21682,6 +21751,21 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
}
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///
|
||||
///</summary>
|
||||
public bool is_ident
|
||||
{
|
||||
get
|
||||
{
|
||||
return _is_ident;
|
||||
}
|
||||
set
|
||||
{
|
||||
_is_ident=value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary> Создает копию узла </summary>
|
||||
public override syntax_tree_node Clone()
|
||||
|
|
@ -21700,6 +21784,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
copy.func_name = (addressed_value)func_name.Clone();
|
||||
copy.func_name.Parent = copy;
|
||||
}
|
||||
copy.is_ident = is_ident;
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1063,7 +1063,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
public partial class property_accessors
|
||||
{
|
||||
public property_accessors(ident read_accessor, ident write_accessor, SourceContext sc = null)
|
||||
: this(new read_accessor_name(read_accessor), new write_accessor_name(write_accessor),sc)
|
||||
: this(new read_accessor_name(read_accessor, null), new write_accessor_name(write_accessor, null),sc)
|
||||
{ }
|
||||
}
|
||||
|
||||
|
|
@ -1134,6 +1134,8 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
|
||||
public partial class procedure_call
|
||||
{
|
||||
public procedure_call(addressed_value _func_name, SourceContext sc=null) : this(_func_name, false, sc) { }
|
||||
|
||||
public procedure_call(ident name)
|
||||
{
|
||||
this._func_name = name;
|
||||
|
|
|
|||
|
|
@ -846,7 +846,7 @@
|
|||
</SyntaxNode>
|
||||
<SyntaxNode Name="method_name" BaseName="syntax_tree_node">
|
||||
<Fields>
|
||||
<ExtendedField Name="ln" Type="List<ident>" CreateVariable="false" DeleteVariable="false" />
|
||||
<ExtendedField Name="ln" Type="List<ident>" CreateVariable="true" DeleteVariable="false" />
|
||||
<SyntaxField Name="class_name" SyntaxType="ident" />
|
||||
<SyntaxField Name="meth_name" SyntaxType="ident" />
|
||||
<SyntaxField Name="explicit_interface_name" SyntaxType="ident" />
|
||||
|
|
@ -979,6 +979,7 @@
|
|||
<SyntaxNode Name="write_accessor_name" BaseName="syntax_tree_node">
|
||||
<Fields>
|
||||
<SyntaxField Name="accessor_name" SyntaxType="ident" />
|
||||
<SyntaxField Name="pr" SyntaxType="procedure_definition" />
|
||||
</Fields>
|
||||
<Methods />
|
||||
<Tags>
|
||||
|
|
@ -989,6 +990,7 @@
|
|||
<SyntaxNode Name="read_accessor_name" BaseName="syntax_tree_node">
|
||||
<Fields>
|
||||
<SyntaxField Name="accessor_name" SyntaxType="ident" />
|
||||
<SyntaxField Name="pr" SyntaxType="procedure_definition" />
|
||||
</Fields>
|
||||
<Methods />
|
||||
<Tags>
|
||||
|
|
@ -1327,6 +1329,7 @@
|
|||
<SyntaxNode Name="procedure_call" BaseName="statement">
|
||||
<Fields>
|
||||
<SyntaxField Name="func_name" SyntaxType="addressed_value" />
|
||||
<ExtendedField Name="is_ident" Type="bool" CreateVariable="false" DeleteVariable="false" />
|
||||
</Fields>
|
||||
<Methods />
|
||||
<Tags>
|
||||
|
|
@ -4020,9 +4023,10 @@
|
|||
<HelpData Key="procedure_attributes_list.procedure_attributes_list(proc_attribute attr, SourceContext sc): this(new procedure_attribute(attr),sc)" Value="" />
|
||||
<HelpData Key="procedure_attributes_list.procedure_attributes_list(procedure_attribute _procedure_attribute)" Value="" />
|
||||
<HelpData Key="procedure_attributes_list.procedure_attributes_list(procedure_attribute _procedure_attribute, SourceContext sc)" Value="" />
|
||||
<HelpData Key="procedure_call" Value="" />
|
||||
<HelpData Key="procedure_call" Value="bool is_ident; // является ли вызов процедуры идентификатором. Нужно исключительно для секции write свойств" />
|
||||
<HelpData Key="procedure_call." Value="" />
|
||||
<HelpData Key="procedure_call.func_name" Value="" />
|
||||
<HelpData Key="procedure_call.is_ident" Value="" />
|
||||
<HelpData Key="procedure_call.override string ToString()" Value="" />
|
||||
<HelpData Key="procedure_call.parametres" Value="" />
|
||||
<HelpData Key="procedure_definition" Value="" />
|
||||
|
|
@ -4117,8 +4121,9 @@
|
|||
<HelpData Key="raise_stmt.address" Value="" />
|
||||
<HelpData Key="raise_stmt.expr" Value="" />
|
||||
<HelpData Key="raise_stmt.object" Value="" />
|
||||
<HelpData Key="read_accessor_name" Value="" />
|
||||
<HelpData Key="read_accessor_name" Value="procedure_definition pr != null если метод сгенерирован по выражению" />
|
||||
<HelpData Key="read_accessor_name.accessor_name" Value="" />
|
||||
<HelpData Key="read_accessor_name.pr" Value="" />
|
||||
<HelpData Key="record_const" Value="" />
|
||||
<HelpData Key="record_const." Value="" />
|
||||
<HelpData Key="record_const.rec_consts" Value="" />
|
||||
|
|
@ -4603,8 +4608,9 @@
|
|||
<HelpData Key="with_statement." Value="" />
|
||||
<HelpData Key="with_statement.do_with" Value="Список объектов, с которыми производить действия." />
|
||||
<HelpData Key="with_statement.what_do" Value="Что делать." />
|
||||
<HelpData Key="write_accessor_name" Value="" />
|
||||
<HelpData Key="write_accessor_name" Value="procedure_definition pr != null если метод сгенерирован по выражению" />
|
||||
<HelpData Key="write_accessor_name.accessor_name" Value="" />
|
||||
<HelpData Key="write_accessor_name.pr" Value="" />
|
||||
<HelpData Key="yield_node" Value="" />
|
||||
<HelpData Key="yield_node.ex" Value="" />
|
||||
<HelpData Key="yield_node.override string ToString()" Value="" />
|
||||
|
|
|
|||
Loading…
Reference in a new issue