-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds --json-modules, to get a JSON array with all the modules.
- Loading branch information
Showing
7 changed files
with
92 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
CORE | ||
json-modules.v | ||
--json-modules - | ||
activate-multi-line-match | ||
\[ | ||
\{ | ||
"identifier": "Verilog::foo", | ||
"location": \{ | ||
"file": "json-modules\.v", | ||
"line": "1", | ||
"workingDirectory": ".*" | ||
\}, | ||
"mode": "Verilog", | ||
"name": "foo" | ||
\}, | ||
\{ | ||
"identifier": "Verilog::bar", | ||
"location": \{ | ||
"file": "json-modules.v", | ||
"line": "4", | ||
"workingDirectory": ".*" | ||
\}, | ||
"mode": "Verilog", | ||
"name": "bar" | ||
\} | ||
\] | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
-- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module foo; | ||
endmodule | ||
|
||
module bar; | ||
endmodule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ Author: Daniel Kroening, [email protected] | |
\*******************************************************************/ | ||
|
||
#include <util/xml.h> | ||
#include <util/json_irep.h> | ||
#include <util/xml_irep.h> | ||
|
||
#include "show_modules.h" | ||
|
@@ -91,3 +91,38 @@ void show_modules(const symbol_table_baset &symbol_table, std::ostream &out) | |
} | ||
} | ||
} | ||
|
||
/*******************************************************************\ | ||
Function: json_modules | ||
Inputs: | ||
Outputs: | ||
Purpose: | ||
\*******************************************************************/ | ||
|
||
void json_modules(const symbol_table_baset &symbol_table, std::ostream &out) | ||
{ | ||
json_arrayt json_modules; | ||
|
||
for(const auto &s : symbol_table.symbols) | ||
{ | ||
const symbolt &symbol = s.second; | ||
|
||
if(symbol.type.id() == ID_module) | ||
{ | ||
json_objectt json_module; | ||
json_module["location"] = json(symbol.location); | ||
json_module["identifier"] = json_stringt{id2string(symbol.name)}; | ||
json_module["mode"] = json_stringt{id2string(symbol.mode)}; | ||
json_module["name"] = json_stringt{id2string(symbol.display_name())}; | ||
|
||
json_modules.push_back(std::move(json_module)); | ||
} | ||
} | ||
|
||
out << json_modules; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters