Commit 085a2ce2 authored by yoogx's avatar yoogx
Browse files

* First pass at support property constant for array dimension

        For openaadl/ocarina#174
parent 23cc28c6
......@@ -59,7 +59,14 @@ package body Ocarina.BE_AADL.Components.Arrays is
Print_Token (T_Left_Square_Bracket);
if Present (Size (List_Node)) then
Print_Signed_AADLNumber (Size (List_Node));
case Kind (Size (List_Node)) is
when K_Signed_AADLNumber =>
Print_Signed_AADLNumber (Size (List_Node));
when K_Unique_Property_Const_Identifier =>
Print_Unique_Property_Constant_Identifier (Size (List_Node));
when others =>
raise Constraint_Error;
end case;
end if;
Print_Token (T_Right_Square_Bracket);
......
......@@ -68,7 +68,6 @@ package body Ocarina.BE_AADL.Properties.Values is
procedure Print_Record_Type_Element (Node : Node_Id);
procedure Print_Reference_Term (Node : Node_Id);
procedure Print_Minus_Numeric_Term (Node : Node_Id);
procedure Print_Unique_Property_Constant_Identifier (Node : Node_Id);
procedure Print_Unit_Definition (Node : Node_Id);
procedure Print_Component_Classifier_Term (Node : Node_Id);
procedure Print_Named_Element_Identifier (N : Named_Element);
......
......@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2015 ESA & ISAE. --
-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2018 ESA & ISAE. --
-- --
-- Ocarina is free software; you can redistribute it and/or modify under --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -31,6 +31,8 @@
package Ocarina.BE_AADL.Properties.Values is
procedure Print_Unique_Property_Constant_Identifier (Node : Node_Id);
procedure Print_Or_Boolean_Term (Node : Node_Id);
procedure Print_Computed_Term (Node : Node_Id);
......
......@@ -93,7 +93,6 @@ package body Ocarina.FE_AADL.Parser.Components.Arrays is
Set_Array_List_Dim (Node_Array, List_Array_Dim);
return Node_Array;
end P_Array_Dimensions;
----------------------------
......@@ -103,6 +102,7 @@ package body Ocarina.FE_AADL.Parser.Components.Arrays is
-- AADL_V2
-- array_dimensions ::= { [ [ array_dimension_size ] ] }*
-- array_dimension_size ::= numeral | unique_property_constant_identifier
-- | unique_property_identifier
function P_Array_Dimension_Size
(Container : Types.Node_Id) return Node_Id
......@@ -110,7 +110,6 @@ package body Ocarina.FE_AADL.Parser.Components.Arrays is
use Locations;
use Ocarina.ME_AADL.Tokens;
use Lexer;
use Parser.Identifiers;
use Parser.Properties.Values;
use Builder.AADL.Components.Arrays;
......@@ -125,7 +124,9 @@ package body Ocarina.FE_AADL.Parser.Components.Arrays is
case Token is
when T_Identifier =>
Restore_Lexer (Loc);
Size := P_Identifier (Container);
-- Size := P_Entity_Reference (Container);
Size := P_Unique_Property_Identifier_Or_Term
(PC_Unique_Property_Constant_Identifier);
when T_Integer_Literal =>
Restore_Lexer (Loc);
......@@ -152,7 +153,6 @@ package body Ocarina.FE_AADL.Parser.Components.Arrays is
end if;
return Node;
end P_Array_Dimension_Size;
-----------------------
......
......@@ -129,10 +129,6 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is
function P_Reference_Type return Node_Id;
-- Current token must be 'reference'
function P_Unique_Property_Identifier_Or_Term
(Code : Parsing_Code) return Node_Id;
-- Current token must be 'value'
function P_Unit_Definition (Container : Node_Id) return Node_Id;
function P_Units_Type return Node_Id;
......
......@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2015 ESA & ISAE. --
-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2018 ESA & ISAE. --
-- --
-- Ocarina is free software; you can redistribute it and/or modify under --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -44,6 +44,10 @@ package Ocarina.FE_AADL.Parser.Properties.Values is
Property_Set : Node_Id) return Node_Id;
-- Current token must be 'constant'
function P_Unique_Property_Identifier_Or_Term
(Code : Parsing_Code) return Node_Id;
-- Current token must be 'value'
function P_Property_Expression (Container : Node_Id) return Node_Id;
function P_Property_Type_Declaration
......
Supports Markdown
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