Commit cc45b902 authored by yoogx's avatar yoogx
Browse files

* Handle (list of)+ in property constants

	For github issue #22
parent d82e1551
...@@ -355,8 +355,10 @@ package body Ocarina.BE_AADL.Properties is ...@@ -355,8 +355,10 @@ package body Ocarina.BE_AADL.Properties is
Write_Space; Write_Space;
if Single_Value (Constant_Value (Node)) = No_Node then if Single_Value (Constant_Value (Node)) = No_Node then
Print_Tokens ((T_List, T_Of)); for J in 1 .. Multiplicity (Node) loop
Write_Space; Print_Tokens ((T_List, T_Of));
Write_Space;
end loop;
end if; end if;
case Kind (Constant_Type (Node)) is case Kind (Constant_Type (Node)) is
...@@ -370,6 +372,8 @@ package body Ocarina.BE_AADL.Properties is ...@@ -370,6 +372,8 @@ package body Ocarina.BE_AADL.Properties is
Print_Token (T_AADLString); Print_Token (T_AADLString);
when K_Unique_Property_Type_Identifier => when K_Unique_Property_Type_Identifier =>
Print_Entity_Reference (Constant_Type (Node)); Print_Entity_Reference (Constant_Type (Node));
when K_Classifier_Type =>
Print_Classifier_Type (List_Items (Constant_Type (Node)));
when others => when others =>
Node_Not_Handled (Constant_Type (Node)); Node_Not_Handled (Constant_Type (Node));
end case; end case;
......
...@@ -186,7 +186,8 @@ package body Ocarina.Builder.AADL.Properties is ...@@ -186,7 +186,8 @@ package body Ocarina.Builder.AADL.Properties is
Constant_Type : Node_Id; Constant_Type : Node_Id;
Unit_Identifier : Node_Id; Unit_Identifier : Node_Id;
Single_Value : Node_Id; Single_Value : Node_Id;
Multiple_Values : List_Id) return Node_Id Multiple_Values : List_Id;
Multiplicity : Int) return Node_Id
is is
use Ocarina.ME_AADL.AADL_Tree.Nutils; use Ocarina.ME_AADL.AADL_Tree.Nutils;
use Ocarina.ME_AADL.AADL_Tree.Nodes; use Ocarina.ME_AADL.AADL_Tree.Nodes;
...@@ -205,20 +206,20 @@ package body Ocarina.Builder.AADL.Properties is ...@@ -205,20 +206,20 @@ package body Ocarina.Builder.AADL.Properties is
or else Kind (Constant_Type) = K_Real_Type or else Kind (Constant_Type) = K_Real_Type
or else Kind (Constant_Type) = K_String_Type or else Kind (Constant_Type) = K_String_Type
or else Kind (Constant_Type) = K_Boolean_Type or else Kind (Constant_Type) = K_Boolean_Type
or else Kind (Constant_Type) = K_Unique_Property_Type_Identifier); or else Kind (Constant_Type) = K_Unique_Property_Type_Identifier
or else Kind (Constant_Type) = K_Classifier_Type);
Node : constant Node_Id := Node : constant Node_Id :=
New_Node (K_Constant_Property_Declaration, Loc); New_Node (K_Constant_Property_Declaration, Loc);
Value_Node : constant Node_Id := New_Node (K_Property_Value, Loc); Value_Node : constant Node_Id := New_Node (K_Property_Value, Loc);
Success : Boolean := True; Success : Boolean := True;
begin begin
Set_Single_Value (Value_Node, Single_Value);
Set_Multi_Value (Value_Node, Multiple_Values);
Set_Constant_Value (Node, Value_Node); Set_Constant_Value (Node, Value_Node);
Set_Identifier (Node, Name); Set_Identifier (Node, Name);
Set_Corresponding_Entity (Name, Node); Set_Corresponding_Entity (Name, Node);
Set_Constant_Type (Node, Constant_Type); Set_Constant_Type (Node, Constant_Type);
Set_Unique_Unit_Identifier (Node, Unit_Identifier); Set_Unique_Unit_Identifier (Node, Unit_Identifier);
Set_Multiplicity (Node, Multiplicity);
Set_Value_Container (Value_Node, Property_Set); Set_Value_Container (Value_Node, Property_Set);
Set_Single_Value (Value_Node, Single_Value); Set_Single_Value (Value_Node, Single_Value);
......
...@@ -51,7 +51,8 @@ package Ocarina.Builder.AADL.Properties is ...@@ -51,7 +51,8 @@ package Ocarina.Builder.AADL.Properties is
Constant_Type : Node_Id; Constant_Type : Node_Id;
Unit_Identifier : Node_Id; Unit_Identifier : Node_Id;
Single_Value : Node_Id; Single_Value : Node_Id;
Multiple_Values : List_Id) return Node_Id; Multiple_Values : List_Id;
Multiplicity : Int) return Node_Id;
-- Either Single_Value /= No_Node and Mulitple_Values = No_Node, -- Either Single_Value /= No_Node and Mulitple_Values = No_Node,
-- then we have a single valued constant; or Single_Value = -- then we have a single valued constant; or Single_Value =
-- No_Node, then we have a muli valued constant -- No_Node, then we have a muli valued constant
......
...@@ -1136,6 +1136,7 @@ module Ocarina::ME_AADL::AADL_Tree::Nodes { ...@@ -1136,6 +1136,7 @@ module Ocarina::ME_AADL::AADL_Tree::Nodes {
interface Multi_Valued_Property : Node_Id { interface Multi_Valued_Property : Node_Id {
Node_Id Property_Type_Designator; Node_Id Property_Type_Designator;
List_Id Property_Expressions; List_Id Property_Expressions;
long Multiplicity; // number of "list of" in property type
}; };
// FIXME: Single_Valued_Property and multi_valued_property should inherit // FIXME: Single_Valued_Property and multi_valued_property should inherit
...@@ -1192,7 +1193,7 @@ module Ocarina::ME_AADL::AADL_Tree::Nodes { ...@@ -1192,7 +1193,7 @@ module Ocarina::ME_AADL::AADL_Tree::Nodes {
// AADL_V2 // AADL_V2
// multi_valued_property_constant ::= // multi_valued_property_constant ::=
// defining_property_constant_identifier : constant list of // defining_property_constant_identifier : constant (list of)+
// property_type_designator => // property_type_designator =>
// ( [ constant_property_expression // ( [ constant_property_expression
// { , constant_property_expression }* ] ) ; // { , constant_property_expression }* ] ) ;
...@@ -1201,6 +1202,7 @@ module Ocarina::ME_AADL::AADL_Tree::Nodes { ...@@ -1201,6 +1202,7 @@ module Ocarina::ME_AADL::AADL_Tree::Nodes {
Node_Id Constant_Type; Node_Id Constant_Type;
Node_Id Unique_Unit_Identifier; Node_Id Unique_Unit_Identifier;
Node_Id Constant_Value; // is of kind property_value Node_Id Constant_Value; // is of kind property_value
long Multiplicity; // number of "list of" in property type
}; };
interface Property_Value : Node_Id { interface Property_Value : Node_Id {
......
...@@ -1114,7 +1114,7 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is ...@@ -1114,7 +1114,7 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is
-- => constant_property_value ; -- => constant_property_value ;
-- multi_valued_property_constant ::= -- multi_valued_property_constant ::=
-- defining_property_constant_identifier : constant list of -- defining_property_constant_identifier : constant (list of)+
-- ( ( aadlinteger -- ( ( aadlinteger
-- | aadlreal ) [ units_unique_property_type_identifier ] -- | aadlreal ) [ units_unique_property_type_identifier ]
-- | aadlstring | aadlboolean -- | aadlstring | aadlboolean
...@@ -1159,6 +1159,7 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is ...@@ -1159,6 +1159,7 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is
Property_Values : List_Id := No_List; -- only for multi_valued_property Property_Values : List_Id := No_List; -- only for multi_valued_property
Code : Parsing_Code; Code : Parsing_Code;
Loc : Location; Loc : Location;
Multiplicity : Int := 0;
begin begin
Save_Lexer (Loc); Save_Lexer (Loc);
...@@ -1166,7 +1167,7 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is ...@@ -1166,7 +1167,7 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is
if Token = T_List then if Token = T_List then
Code := PC_Multi_Valued_Property_Constant; Code := PC_Multi_Valued_Property_Constant;
Multiplicity := 1;
Scan_Token; Scan_Token;
if Token /= T_Of then if Token /= T_Of then
DPE (Code, T_Of); DPE (Code, T_Of);
...@@ -1178,6 +1179,28 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is ...@@ -1178,6 +1179,28 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is
Code := PC_Single_Valued_Property_Constant; Code := PC_Single_Valued_Property_Constant;
end if; end if;
if AADL_Version = AADL_V2
and then Code = PC_Multi_Valued_Property_Constant
then
loop
Save_Lexer (Loc);
Scan_Token;
if Token = T_List then
Scan_Token;
if Token /= T_Of then
DPE (Code, T_Of);
Skip_Tokens (T_Semicolon);
return No_Node;
end if;
Multiplicity := Multiplicity + 1;
else
Restore_Lexer (Loc);
exit;
end if;
end loop;
end if;
case AADL_Version is case AADL_Version is
when AADL_V1 => when AADL_V1 =>
Save_Lexer (Loc); Save_Lexer (Loc);
...@@ -1378,7 +1401,8 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is ...@@ -1378,7 +1401,8 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is
Single_Value => Property_Value, Single_Value => Property_Value,
Multiple_Values => Property_Values, Multiple_Values => Property_Values,
Unit_Identifier => Unit_Ident, Unit_Identifier => Unit_Ident,
Constant_Type => Constant_Type); Constant_Type => Constant_Type,
Multiplicity => Multiplicity);
return Property; return Property;
end P_Property_Constant; end P_Property_Constant;
......
...@@ -17,6 +17,7 @@ Declarations List_Id 7 ...@@ -17,6 +17,7 @@ Declarations List_Id 7
Display_Name Name_Id "Default_Active_Thread_Handling_Protocol" Display_Name Name_Id "Default_Active_Thread_Handling_Protocol"
Scope_Entity Node_Id 6 Scope_Entity Node_Id 6
Backend_Node Node_Id 0 Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 10 Constant_Type Node_Id 10
10 unique property type identifier aadl_project.aadl:11:45 10 unique property type identifier aadl_project.aadl:11:45
Identifier Node_Id 9 Identifier Node_Id 9
...@@ -427,6 +428,7 @@ Declarations List_Id 7 ...@@ -427,6 +428,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Aadlinteger" Display_Name Name_Id "Max_Aadlinteger"
Scope_Entity Node_Id 6 Scope_Entity Node_Id 6
Backend_Node Node_Id 0 Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 107 Constant_Type Node_Id 107
107 integer type aadl_project.aadl:107:29 107 integer type aadl_project.aadl:107:29
Type_Range Node_Id 0 Type_Range Node_Id 0
...@@ -451,6 +453,7 @@ Declarations List_Id 7 ...@@ -451,6 +453,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Base_Address" Display_Name Name_Id "Max_Base_Address"
Scope_Entity Node_Id 6 Scope_Entity Node_Id 6
Backend_Node Node_Id 0 Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 113 Constant_Type Node_Id 113
113 integer type aadl_project.aadl:109:30 113 integer type aadl_project.aadl:109:30
Type_Range Node_Id 0 Type_Range Node_Id 0
...@@ -475,6 +478,7 @@ Declarations List_Id 7 ...@@ -475,6 +478,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Memory_Size" Display_Name Name_Id "Max_Memory_Size"
Scope_Entity Node_Id 6 Scope_Entity Node_Id 6
Backend_Node Node_Id 0 Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 119 Constant_Type Node_Id 119
119 integer type aadl_project.aadl:111:29 119 integer type aadl_project.aadl:111:29
Type_Range Node_Id 0 Type_Range Node_Id 0
...@@ -513,6 +517,7 @@ Declarations List_Id 7 ...@@ -513,6 +517,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Queue_Size" Display_Name Name_Id "Max_Queue_Size"
Scope_Entity Node_Id 6 Scope_Entity Node_Id 6
Backend_Node Node_Id 0 Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 128 Constant_Type Node_Id 128
128 integer type aadl_project.aadl:113:28 128 integer type aadl_project.aadl:113:28
Type_Range Node_Id 0 Type_Range Node_Id 0
...@@ -537,6 +542,7 @@ Declarations List_Id 7 ...@@ -537,6 +542,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Thread_Limit" Display_Name Name_Id "Max_Thread_Limit"
Scope_Entity Node_Id 6 Scope_Entity Node_Id 6
Backend_Node Node_Id 0 Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 134 Constant_Type Node_Id 134
134 integer type aadl_project.aadl:115:30 134 integer type aadl_project.aadl:115:30
Type_Range Node_Id 0 Type_Range Node_Id 0
...@@ -561,6 +567,7 @@ Declarations List_Id 7 ...@@ -561,6 +567,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Time" Display_Name Name_Id "Max_Time"
Scope_Entity Node_Id 6 Scope_Entity Node_Id 6
Backend_Node Node_Id 0 Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 140 Constant_Type Node_Id 140
140 integer type aadl_project.aadl:117:22 140 integer type aadl_project.aadl:117:22
Type_Range Node_Id 0 Type_Range Node_Id 0
...@@ -599,6 +606,7 @@ Declarations List_Id 7 ...@@ -599,6 +606,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Urgency" Display_Name Name_Id "Max_Urgency"
Scope_Entity Node_Id 6 Scope_Entity Node_Id 6
Backend_Node Node_Id 0 Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 149 Constant_Type Node_Id 149
149 integer type aadl_project.aadl:119:25 149 integer type aadl_project.aadl:119:25
Type_Range Node_Id 0 Type_Range Node_Id 0
...@@ -623,6 +631,7 @@ Declarations List_Id 7 ...@@ -623,6 +631,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Word_Count" Display_Name Name_Id "Max_Word_Count"
Scope_Entity Node_Id 6 Scope_Entity Node_Id 6
Backend_Node Node_Id 0 Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 155 Constant_Type Node_Id 155
155 integer type aadl_project.aadl:121:28 155 integer type aadl_project.aadl:121:28
Type_Range Node_Id 0 Type_Range Node_Id 0
...@@ -647,6 +656,7 @@ Declarations List_Id 7 ...@@ -647,6 +656,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Word_Space" Display_Name Name_Id "Max_Word_Space"
Scope_Entity Node_Id 6 Scope_Entity Node_Id 6
Backend_Node Node_Id 0 Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 161 Constant_Type Node_Id 161
161 integer type aadl_project.aadl:123:28 161 integer type aadl_project.aadl:123:28
Type_Range Node_Id 0 Type_Range Node_Id 0
......
...@@ -595,6 +595,7 @@ Declarations List_Id 7 ...@@ -595,6 +595,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Data_Volume" Display_Name Name_Id "Max_Data_Volume"
Scope_Entity Node_Id 6 Scope_Entity Node_Id 6
Backend_Node Node_Id 0 Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 148 Constant_Type Node_Id 148
148 integer type aadl_project.aadl:91:29 148 integer type aadl_project.aadl:91:29
Type_Range Node_Id 0 Type_Range Node_Id 0
...@@ -633,6 +634,7 @@ Declarations List_Id 7 ...@@ -633,6 +634,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Aadlinteger" Display_Name Name_Id "Max_Aadlinteger"
Scope_Entity Node_Id 6 Scope_Entity Node_Id 6
Backend_Node Node_Id 0 Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 157 Constant_Type Node_Id 157
157 integer type aadl_project.aadl:93:29 157 integer type aadl_project.aadl:93:29
Type_Range Node_Id 0 Type_Range Node_Id 0
...@@ -657,6 +659,7 @@ Declarations List_Id 7 ...@@ -657,6 +659,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Target_Integer" Display_Name Name_Id "Max_Target_Integer"
Scope_Entity Node_Id 6 Scope_Entity Node_Id 6
Backend_Node Node_Id 0 Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 163 Constant_Type Node_Id 163
163 integer type aadl_project.aadl:95:32 163 integer type aadl_project.aadl:95:32
Type_Range Node_Id 0 Type_Range Node_Id 0
...@@ -681,6 +684,7 @@ Declarations List_Id 7 ...@@ -681,6 +684,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Base_Address" Display_Name Name_Id "Max_Base_Address"
Scope_Entity Node_Id 6 Scope_Entity Node_Id 6
Backend_Node Node_Id 0 Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 169 Constant_Type Node_Id 169
169 integer type aadl_project.aadl:97:30 169 integer type aadl_project.aadl:97:30
Type_Range Node_Id 0 Type_Range Node_Id 0
...@@ -705,6 +709,7 @@ Declarations List_Id 7 ...@@ -705,6 +709,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Memory_Size" Display_Name Name_Id "Max_Memory_Size"
Scope_Entity Node_Id 6 Scope_Entity Node_Id 6
Backend_Node Node_Id 0 Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 176 Constant_Type Node_Id 176
176 unique property type identifier aadl_project.aadl:99:20 176 unique property type identifier aadl_project.aadl:99:20
Identifier Node_Id 175 Identifier Node_Id 175
...@@ -740,6 +745,7 @@ Declarations List_Id 7 ...@@ -740,6 +745,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Queue_Size" Display_Name Name_Id "Max_Queue_Size"
Scope_Entity Node_Id 6 Scope_Entity Node_Id 6
Backend_Node Node_Id 0 Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 183 Constant_Type Node_Id 183
183 integer type aadl_project.aadl:101:28 183 integer type aadl_project.aadl:101:28
Type_Range Node_Id 0 Type_Range Node_Id 0
...@@ -764,6 +770,7 @@ Declarations List_Id 7 ...@@ -764,6 +770,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Thread_Limit" Display_Name Name_Id "Max_Thread_Limit"
Scope_Entity Node_Id 6 Scope_Entity Node_Id 6
Backend_Node Node_Id 0 Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 189 Constant_Type Node_Id 189
189 integer type aadl_project.aadl:103:30 189 integer type aadl_project.aadl:103:30
Type_Range Node_Id 0 Type_Range Node_Id 0
...@@ -788,6 +795,7 @@ Declarations List_Id 7 ...@@ -788,6 +795,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Time" Display_Name Name_Id "Max_Time"
Scope_Entity Node_Id 6 Scope_Entity Node_Id 6
Backend_Node Node_Id 0 Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 196 Constant_Type Node_Id 196
196 unique property type identifier aadl_project.aadl:105:13 196 unique property type identifier aadl_project.aadl:105:13
Identifier Node_Id 195 Identifier Node_Id 195
...@@ -823,6 +831,7 @@ Declarations List_Id 7 ...@@ -823,6 +831,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Urgency" Display_Name Name_Id "Max_Urgency"
Scope_Entity Node_Id 6 Scope_Entity Node_Id 6
Backend_Node Node_Id 0 Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 203 Constant_Type Node_Id 203
203 integer type aadl_project.aadl:107:25 203 integer type aadl_project.aadl:107:25
Type_Range Node_Id 0 Type_Range Node_Id 0
...@@ -847,6 +856,7 @@ Declarations List_Id 7 ...@@ -847,6 +856,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Byte_Count" Display_Name Name_Id "Max_Byte_Count"
Scope_Entity Node_Id 6 Scope_Entity Node_Id 6
Backend_Node Node_Id 0 Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 209 Constant_Type Node_Id 209
209 integer type aadl_project.aadl:109:28 209 integer type aadl_project.aadl:109:28
Type_Range Node_Id 0 Type_Range Node_Id 0
...@@ -871,6 +881,7 @@ Declarations List_Id 7 ...@@ -871,6 +881,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Word_Space" Display_Name Name_Id "Max_Word_Space"
Scope_Entity Node_Id 6 Scope_Entity Node_Id 6
Backend_Node Node_Id 0 Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 215 Constant_Type Node_Id 215
215 integer type aadl_project.aadl:111:28 215 integer type aadl_project.aadl:111:28
Type_Range Node_Id 0 Type_Range Node_Id 0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment