Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
kazoo
Commits
c16c79e3
Commit
c16c79e3
authored
Jan 27, 2018
by
Maxime Perrotin
Browse files
Parse data view
parent
53a8b63f
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/taste-aadl_parser.adb
View file @
c16c79e3
...
...
@@ -218,7 +218,7 @@ package body TASTE.AADL_Parser is
Mode
=>
Out_File
,
Name
=>
Output_Path
&
"/commandline.dump"
);
Put_Info
(
"Dump of the Command Line"
);
Model
.
Configuration
.
Debug_Dump
;
Model
.
Configuration
.
Debug_Dump
(
Output
)
;
Close
(
Output
);
end
if
;
exception
...
...
src/taste-data_view.adb
View file @
c16c79e3
...
...
@@ -37,29 +37,12 @@ package body TASTE.Data_View is
function
Parse_Data_View
(
Dataview_Root
:
Node_Id
)
return
Taste_Data_View
is
DV_Root
:
Node_Id
:=
Dataview_Root
;
use
type
ASN1_Maps
.
Map
;
use
ASN1_File_Maps
;
System
:
Node_Id
;
Files
:
ASN1_Maps
.
Map
;
Files
:
ASN1_
File_
Maps
.
Map
;
Current_Type
:
Node_Id
;
-- function Parse_Type (Data_Type : Node_Id) return ASN1_File is
-- Asntype : constant Node_Id := Corresponding_Instance (Data_Type);
-- Name : constant String := Get_Name_String
-- (Get_Type_Source_Name (Asntype));
-- begin
-- Put_Line ("Data type : " & AIN_Case (Data_Type));
-- Put_Line (" |_" & Name);
-- Put_Line (" |_ Module : " & Get_Name_String
-- (Get_String_Property (Asntype,
-- Get_String_Name ("taste::ada_package_name"))));
-- Put_Line (" |_ File : " & Get_Name_String
-- (Get_Source_Text (Asntype)(1)));
-- return ASN1_File'(Path => US (Name),
-- Modules => String_Vectors.Empty_Vector); -- TODO
-- end Parse_Type;
F
:
Name_Id
;
Loc
:
Location
;
F
:
Name_Id
;
Loc
:
Location
;
begin
Ocarina
.
FE_AADL
.
Parser
.
Add_Pre_Prop_Sets
:=
True
;
...
...
@@ -69,7 +52,7 @@ package body TASTE.Data_View is
F
:=
Ocarina
.
Files
.
Search_File
(
Name_Find
);
Loc
:=
Ocarina
.
Files
.
Load_File
(
F
);
DV_Root
:=
Ocarina
.
Parser
.
Parse
(
Get_String_Name
(
"aadl"
),
DV_Root
,
Loc
);
DV_Root
,
Loc
);
end
loop
;
if
not
Ocarina
.
Analyzer
.
Analyze
(
AADL_Language
,
DV_Root
)
then
...
...
@@ -91,54 +74,60 @@ package body TASTE.Data_View is
raise
Data_View_Error
with
"Component is not a data type!"
;
end
if
;
declare
Asntype
:
constant
Node_Id
:=
Corresponding_Instance
(
Data_Type
);
Asntype
:
constant
Node_Id
:=
Corresponding_Instance
(
Current_Type
);
Sort
:
constant
String
:=
Get_Name_String
(
Get_Type_Source_Name
(
Asntype
));
Module
:
constant
String
:=
Get_Name_String
(
Get_String_Property
(
Asntype
,
Get_String_Name
(
"taste::ada_package_name"
)));
(
Get_String_Property
(
Asntype
,
Get_String_Name
(
"taste::ada_package_name"
)));
Filename
:
constant
String
:=
Get_Name_String
(
Get_Source_Text
(
Asntype
(
1
))
)
;
--
Type_
File : constant ASN1_File
:= Parse_Type (Current_Typ
e);
(
Get_Source_Text
(
Asntype
)
(
1
));
File
_Ref
:
constant
ASN1_File
_Maps
.
Cursor
:=
Files
.
Find
(
Filenam
e
);
begin
if
Files
.
Contains
(
Key
=>
Filename
)
then
declare
Current_File
:
ASN1_File
:=
Files
.
Element
(
Filename
);
begin
if
Current_File
.
Modules
.
Contains
(
Module
)
then
Current_File
.
Modules
.
Element
(
Module
).
Append
(
Sort
);
else
declare
Types
:
String_Vectors
.
Vector
;
begin
Types
.
Append
(
Sort
);
Current_File
.
Modules
.
Insert
(
Key
=>
Module
,
New_Item
=>
Types
);
end
;
end
if
;
end
;
if
File_Ref
=
ASN1_File_Maps
.
No_Element
then
declare
New_File
:
ASN1_File
;
New_Module
:
ASN1_Module
;
begin
New_Module
.
Name
:=
US
(
Module
);
New_Module
.
Types
:=
(
Empty_Vector
&
Sort
);
New_File
.
Path
:=
US
(
Filename
);
New_File
.
Modules
.
Insert
(
Module
,
New_Module
);
Files
.
Insert
(
Filename
,
New_File
);
end
;
else
declare
New_File
:
ASN1_File
;
begin
New_File
.
Path
:=
Filename
;
-- etc
Files
.
Insert
(
Key
=>
To_String
(
Type_File
.
Path
),
New_Item
=>
Type_File
);
Current_Type
:=
AIN
.
Next_Node
(
Current_Type
);
declare
Curr_File
:
ASN1_File
:=
Files
.
Element
(
Filename
);
Curr_Module
:
ASN1_Module
;
begin
if
Curr_File
.
Modules
.
Contains
(
Module
)
then
Curr_Module
:=
Curr_File
.
Modules
.
Element
(
Module
);
Curr_Module
.
Types
.
Append
(
Sort
);
Curr_File
.
Modules
.
Replace
(
Module
,
Curr_Module
);
else
Curr_Module
.
Name
:=
US
(
Module
);
Curr_Module
.
Types
:=
(
Empty_Vector
&
Sort
);
Curr_File
.
Modules
.
Insert
(
Module
,
Curr_Module
);
end
if
;
Files
.
Replace
(
Filename
,
Curr_File
);
end
;
end
if
;
end
;
Current_Type
:=
AIN
.
Next_Node
(
Current_Type
);
end
loop
;
return
Data_AST
:
constant
Taste_Data_View
:=
(
ASN1_Files
=>
Files
);
end
Parse_Data_View
;
procedure
Debug_Dump
(
DV
:
Taste_Data_View
;
Output
:
File_Type
)
is
begin
for
Each
of
DV
.
ASN1_Files
loop
Put_Line
(
Output
,
To_String
(
Each
.
Path
));
Put_Line
(
Output
,
"ASN.1 File : "
&
To_String
(
Each
.
Path
));
for
Module
of
Each
.
Modules
loop
Put_Line
(
Output
,
" |_Module : "
&
Module
);
Put_Line
(
Output
,
" |_Module : "
&
To_String
(
Module
.
Name
));
for
Sort
of
Module
.
Types
loop
Put_Line
(
Output
,
" |_Type : "
&
Sort
);
end
loop
;
end
loop
;
end
loop
;
end
Debug_Dump
;
...
...
src/taste-data_view.ads
View file @
c16c79e3
...
...
@@ -36,8 +36,14 @@ package TASTE.Data_View is
"data_model.aadl"
&
"deployment.aadl"
;
type
ASN1_Module
is
record
Name
:
Unbounded_String
;
Types
:
String_Vectors
.
Vector
;
end
record
;
package
ASN1_Module_Maps
is
new
Indefinite_Ordered_Maps
(
String
,
String_Vectors
.
Vector
);
(
String
,
ASN1_Module
);
type
ASN1_File
is
record
...
...
src/taste-parser_utils.adb
View file @
c16c79e3
-- *************************** taste aadl parser ************************* --
-- (c) 2008-201
7
European Space Agency - maxime.perrotin@esa.int
-- (c) 2008-201
8
European Space Agency - maxime.perrotin@esa.int
-- LGPL license, see LICENSE file
with
Ada
.
Text_IO
,
GNAT
.
OS_Lib
,
with
GNAT
.
OS_Lib
,
GNAT
.
Command_Line
,
Templates_Parser
,
Templates_Parser
.
Utils
,
...
...
@@ -15,8 +14,7 @@ with Ada.Text_IO,
package
body
TASTE
.
Parser_Utils
is
use
Ada
.
Text_IO
,
GNAT
.
OS_Lib
,
use
GNAT
.
OS_Lib
,
GNAT
.
Command_Line
,
Templates_Parser
,
Templates_Parser
.
Utils
,
...
...
@@ -104,7 +102,7 @@ package body TASTE.Parser_Utils is
end
if
;
end
Parse_Command_Line
;
procedure
Debug_Dump
(
Config
:
Taste_Configuration
)
is
procedure
Debug_Dump
(
Config
:
Taste_Configuration
;
Output
:
File_Type
)
is
Vec
:
Tag
;
Template
:
Translate_Set
;
begin
...
...
@@ -122,8 +120,8 @@ package body TASTE.Parser_Utils is
Vec
:=
Vec
&
Each
;
end
loop
;
Template
:=
Template
&
Assoc
(
"Other_Files"
,
Vec
);
Put_Line
(
Parse
(
Config
.
Binary_Path
.
all
&
"templates/configuration.tmplt"
,
Put_Line
(
Output
,
Parse
(
Config
.
Binary_Path
.
all
&
"templates/configuration.tmplt"
,
Template
));
end
Debug_Dump
;
...
...
src/taste-parser_utils.ads
View file @
c16c79e3
-- *************************** taste aadl parser *********************** --
-- (c) 20
17
European Space Agency - maxime.perrotin@esa.int
-- (c) 20
08-2018
European Space Agency - maxime.perrotin@esa.int
-- LGPL license, see LICENSE file
-- Set of helper functions for the parser
with
Ocarina
,
with
Ada
.
Containers
.
Indefinite_Ordered_Maps
,
Ada
.
Containers
.
Indefinite_Vectors
,
Ada
.
Strings
.
Unbounded
,
Text_IO
,
GNAT
.
Strings
,
Interfaces
.
C_Streams
,
Ocarina
,
Ocarina
.
Types
,
Ocarina
.
Namet
,
Ada
.
Containers
.
Indefinite_Ordered_Maps
,
Ada
.
Containers
.
Indefinite_Vectors
,
Ocarina
.
ME_AADL
.
AADL_Tree
.
Nodes
,
Ocarina
.
ME_AADL
.
AADL_Instances
.
Nodes
,
Ada
.
Strings
.
Unbounded
,
Option_Type
,
GNAT
.
Strings
,
Interfaces
.
C_Streams
;
Option_Type
;
use
Ocarina
,
Ocarina
.
Types
,
...
...
@@ -22,6 +23,7 @@ use Ocarina,
Ocarina
.
ME_AADL
.
AADL_Instances
.
Nodes
,
Ada
.
Containers
,
Ada
.
Strings
.
Unbounded
,
Text_IO
,
Interfaces
.
C_Streams
;
package
TASTE
.
Parser_Utils
is
...
...
@@ -115,6 +117,6 @@ package TASTE.Parser_Utils is
Other_Files
:
String_Vectors
.
Vector
;
end
record
;
procedure
Debug_Dump
(
Config
:
Taste_Configuration
);
procedure
Debug_Dump
(
Config
:
Taste_Configuration
;
Output
:
File_Type
);
procedure
Parse_Command_Line
(
Result
:
out
Taste_Configuration
);
end
TASTE
.
Parser_Utils
;
src/taste-parser_version.ads
View file @
c16c79e3
package
TASTE
.
Parser_Version
is
Parser_Release
:
constant
String
:=
"
f0618ef
; Commit
Date: Thu Jan 25 14:24:31 2018
"
;
"
53a8b63
; Commit
Author: Maxime Perrotin <Maxime.Perrotin@esa.int>
"
;
Ocarina_Version
:
constant
String
:=
"Ocarina 2017.x (Working Copy from r
d078c54
)"
;
"Ocarina 2017.x (Working Copy from r
0b92ed3
)"
;
end
TASTE
.
Parser_Version
;
\ No newline at end of file
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