Commit e96a1411 authored by hugues.jerome's avatar hugues.jerome

* Support parsing of record properties

	* Update reference output for testsuite



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/ocarina@2104 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent e23f9ce7
...@@ -14,7 +14,7 @@ requirement : mutexes ...@@ -14,7 +14,7 @@ requirement : mutexes
theorem mutexes is: TRUE theorem mutexes is: TRUE
requirement : latency requirement : latency
requirement : buses_rate requirement : buses_rate
lib.real:12:33 Backends: warning : property "assert_properties::access_bandwidth" is not defined on element Bus_Set lib.real:12:33 Backends: warning : property "assert_properties::access_bandwidth" is not defined on element 607 (shared.impl_a_bus) all.aadl:104:01Bus_Set
lib.real:12:72 Backends: error : Property is false for instance 607 (shared.impl_a_bus) lib.real:12:72 Backends: error : Property is false for instance 607 (shared.impl_a_bus)
theorem buses_rate is: FALSE theorem buses_rate is: FALSE
lib.real:85:01 Backends: fatal error : requirements are not fulfilled lib.real:85:01 Backends: fatal error : requirements are not fulfilled
...@@ -307,7 +307,7 @@ package body Ocarina.BE_AADL.Properties.Values is ...@@ -307,7 +307,7 @@ package body Ocarina.BE_AADL.Properties.Values is
----------------------- -----------------------
procedure Print_Record_Term (Node : Node_Id) is procedure Print_Record_Term (Node : Node_Id) is
pragma Assert (Kind (Node) = K_Record_Term_Element); pragma Assert (Kind (Node) = K_Record_Term);
List_Node : Node_Id; List_Node : Node_Id;
begin begin
...@@ -318,16 +318,11 @@ package body Ocarina.BE_AADL.Properties.Values is ...@@ -318,16 +318,11 @@ package body Ocarina.BE_AADL.Properties.Values is
(Ocarina.ME_AADL.AADL_Tree.Nodes.List_Items (Node)); (Ocarina.ME_AADL.AADL_Tree.Nodes.List_Items (Node));
while Present (List_Node) loop while Present (List_Node) loop
if List_Node /=
First_Node (Ocarina.ME_AADL.AADL_Tree.Nodes.List_Items (Node)) then
Print_Token (T_Comma);
Write_Space;
end if;
case Kind (List_Node) is case Kind (List_Node) is
when K_Record_Term_Element => when K_Record_Term_Element =>
Print_Record_Term_Element (List_Node); Print_Record_Term_Element (List_Node);
Print_Token (T_Semicolon);
Write_Space;
when others => when others =>
Node_Not_Handled (Node); Node_Not_Handled (Node);
end case; end case;
......
...@@ -2145,7 +2145,7 @@ package body Ocarina.Analyzer.AADL.Semantics is ...@@ -2145,7 +2145,7 @@ package body Ocarina.Analyzer.AADL.Semantics is
DAE DAE
(Message0 => "Units Type ", (Message0 => "Units Type ",
Node1 => Units_Type, Node1 => Units_Type,
Message1 => " contains cycles is not correctly defined"); Message1 => " is ill-defined: it contains cycles");
exit; exit;
end if; end if;
......
...@@ -138,6 +138,9 @@ package body Ocarina.Analyzer.Messages is ...@@ -138,6 +138,9 @@ package body Ocarina.Analyzer.Messages is
elsif Kind (Node2) = K_Entity_Reference then elsif Kind (Node2) = K_Entity_Reference then
Write_Name (Get_Name_Of_Entity_Reference Write_Name (Get_Name_Of_Entity_Reference
(Node2, Get_Display_Name => True)); (Node2, Get_Display_Name => True));
elsif Kind (Node2) = K_Identifier then
Write_Name (Name (Node2));
end if; end if;
Write_Str (" (" & Image (Kind (Node2)) & ") "); Write_Str (" (" & Image (Kind (Node2)) & ") ");
......
...@@ -563,12 +563,13 @@ package body Ocarina.Processor.Properties is ...@@ -563,12 +563,13 @@ package body Ocarina.Processor.Properties is
or else Kind (Property_Value) = K_Parenthesis_Boolean_Term or else Kind (Property_Value) = K_Parenthesis_Boolean_Term
or else Kind (Property_Value) = K_Component_Classifier_Term or else Kind (Property_Value) = K_Component_Classifier_Term
or else Kind (Property_Value) = K_Unique_Property_Const_Identifier or else Kind (Property_Value) = K_Unique_Property_Const_Identifier
or else Kind (Property_Value) = K_Record_Term
or else Ocarina.ME_AADL.Aadl_Tree.Entities.DNKE (Property_Value)); or else Ocarina.ME_AADL.Aadl_Tree.Entities.DNKE (Property_Value));
pragma Assert (Reference_Property /= No_Node); pragma Assert (Reference_Property /= No_Node);
Evaluated_Value : Node_Id; Evaluated_Value : Node_Id := No_Node;
Ref_Term : Node_Id; Ref_Term : Node_Id := No_Node;
begin begin
if Property_Value = No_Node then if Property_Value = No_Node then
Evaluated_Value := No_Node; Evaluated_Value := No_Node;
...@@ -1028,6 +1029,9 @@ package body Ocarina.Processor.Properties is ...@@ -1028,6 +1029,9 @@ package body Ocarina.Processor.Properties is
Set_Component_Cat (Evaluated_Value, Set_Component_Cat (Evaluated_Value,
Component_Cat (Property_Value)); Component_Cat (Property_Value));
when K_Record_Term =>
null; -- XXX
when others => when others =>
raise Program_Error; raise Program_Error;
end case; end case;
......
...@@ -1741,7 +1741,6 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is ...@@ -1741,7 +1741,6 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is
Save_Lexer (Start_Loc); Save_Lexer (Start_Loc);
Scan_Token; Scan_Token;
if Token /= T_Right_Parenthesis then if Token /= T_Right_Parenthesis then
Record_List := P_Items_List (P_Record_Type_Element'Access, Record_List := P_Items_List (P_Record_Type_Element'Access,
No_Node, No_Node,
T_Semicolon, T_Semicolon,
...@@ -2407,7 +2406,6 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is ...@@ -2407,7 +2406,6 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is
DPE (PC_Boolean_Or_Record_Term); DPE (PC_Boolean_Or_Record_Term);
return No_Node; return No_Node;
end case; end case;
end P_Boolean_Or_Record_Term; end P_Boolean_Or_Record_Term;
---------------------- ----------------------
...@@ -2548,8 +2546,15 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is ...@@ -2548,8 +2546,15 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is
return No_Node; return No_Node;
end if; end if;
Items := P_Items_List (P_Record_Term_Element'Access, No_Node, Save_Lexer (Start_Loc);
T_Semicolon, T_Right_Parenthesis, PC_Record_Term); Scan_Token;
Items := P_Items_List (P_Record_Term_Element'Access,
No_Node,
T_Semicolon,
T_Right_Parenthesis,
PC_Record_Term,
True);
if No (Items) then if No (Items) then
Skip_Tokens (T_Semicolon); Skip_Tokens (T_Semicolon);
return No_Node; return No_Node;
...@@ -2559,12 +2564,11 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is ...@@ -2559,12 +2564,11 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is
Item := First_Node (Items); Item := First_Node (Items);
while Present (Item) loop while Present (Item) loop
Set_Corresponding_Entity (Item, Record_Term); -- Set_Corresponding_Entity (Item, Record_Term);
Item := Next_Node (Item); Item := Next_Node (Item);
end loop; end loop;
return Record_Term; return Record_Term;
end P_Record_Term; end P_Record_Term;
--------------------------- ---------------------------
...@@ -2576,7 +2580,8 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is ...@@ -2576,7 +2580,8 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is
function P_Record_Term_Element function P_Record_Term_Element
(Container : Node_Id) (Container : Node_Id)
return Node_Id is return Node_Id
is
use Ocarina.ME_AADL.AADL_Tree.Nodes; use Ocarina.ME_AADL.AADL_Tree.Nodes;
use Ocarina.ME_AADL.AADL_Tree.Nutils; use Ocarina.ME_AADL.AADL_Tree.Nutils;
use Lexer; use Lexer;
...@@ -2592,10 +2597,10 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is ...@@ -2592,10 +2597,10 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is
begin begin
Save_Lexer (Loc); Save_Lexer (Loc);
Scan_Token;
if Token /= T_Identifier then if Token /= T_Identifier then
DPE (PC_Record_Term_Element, T_Identifier); DPE (PC_Record_Term_Element, T_Identifier);
Restore_Lexer (Loc);
return No_Node; return No_Node;
end if; end if;
...@@ -2603,12 +2608,13 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is ...@@ -2603,12 +2608,13 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is
Identifier := Make_Current_Identifier (Record_Term_Element); Identifier := Make_Current_Identifier (Record_Term_Element);
Set_Identifier (Record_Term_Element, Identifier); Set_Identifier (Record_Term_Element, Identifier);
Save_Lexer (Loc);
Scan_Token; Scan_Token;
if Token = T_Association then if Token = T_Association then
Property_Expression := P_Property_Expression (No_Node); Property_Expression := P_Property_Expression (No_Node);
if No (Property_Expression) then if No (Property_Expression) then
-- error when parsing Property_Expression, quit
return No_Node; return No_Node;
end if; end if;
else else
...@@ -2617,8 +2623,7 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is ...@@ -2617,8 +2623,7 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is
return No_Node; return No_Node;
end if; end if;
Set_Property_Expression (Property_Expression, Record_Term_Element); Set_Property_Expression (Record_Term_Element, Property_Expression);
return Record_Term_Element; return Record_Term_Element;
end P_Record_Term_Element; end P_Record_Term_Element;
......
...@@ -208,6 +208,8 @@ package body Ocarina.FE_AADL.Parser.Properties is ...@@ -208,6 +208,8 @@ package body Ocarina.FE_AADL.Parser.Properties is
Loc : Location; Loc : Location;
Property_Loc : Location; Property_Loc : Location;
Item : Node_Id; Item : Node_Id;
Parse_List_Of_Properties : Boolean := True;
begin begin
Save_Lexer (Loc); Save_Lexer (Loc);
Scan_Token; Scan_Token;
...@@ -302,7 +304,30 @@ package body Ocarina.FE_AADL.Parser.Properties is ...@@ -302,7 +304,30 @@ package body Ocarina.FE_AADL.Parser.Properties is
Save_Lexer (Loc); Save_Lexer (Loc);
Scan_Token; Scan_Token;
if Token = T_Left_Parenthesis then -- The AADLv2 BNF is ambiguous, a string starting with a '('
-- can either be a list of property expressions e.g. "(foo,
-- bard);"_or_ a single_expression containing a record term,
-- e.g. "(foo => 1; bar =>2;)". This look ahead loop scans
-- token to see which case we are currently processing.
declare
Loc2 : Location;
begin
Save_Lexer (Loc2);
if Token = T_Left_Parenthesis then
while Token /= T_Right_Parenthesis loop
Scan_Token;
if Token = T_Semicolon then
Parse_List_Of_Properties := False;
end if;
end loop;
else
Parse_List_Of_Properties := False;
end if;
Restore_Lexer (Loc2);
end;
if Parse_List_Of_Properties then
Save_Lexer (Loc); Save_Lexer (Loc);
Scan_Token; Scan_Token;
......
example_023.aadl:22:26: parsing Record_Term_Element, token '=>' is expected, found token ',' example_023.aadl:22:27: parsing Record_Term_Element, token '=>' is expected, found token ','
example_023.aadl:20:01: parsing Connections, list is empty example_023.aadl:20:01: parsing Connections, list is empty
Cannot parse AADL specifications Cannot parse AADL specifications
\ No newline at end of file
...@@ -34,3 +34,4 @@ test_env_subtheorem_call_with_empty_domain execution ...@@ -34,3 +34,4 @@ test_env_subtheorem_call_with_empty_domain execution
lib.real:38:01 Backends: warning : Empty range set, returned value is 0.0 lib.real:38:01 Backends: warning : Empty range set, returned value is 0.0
value for x after evaluating sub_theorem_6 is 0.00000E+00 value for x after evaluating sub_theorem_6 is 0.00000E+00
theorem test_env_subtheorem_call_with_empty_domain is: TRUE theorem test_env_subtheorem_call_with_empty_domain is: TRUE
...@@ -56,3 +56,4 @@ theorem test_head_and_queue is: TRUE ...@@ -56,3 +56,4 @@ theorem test_head_and_queue is: TRUE
test_reference_property execution test_reference_property execution
theorem test_reference_property is: TRUE theorem test_reference_property is: TRUE
...@@ -44,6 +44,22 @@ property set Deployment is ...@@ -44,6 +44,22 @@ property set Deployment is
Configuration : aadlstring Configuration : aadlstring
applies to (device); applies to (device);
Config : aadlstring
applies to (device);
ASN1_Module_Name : aadlstring
applies to ( all);
Help : aadlstring
applies to ( all);
Version : aadlstring
applies to ( all);
Configuration_Type : classifier (
data)
applies to ( all);
end Deployment; end Deployment;
package RMAAadl package RMAAadl
......
...@@ -44,6 +44,22 @@ property set Deployment is ...@@ -44,6 +44,22 @@ property set Deployment is
Configuration : aadlstring Configuration : aadlstring
applies to (device); applies to (device);
Config : aadlstring
applies to (device);
ASN1_Module_Name : aadlstring
applies to ( all);
Help : aadlstring
applies to ( all);
Version : aadlstring
applies to ( all);
Configuration_Type : classifier (
data)
applies to ( all);
end Deployment; end Deployment;
package RMAAadl package RMAAadl
......
...@@ -44,6 +44,22 @@ property set Deployment is ...@@ -44,6 +44,22 @@ property set Deployment is
Configuration : aadlstring Configuration : aadlstring
applies to (device); applies to (device);
Config : aadlstring
applies to (device);
ASN1_Module_Name : aadlstring
applies to ( all);
Help : aadlstring
applies to ( all);
Version : aadlstring
applies to ( all);
Configuration_Type : classifier (
data)
applies to ( all);
end Deployment; end Deployment;
package RMAAadl package RMAAadl
......
...@@ -44,6 +44,22 @@ property set Deployment is ...@@ -44,6 +44,22 @@ property set Deployment is
Configuration : aadlstring Configuration : aadlstring
applies to (device); applies to (device);
Config : aadlstring
applies to (device);
ASN1_Module_Name : aadlstring
applies to ( all);
Help : aadlstring
applies to ( all);
Version : aadlstring
applies to ( all);
Configuration_Type : classifier (
data)
applies to ( all);
end Deployment; end Deployment;
package RMAAadl package RMAAadl
......
...@@ -44,6 +44,22 @@ property set Deployment is ...@@ -44,6 +44,22 @@ property set Deployment is
Configuration : aadlstring Configuration : aadlstring
applies to (device); applies to (device);
Config : aadlstring
applies to (device);
ASN1_Module_Name : aadlstring
applies to ( all);
Help : aadlstring
applies to ( all);
Version : aadlstring
applies to ( all);
Configuration_Type : classifier (
data)
applies to ( all);
end Deployment; end Deployment;
package RMAAadl package RMAAadl
......
...@@ -50,6 +50,7 @@ Usage: ...@@ -50,6 +50,7 @@ Usage:
carts carts
asn1_deployment asn1_deployment
cheddar cheddar
connection_matrix
aadl aadl
aadl_min aadl_min
aadl_annex aadl_annex
......
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