Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
Add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
qarlosalberto committed Jan 18, 2023
1 parent 2755d87 commit 5e032b4
Show file tree
Hide file tree
Showing 27 changed files with 771 additions and 201 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"temp": "0.9.4",
"tiny-glob": "^0.2.9",
"wavedrom": "2.6.8",
"web-tree-sitter": "^0.16.2",
"web-tree-sitter": "^0.20.7",
"chokidar": "3.5.3"
},
"devDependencies": {
Expand Down
1 change: 1 addition & 0 deletions src/documenter/documenter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ export class Documenter extends section_creator.Creator {
////////////////////////////////////////////////////////////////////////
if (output_type === common_documenter.doc_output_type.HTML) {
document += `
<br><br><br><br><br><br>
</article class="markdown-body">
</body>
`;
Expand Down
8 changes: 7 additions & 1 deletion src/documenter/doxygen_parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import * as common_hdl from "../parser/common";

export const DOXYGEN_FIELD_ARRAY = ['author', 'version', 'project', 'copyright', 'brief', 'details',
'custom_section_begin', 'custom_section_end'];
'custom_section_begin', 'custom_section_end', 'file', 'title', 'date'];

export type Doxygen_element = {
field: string;
Expand Down Expand Up @@ -168,6 +168,8 @@ export function get_virtual_bus(port_list: common_hdl.Port_hdl[]) {
name: port_i.info.name,
description: ""
},
inline_comment: "",
over_comment: "",
direction: port_i.direction,
default_value: port_i.default_value,
type: port_i.type,
Expand Down Expand Up @@ -201,6 +203,8 @@ export function get_virtual_bus(port_list: common_hdl.Port_hdl[]) {
name: port_i.info.name,
description: virtual_port_end.text
},
inline_comment: "",
over_comment: "",
direction: port_i.direction,
default_value: port_i.default_value,
type: port_i.type,
Expand Down Expand Up @@ -241,6 +245,8 @@ export function get_virtual_bus(port_list: common_hdl.Port_hdl[]) {
name: port_i.info.name,
description: ""
},
inline_comment: "",
over_comment: "",
direction: port_i.direction,
default_value: port_i.default_value,
type: port_i.type,
Expand Down
81 changes: 43 additions & 38 deletions src/documenter/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,150 +7,155 @@
"english": "Designs",
"russian": "Модульный состав"
},
"Module":{
"Module": {
"english": "Module",
"russian": "Модуль"
},
"Copyright":{
"Copyright": {
"english": "Copyright",
"russian": "Копирайт"
},
"Author":{
"Author": {
"english": "Author",
"russian": "Автор"
},
"Version":{
"Version": {
"english": "Version",
"russian": "Версия"
},
"Date":{
"Title": {
"english": "Title",
"russian": "Заголовок"
},
"Date": {
"english": "Date",
"russian": "Дата"
},
"Brief":{
"Brief": {
"english": "Brief",
"russian": "Назначение"
},
"Details":{
"Details": {
"english": "Details",
"russian": "Описание" },
"Diagram":{
"russian": "Описание"
},
"Diagram": {
"english": "Diagram",
"russian": "Диаграмма"
},
"Generics":{
"Generics": {
"english": "Generics",
"russian": "Параметры"
},
"Generic name":{
"Generic name": {
"english": "Generic name",
"russian": "Название"
},
"Type":{
"Type": {
"english": "Type",
"russian": "Тип"
},
"Ports":{
"Ports": {
"english": "Ports",
"russian": "Порты"
},
"Port name":{
"Port name": {
"english": "Port name",
"russian": "Название"
},
"Direction":{
"Direction": {
"english": "Direction",
"russian": "Направление"
},
"Description":{
"Description": {
"english": "Description",
"russian": "Описание"
},
"virtual bus":{
"virtual bus": {
"english": "virtual bus",
"russian": "bиртуальн шины"
},
"Virtual Buses":{
"Virtual Buses": {
"english": "Virtual Buses",
"russian": "Виртуальные шины"
},
"Signals":{
"Signals": {
"english": "Signals",
"russian": "Сигналы"
},
"Package":{
"Package": {
"english": "Package",
"russian": "Пакет"
},
"File":{
"File": {
"english": "File",
"russian": "Файл"
},
"Constants":{
"Constants": {
"english": "Constants",
"russian": "Константы"
},
"Value":{
"Value": {
"english": "Value",
"russian": "Значение"
},
"Types":{
"Types": {
"english": "Types",
"russian": "Типы"
},
"Name":{
"Name": {
"english": "Name",
"russian": "Название"
},
"Functions":{
"Functions": {
"english": "Functions",
"russian": "Функции"
},
"return":{
"return": {
"english": "return",
"russian": "возвращает"
},
"Processes":{
"Processes": {
"english": "Processes",
"russian": "Процессы"
},
"Instantiations":{
"Instantiations": {
"english": "Instantiations",
"russian": "Подключенные модули"
},
"State machines":{
"State machines": {
"english": "State machines",
"russian": "Конечные автоматы"
},
"Documentation for":{
"Documentation for": {
"english": "Documentation for",
"russian": "Документация по"
},
"Generated by":{
"Generated by": {
"english": "Generated by",
"russian": "Создано"
},
"Interface":{
"Interface": {
"english": "Interface",
"russian": "Интерфейс"
},
"Parameters":{
"Parameters": {
"english": "Parameters",
"russian": "Параметры"
},
"Default value":{
"Default value": {
"english": "Default value",
"russian": "Значение по умолчанию"
},
"Others":{
"Others": {
"english": "Others",
"russian": "Другие"
},
"Logics":{
"Logics": {
"english": "Logics",
"russian": "Logics"
},
"Modports":{
"Modports": {
"english": "Modports",
"russian": "Modports"
}
Expand Down
2 changes: 2 additions & 0 deletions src/parser/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ export type Virtual_bus_hdl = {
export type Port_hdl = {
hdl_element_type: TYPE_HDL_ELEMENT.PORT;
info: Common_info;
over_comment: string;
inline_comment: string;
direction: string;
default_value: string;
type: string;
Expand Down
Binary file modified src/parser/parsers/tree-sitter-verilog.wasm
100644 → 100755
Binary file not shown.
Binary file modified src/parser/parsers/tree-sitter-vhdl.wasm
100644 → 100755
Binary file not shown.
24 changes: 16 additions & 8 deletions src/parser/ts_verilog/elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function get_processes(tree: any, lines: any): common_hdl.Process_hdl[] {

function get_process_label(p: any) {
let label_txt = '';
const label = utils_hdl.get_item_from_childs(p, "block_identifier");
const label = utils_hdl.get_item_from_childs(p, "simple_identifier");
if (label === undefined) {
label_txt = 'unnamed';
} else {
Expand Down Expand Up @@ -148,13 +148,12 @@ function get_type_type_pkg(input: any) {
return name;
}

function get_type_name_pkg(input: any, lines: any) {
const arr = utils_hdl.search_multiple_in_tree(input, 'type_identifier');
if (arr.length === 0) {
function get_type_name_pkg(input: any, _lines: any) {
const arr = utils_hdl.get_item_from_childs(input, 'simple_identifier');
if (arr === undefined) {
return "undefined";
}
const input_name = utils_hdl.extract_data(arr[0], lines);
return input_name;
return arr.text;
}

//******************************************************************************
Expand Down Expand Up @@ -231,7 +230,7 @@ function get_signal_type(input: any, lines: any, command: any) {
}

function get_signal_name(input: any, lines: any) {
const arr = utils_hdl.search_multiple_in_tree(input, 'net_identifier');
const arr = utils_hdl.search_multiple_in_tree(input, 'simple_identifier');
const names: any[] = [];
let name;
if (arr.length === 0) {
Expand All @@ -254,6 +253,11 @@ function get_signal_name(input: any, lines: any) {
return names;
}

//******************************************************************************
//******************************************************************************
// Type
//******************************************************************************
//******************************************************************************
export function get_types(tree: any, lines: any): common_hdl.Signal_hdl[] {
const items: common_hdl.Signal_hdl[] = [];
const start_line = tree.startPosition.row;
Expand Down Expand Up @@ -372,7 +376,7 @@ export function get_constants(tree: any, lines: any): common_hdl.Constant_hdl[]
const items = [];
const start_line = tree.startPosition.row;

const inputs = utils_hdl.search_multiple_in_tree(tree, 'local_parameter_declaration');
const inputs = utils_hdl.search_multiple_in_tree(tree, 'list_of_param_assignments');
for (let x = 0; x < inputs.length; ++x) {
const arr2 = utils_hdl.search_multiple_in_tree(inputs[x], 'param_assignment');
for (let x2 = 0; x2 < arr2.length; ++x2) {
Expand Down Expand Up @@ -662,6 +666,8 @@ function add_port(element: any, key: any, name: any, direction: any, type: any,
},
type: typeVar,
subtype: subtype,
inline_comment: "",
over_comment: "",
direction: ((ansi === true) ? directionVar : direction),
default_value: ""
};
Expand Down Expand Up @@ -782,6 +788,8 @@ export function get_generics(tree: any, lines: any, comments: any, ansi: any, co
type: get_generic_kind(inputs[x], lines),
subtype: "",
direction: "",
inline_comment: "",
over_comment: "",
default_value: get_generic_default(inputs[x], lines),
};

Expand Down
Loading

0 comments on commit 5e032b4

Please sign in to comment.