pss-langserver
Version:
A Language server for the Portable Stimulus Standard
55 lines (54 loc) • 1.89 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/*
* Copyright (C) 2025 Darshan(@thisisthedarshan)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
const autoCompletionProvider_1 = require("../providers/autoCompletionProvider");
const ast_1 = require("./ast");
const fs_extra_1 = require("fs-extra");
const file = `
component pss_top {
action stress_x__filenamefer {
activity {
schedule {
do my_mem_ops_c ::write_data;
do my_mem_ops_c ::write_data;
}
repeat (5) {
do my_mem_ops_c::copy_data;
}
schedule {
do my_mem_ops_c ::read_check_data;
do my_mem_ops_c ::read_check_data;
}
}
}
action recv_xfer {
}
}
`;
let out = (0, ast_1.buildAST)("", file);
out.map(astObj => {
Object.entries(astObj).map(([keyword, info]) => {
console.log(keyword, info);
});
});
let autocompletion = (0, autoCompletionProvider_1.buildAutocompletionBlock)(out);
autocompletion.map(astObj => {
console.log(astObj);
});
const newObjs = (0, ast_1.buildASTNew)(__filename, file);
(0, fs_extra_1.writeFileSync)(__filename + '.json', JSON.stringify(newObjs, null, 4), 'utf-8');