0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
const files = {
"main.pcg": "funcTion text print hello;startFunction text;"
};
const functions = {};
const values = {};
function startc(text) {
var code = text.trim();
let strings = code.split(";");
for(var i = 0; i < strings.length; i++) {
let currentString = strings[i];
let words = currentString.split(" ");
if(words[0].toLowerCase() == "print") {
console.log(words[1]);
};
if(words[0].toLowerCase() == "printValue") {
console.log(values[words[1]]);
};
if(words[0].toLowerCase() == "value") {
values[words[1]] = words[2];
};
if(words[0].toLowerCase() == "ws") {
values[words[1]] = new WebSocket(words[2]);
};
if(words[0].toLowerCase() == "printcycle") {
for(var i = 0; i < words[1]; i++) {
console.log(words[2]);
};
};
if(words[0].toLowerCase() == "function") {
functions[words[1]] = words[2] + " " + words[3];
};
if(words[0].toLowerCase() == "startfunction") {
startc(functions[words[1]]);
};
};
};
function start(file) {
startc(files[file]);
};
Запостил:
govnokoder666 ,
06.01.2022 (Updated 06.01.2022 )
Комментарии (1) RSS