Commit f03b0eab authored by Bechir Zalila's avatar Bechir Zalila
Browse files

* (*parser.ad?, ocarina-fe_aadl-parser-annexes.adb): Added a Container

	parameter to the parse function. This is useful when parsing
	some annexes and needing to access the component node that contains
	the annex.
parent e71f49e9
......@@ -56,12 +56,13 @@ package body Ocarina.Parser is
(Language : Name_Id;
AADL_Root : Node_Id;
From : Location;
To : Location := No_Location) return Node_Id
To : Location := No_Location;
Container : Node_Id := No_Node) return Node_Id
is
begin
for P in Parsers.First .. Parsers.Last loop
if Language = Parsers.Table (P).Language then
return Parsers.Table (P).Parser (AADL_Root, From, To);
return Parsers.Table (P).Parser (AADL_Root, From, To, Container);
end if;
end loop;
......
......@@ -37,13 +37,15 @@ package Ocarina.Parser is
type Parser_Subprogram is access function
(AADL_Root : Node_Id;
From : Location;
To : Location := No_Location) return Node_Id;
To : Location := No_Location;
Container : Node_Id := No_Node) return Node_Id;
function Parse
(Language : Name_Id;
AADL_Root : Node_Id;
From : Location;
To : Location := No_Location) return Node_Id;
To : Location := No_Location;
Container : Node_Id := No_Node) return Node_Id;
-- Parse the file File_Name and return the Node_Id or the root of
-- the resulting AADL tree, or No_Node if the parsing failed. If
-- AADL_Root is not No_Node, then add the parsed entities to
......
......@@ -92,7 +92,12 @@ package body Ocarina.FE_AADL.Parser.Annexes is
elsif Token = T_Begin_Annex then
Save_Lexer (Loc_Start_Annex);
if Perform_Annex_Action (Name (Identifier)) then
Annex_Root := Parse (Name (Identifier), No_Node, Loc_Start_Annex);
Annex_Root := Parse
(Name (Identifier),
No_Node,
Loc_Start_Annex,
No_Location,
Namespace);
end if;
-- Do not display error message if No_Node because if there are
......
......@@ -409,12 +409,15 @@ package body Ocarina.FE_AADL.Parser is
function Process
(AADL_Root : Node_Id;
From : Location;
To : Location := No_Location) return Node_Id
To : Location := No_Location;
Container : Node_Id := No_Node) return Node_Id
is
New_Root : Node_Id := AADL_Root;
File_Name : Name_Id;
Buffer : Location;
pragma Unreferenced (Container);
begin
if First_Parsing then
First_Parsing := False;
......
......@@ -48,7 +48,8 @@ package Ocarina.FE_AADL.Parser is
function Process
(AADL_Root : Node_Id;
From : Locations.Location;
To : Locations.Location := Locations.No_Location) return Node_Id;
To : Locations.Location := Locations.No_Location;
Container : Node_Id := No_Node) return Node_Id;
-- Parse the file described by buffer locations and return the
-- Node_Id or the root of the resulting AADL tree, or No_Node if
-- the parsing failed. If AADL_Root is not No_Node, then return
......
......@@ -252,9 +252,12 @@ package body Ocarina.FE_AADL_BA.Parser is
function Process
(AADL_Root : Node_Id;
From : Location;
To : Location := No_Location) return Node_Id
To : Location := No_Location;
Container : Node_Id := No_Node) return Node_Id
is
Buffer : Location;
pragma Unreferenced (Container);
begin
Buffer := From;
......
......@@ -46,7 +46,8 @@ package Ocarina.FE_AADL_BA.Parser is
function Process
(AADL_Root : Node_Id;
From : Locations.Location;
To : Locations.Location := Locations.No_Location) return Node_Id;
To : Locations.Location := Locations.No_Location;
Container : Node_Id := No_Node) return Node_Id;
procedure Init;
-- Initialize the parser and register it to the general Ocarina
......
......@@ -1856,9 +1856,11 @@ package body Ocarina.FE_REAL.Parser is
function Process
(AADL_Root : Node_Id;
From : Location;
To : Location := No_Location) return Node_Id
To : Location := No_Location;
Container : Node_Id := No_Node) return Node_Id
is
pragma Unreferenced (AADL_Root);
pragma Unreferenced (Container);
Buffer : Location;
Root : constant Node_Id := New_Node (K_Root_Node, From);
......
......@@ -42,7 +42,8 @@ package Ocarina.FE_REAL.Parser is
function Process
(AADL_Root : Node_Id;
From : Location;
To : Location := No_Location) return Node_Id;
To : Location := No_Location;
Container : Node_Id := No_Node) return Node_Id;
-- Proceed to parsing
procedure Init;
......
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