Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
Ocarina
Commits
cc45b902
Commit
cc45b902
authored
Dec 22, 2014
by
yoogx
Browse files
* Handle (list of)+ in property constants
For github issue #22
parent
d82e1551
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/backends/ocarina-be_aadl-properties.adb
View file @
cc45b902
...
...
@@ -355,8 +355,10 @@ package body Ocarina.BE_AADL.Properties is
Write_Space
;
if
Single_Value
(
Constant_Value
(
Node
))
=
No_Node
then
Print_Tokens
((
T_List
,
T_Of
));
Write_Space
;
for
J
in
1
..
Multiplicity
(
Node
)
loop
Print_Tokens
((
T_List
,
T_Of
));
Write_Space
;
end
loop
;
end
if
;
case
Kind
(
Constant_Type
(
Node
))
is
...
...
@@ -370,6 +372,8 @@ package body Ocarina.BE_AADL.Properties is
Print_Token
(
T_AADLString
);
when
K_Unique_Property_Type_Identifier
=>
Print_Entity_Reference
(
Constant_Type
(
Node
));
when
K_Classifier_Type
=>
Print_Classifier_Type
(
List_Items
(
Constant_Type
(
Node
)));
when
others
=>
Node_Not_Handled
(
Constant_Type
(
Node
));
end
case
;
...
...
src/core/model/ocarina-builder-aadl-properties.adb
View file @
cc45b902
...
...
@@ -186,7 +186,8 @@ package body Ocarina.Builder.AADL.Properties is
Constant_Type
:
Node_Id
;
Unit_Identifier
:
Node_Id
;
Single_Value
:
Node_Id
;
Multiple_Values
:
List_Id
)
return
Node_Id
Multiple_Values
:
List_Id
;
Multiplicity
:
Int
)
return
Node_Id
is
use
Ocarina
.
ME_AADL
.
AADL_Tree
.
Nutils
;
use
Ocarina
.
ME_AADL
.
AADL_Tree
.
Nodes
;
...
...
@@ -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_String_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
:=
New_Node
(
K_Constant_Property_Declaration
,
Loc
);
Value_Node
:
constant
Node_Id
:=
New_Node
(
K_Property_Value
,
Loc
);
Success
:
Boolean
:=
True
;
begin
Set_Single_Value
(
Value_Node
,
Single_Value
);
Set_Multi_Value
(
Value_Node
,
Multiple_Values
);
Set_Constant_Value
(
Node
,
Value_Node
);
Set_Identifier
(
Node
,
Name
);
Set_Corresponding_Entity
(
Name
,
Node
);
Set_Constant_Type
(
Node
,
Constant_Type
);
Set_Unique_Unit_Identifier
(
Node
,
Unit_Identifier
);
Set_Multiplicity
(
Node
,
Multiplicity
);
Set_Value_Container
(
Value_Node
,
Property_Set
);
Set_Single_Value
(
Value_Node
,
Single_Value
);
...
...
src/core/model/ocarina-builder-aadl-properties.ads
View file @
cc45b902
...
...
@@ -51,7 +51,8 @@ package Ocarina.Builder.AADL.Properties is
Constant_Type
:
Node_Id
;
Unit_Identifier
:
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,
-- then we have a single valued constant; or Single_Value =
-- No_Node, then we have a muli valued constant
...
...
src/core/tree/ocarina-me_aadl-aadl_tree-nodes.idl
View file @
cc45b902
...
...
@@ -1136,6 +1136,7 @@ module Ocarina::ME_AADL::AADL_Tree::Nodes {
interface
Multi_Valued_Property
:
Node_Id
{
Node_Id
Property_Type_Designator
;
List_Id
Property_Expressions
;
long
Multiplicity
; // number of "list of" in property type
}
;
//
FIXME
:
Single_Valued_Property
and
multi_valued_property
should
inherit
...
...
@@ -1192,7 +1193,7 @@ module Ocarina::ME_AADL::AADL_Tree::Nodes {
//
AADL_V2
//
multi_valued_property_constant
::
=
//
defining_property_constant_identifier
:
constant
list
of
//
defining_property_constant_identifier
:
constant
(
list
of
)
+
//
property_type_designator
=
>
//
(
[
constant_property_expression
//
{
,
constant_property_expression
}*
]
)
;
...
...
@@ -1201,6 +1202,7 @@ module Ocarina::ME_AADL::AADL_Tree::Nodes {
Node_Id
Constant_Type
;
Node_Id
Unique_Unit_Identifier
;
Node_Id
Constant_Value
; // is of kind property_value
long
Multiplicity
; // number of "list of" in property type
}
;
interface
Property_Value
:
Node_Id
{
...
...
src/frontends/aadl/ocarina-fe_aadl-parser-properties-values.adb
View file @
cc45b902
...
...
@@ -1114,7 +1114,7 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is
-- => constant_property_value ;
-- multi_valued_property_constant ::=
-- defining_property_constant_identifier : constant list of
-- defining_property_constant_identifier : constant
(
list of
)+
-- ( ( aadlinteger
-- | aadlreal ) [ units_unique_property_type_identifier ]
-- | aadlstring | aadlboolean
...
...
@@ -1159,6 +1159,7 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is
Property_Values
:
List_Id
:=
No_List
;
-- only for multi_valued_property
Code
:
Parsing_Code
;
Loc
:
Location
;
Multiplicity
:
Int
:=
0
;
begin
Save_Lexer
(
Loc
);
...
...
@@ -1166,7 +1167,7 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is
if
Token
=
T_List
then
Code
:=
PC_Multi_Valued_Property_Constant
;
Multiplicity
:=
1
;
Scan_Token
;
if
Token
/=
T_Of
then
DPE
(
Code
,
T_Of
);
...
...
@@ -1178,6 +1179,28 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is
Code
:=
PC_Single_Valued_Property_Constant
;
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
when
AADL_V1
=>
Save_Lexer
(
Loc
);
...
...
@@ -1378,7 +1401,8 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is
Single_Value
=>
Property_Value
,
Multiple_Values
=>
Property_Values
,
Unit_Identifier
=>
Unit_Ident
,
Constant_Type
=>
Constant_Type
);
Constant_Type
=>
Constant_Type
,
Multiplicity
=>
Multiplicity
);
return
Property
;
end
P_Property_Constant
;
...
...
tests/test_tree_p/test.aadl.out
View file @
cc45b902
...
...
@@ -17,6 +17,7 @@ Declarations List_Id 7
Display_Name Name_Id "Default_Active_Thread_Handling_Protocol"
Scope_Entity Node_Id 6
Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 10
10 unique property type identifier aadl_project.aadl:11:45
Identifier Node_Id 9
...
...
@@ -427,6 +428,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Aadlinteger"
Scope_Entity Node_Id 6
Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 107
107 integer type aadl_project.aadl:107:29
Type_Range Node_Id 0
...
...
@@ -451,6 +453,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Base_Address"
Scope_Entity Node_Id 6
Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 113
113 integer type aadl_project.aadl:109:30
Type_Range Node_Id 0
...
...
@@ -475,6 +478,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Memory_Size"
Scope_Entity Node_Id 6
Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 119
119 integer type aadl_project.aadl:111:29
Type_Range Node_Id 0
...
...
@@ -513,6 +517,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Queue_Size"
Scope_Entity Node_Id 6
Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 128
128 integer type aadl_project.aadl:113:28
Type_Range Node_Id 0
...
...
@@ -537,6 +542,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Thread_Limit"
Scope_Entity Node_Id 6
Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 134
134 integer type aadl_project.aadl:115:30
Type_Range Node_Id 0
...
...
@@ -561,6 +567,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Time"
Scope_Entity Node_Id 6
Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 140
140 integer type aadl_project.aadl:117:22
Type_Range Node_Id 0
...
...
@@ -599,6 +606,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Urgency"
Scope_Entity Node_Id 6
Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 149
149 integer type aadl_project.aadl:119:25
Type_Range Node_Id 0
...
...
@@ -623,6 +631,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Word_Count"
Scope_Entity Node_Id 6
Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 155
155 integer type aadl_project.aadl:121:28
Type_Range Node_Id 0
...
...
@@ -647,6 +656,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Word_Space"
Scope_Entity Node_Id 6
Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 161
161 integer type aadl_project.aadl:123:28
Type_Range Node_Id 0
...
...
tests/test_tree_p2/test.aadl.out
View file @
cc45b902
...
...
@@ -595,6 +595,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Data_Volume"
Scope_Entity Node_Id 6
Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 148
148 integer type aadl_project.aadl:91:29
Type_Range Node_Id 0
...
...
@@ -633,6 +634,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Aadlinteger"
Scope_Entity Node_Id 6
Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 157
157 integer type aadl_project.aadl:93:29
Type_Range Node_Id 0
...
...
@@ -657,6 +659,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Target_Integer"
Scope_Entity Node_Id 6
Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 163
163 integer type aadl_project.aadl:95:32
Type_Range Node_Id 0
...
...
@@ -681,6 +684,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Base_Address"
Scope_Entity Node_Id 6
Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 169
169 integer type aadl_project.aadl:97:30
Type_Range Node_Id 0
...
...
@@ -705,6 +709,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Memory_Size"
Scope_Entity Node_Id 6
Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 176
176 unique property type identifier aadl_project.aadl:99:20
Identifier Node_Id 175
...
...
@@ -740,6 +745,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Queue_Size"
Scope_Entity Node_Id 6
Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 183
183 integer type aadl_project.aadl:101:28
Type_Range Node_Id 0
...
...
@@ -764,6 +770,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Thread_Limit"
Scope_Entity Node_Id 6
Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 189
189 integer type aadl_project.aadl:103:30
Type_Range Node_Id 0
...
...
@@ -788,6 +795,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Time"
Scope_Entity Node_Id 6
Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 196
196 unique property type identifier aadl_project.aadl:105:13
Identifier Node_Id 195
...
...
@@ -823,6 +831,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Urgency"
Scope_Entity Node_Id 6
Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 203
203 integer type aadl_project.aadl:107:25
Type_Range Node_Id 0
...
...
@@ -847,6 +856,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Byte_Count"
Scope_Entity Node_Id 6
Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 209
209 integer type aadl_project.aadl:109:28
Type_Range Node_Id 0
...
...
@@ -871,6 +881,7 @@ Declarations List_Id 7
Display_Name Name_Id "Max_Word_Space"
Scope_Entity Node_Id 6
Backend_Node Node_Id 0
Multiplicity Int 0
Constant_Type Node_Id 215
215 integer type aadl_project.aadl:111:28
Type_Range Node_Id 0
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment