source: trunk/ada-2012/src/parser/gela-fix_node_factories.adb@ 379

Last change on this file since 379 was 379, checked in by Maxim Reznik, 6 years ago

Let Fixed_Operator_Symbol look like operator_symbol

until Down interpretation is calculated and then defining_name is found.

File size: 3.3 KB
Line 
1with Gela.Nodes.Fixed_Operator_Symbols;
2with Gela.Element_Visiters;
3with Gela.Elements.Auxiliary_Applies;
4with Gela.Elements.Associations;
5with Gela.Elements.Record_Aggregates;
6with Gela.Elements.Prefixes;
7
8package body Gela.Fix_Node_Factories is
9
10 ---------------------
11 -- Operator_Symbol --
12 ---------------------
13
14 overriding function Operator_Symbol
15 (Self : in out Element_Factory;
16 Operator_Symbol_Token : Gela.Lexical_Types.Token_Count)
17 return Gela.Elements.Operator_Symbols.Operator_Symbol_Access
18 is
19 Result : constant Gela.Nodes.Fixed_Operator_Symbols
20 .Operator_Symbol_Access :=
21 new Gela.Nodes.Fixed_Operator_Symbols.Operator_Symbol'
22 (Gela.Nodes.Fixed_Operator_Symbols.Create
23 (Self.Comp,
24 Operator_Symbol_Token));
25 begin
26 Result.Set_Down (0);
27
28 return Gela.Elements.Operator_Symbols.Operator_Symbol_Access (Result);
29 end Operator_Symbol;
30
31 overriding function Procedure_Call_Statement
32 (Self : in out Element_Factory;
33 Function_Call : Gela.Elements.Names.Name_Access;
34 Semicolon_Token : Gela.Lexical_Types.Token_Count)
35 return Gela.Elements.Procedure_Call_Statements.
36 Procedure_Call_Statement_Access
37 is
38 package Get is
39 type Visiter is new Gela.Element_Visiters.Visiter with record
40 Result : Gela.Elements.Auxiliary_Applies.Auxiliary_Apply_Access;
41 end record;
42
43 overriding procedure Auxiliary_Apply
44 (Self : in out Visiter;
45 Node : not null Gela.Elements.Auxiliary_Applies.
46 Auxiliary_Apply_Access);
47 end Get;
48
49 package body Get is
50
51 overriding procedure Auxiliary_Apply
52 (Self : in out Visiter;
53 Node : not null Gela.Elements.Auxiliary_Applies.
54 Auxiliary_Apply_Access)
55 is
56 begin
57 Self.Result := Node;
58 end Auxiliary_Apply;
59 end Get;
60
61 use type Gela.Elements.Auxiliary_Applies.Auxiliary_Apply_Access;
62
63 V : Get.Visiter;
64 Parent : Gela.Node_Factories.Element_Factory renames
65 Gela.Node_Factories.Element_Factory (Self);
66 begin
67 Function_Call.Visit (V);
68
69 if V.Result /= null then
70 return Parent. Procedure_Call_Statement
71 (Function_Call, Semicolon_Token);
72 end if;
73
74 declare
75 Prefix : constant Gela.Elements.Prefixes.Prefix_Access :=
76 Gela.Elements.Prefixes.Prefix_Access (Function_Call);
77 Args : constant Gela.Elements.Associations.Association_Sequence_Access
78 := Self.Association_Sequence;
79 RA : constant Gela.Elements.Record_Aggregates.
80 Record_Aggregate_Access :=
81 Self.Record_Aggregate
82 (Left_Token => 0,
83 Record_Component_Associations => Args,
84 Right_Token => 0);
85 Call : constant Gela.Elements.Auxiliary_Applies.Auxiliary_Apply_Access
86 := Self.Auxiliary_Apply
87 (Prefix => Prefix,
88 Function_Call_Parameters => RA);
89 Name : constant Gela.Elements.Names.Name_Access :=
90 Gela.Elements.Names.Name_Access (Call);
91 begin
92 return Parent. Procedure_Call_Statement (Name, Semicolon_Token);
93 end;
94 end Procedure_Call_Statement;
95
96end Gela.Fix_Node_Factories;
Note: See TracBrowser for help on using the repository browser.