@designliquido/delegua 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/CONTRIBUTING.md +0 -0
- package/.github/workflows/principal.yml +20 -0
- package/.release-it.json +8 -0
- package/.vscode/launch.json +2 -2
- package/README.md +5 -6
- package/bin/delegua +1 -1
- package/bin/delegua.cmd +1 -0
- package/indice.js +14 -0
- package/package.json +46 -37
- package/src/ambiente.js +53 -0
- package/src/{egua.js → delegua.js} +20 -20
- package/src/erro.js +18 -0
- package/src/estruturas/callable.js +5 -0
- package/src/estruturas/classe.js +43 -0
- package/src/estruturas/funcao.js +62 -0
- package/src/estruturas/funcaoPadrao.js +18 -0
- package/src/estruturas/instancia.js +27 -0
- package/src/estruturas/modulo.js +9 -0
- package/src/expr.js +52 -52
- package/src/interpretador.js +802 -0
- package/src/lexer.js +90 -89
- package/src/lib/globalLib.js +63 -63
- package/src/lib/importStdlib.js +18 -27
- package/src/parser.js +219 -223
- package/src/resolver.js +93 -93
- package/src/stmt.js +34 -34
- package/src/{tokenTypes.js → tiposDeSimbolos.js} +21 -21
- package/src/web.js +41 -41
- package/testes/testes.egua +363 -364
- package/index.html +0 -43
- package/index.js +0 -14
- package/src/environment.js +0 -53
- package/src/errors.js +0 -17
- package/src/interpreter.js +0 -798
- package/src/lib/__tests__/eguamat.test.js +0 -101
- package/src/lib/eguamat.js +0 -725
- package/src/lib/tempo.js +0 -50
- package/src/structures/callable.js +0 -5
- package/src/structures/class.js +0 -43
- package/src/structures/function.js +0 -62
- package/src/structures/instance.js +0 -27
- package/src/structures/module.js +0 -9
- package/src/structures/standardFn.js +0 -18
package/index.html
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
<html lang="pt-br">
|
|
2
|
-
|
|
3
|
-
<head>
|
|
4
|
-
<!-- Global site tag (gtag.js) - Google Analytics -->
|
|
5
|
-
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-147268561-3"></script>
|
|
6
|
-
<script>
|
|
7
|
-
window.dataLayer = window.dataLayer || [];
|
|
8
|
-
function gtag() { dataLayer.push(arguments); }
|
|
9
|
-
gtag('js', new Date());
|
|
10
|
-
|
|
11
|
-
gtag('config', 'UA-147268561-3');
|
|
12
|
-
</script>
|
|
13
|
-
|
|
14
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
|
15
|
-
<meta charset="UTF-8">
|
|
16
|
-
|
|
17
|
-
<title>IDEgua - Linguagem egua</title>
|
|
18
|
-
<link rel="stylesheet" href="./web/style.css" />
|
|
19
|
-
<link rel="stylesheet" href="./web/theme.css">
|
|
20
|
-
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono&display=swap" rel="stylesheet" />
|
|
21
|
-
<link rel="shortcut icon" href="./web/assets/logo2.svg">
|
|
22
|
-
</head>
|
|
23
|
-
|
|
24
|
-
<body>
|
|
25
|
-
<div id="container">
|
|
26
|
-
<div id="left"><select id="demoSelector"></select></div>
|
|
27
|
-
<div id="middle"><img src="web/assets/egua.png" alt="egua" width="100px" height="auto"></div>
|
|
28
|
-
<div id="right"><button id="runBtn">Executar</button></div>
|
|
29
|
-
</div>
|
|
30
|
-
|
|
31
|
-
<div id="editor"></div>
|
|
32
|
-
<div id="output" aria-live="polite"></div>
|
|
33
|
-
|
|
34
|
-
<script src="web/dist.js"></script>
|
|
35
|
-
|
|
36
|
-
<!-- framework do editor do código -->
|
|
37
|
-
<script src="./web/codeflask.min.js"></script>
|
|
38
|
-
|
|
39
|
-
<script src="web/demos.js"></script>
|
|
40
|
-
<script src="web/index.js"></script>
|
|
41
|
-
</body>
|
|
42
|
-
|
|
43
|
-
</html>
|
package/index.js
DELETED
package/src/environment.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
const RuntimeError = require("./errors.js").RuntimeError;
|
|
2
|
-
|
|
3
|
-
module.exports = class Environment {
|
|
4
|
-
constructor(enclosing) {
|
|
5
|
-
this.enclosing = enclosing || null;
|
|
6
|
-
this.values = {};
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
defineVar(varName, value) {
|
|
10
|
-
this.values[varName] = value;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
assignVarAt(distance, name, value) {
|
|
14
|
-
this.ancestor(distance).values[name.lexeme] = value;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
assignVar(name, value) {
|
|
18
|
-
if (this.values[name.lexeme] !== undefined) {
|
|
19
|
-
this.values[name.lexeme] = value;
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (this.enclosing != null) {
|
|
24
|
-
this.enclosing.assignVar(name, value);
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
throw new RuntimeError(name, "Variável não definida '" + name.lexeme + "'.");
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
ancestor(distance) {
|
|
32
|
-
let environment = this;
|
|
33
|
-
for (let i = 0; i < distance; i++) {
|
|
34
|
-
environment = environment.enclosing;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return environment;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
getVarAt(distance, name) {
|
|
41
|
-
return this.ancestor(distance).values[name];
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
getVar(token) {
|
|
45
|
-
if (this.values[token.lexeme] !== undefined) {
|
|
46
|
-
return this.values[token.lexeme];
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (this.enclosing !== null) return this.enclosing.getVar(token);
|
|
50
|
-
|
|
51
|
-
throw new RuntimeError(token, "Variável não definida '" + token.lexeme + "'.");
|
|
52
|
-
}
|
|
53
|
-
};
|
package/src/errors.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
module.exports.RuntimeError = class RuntimeError extends Error {
|
|
2
|
-
constructor(token, message) {
|
|
3
|
-
super(message);
|
|
4
|
-
this.token = token;
|
|
5
|
-
}
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
module.exports.ContinueException = class ContinueException extends Error { };
|
|
9
|
-
|
|
10
|
-
module.exports.BreakException = class BreakException extends Error { };
|
|
11
|
-
|
|
12
|
-
module.exports.ReturnException = class ReturnException extends Error {
|
|
13
|
-
constructor(value) {
|
|
14
|
-
super(value);
|
|
15
|
-
this.value = value;
|
|
16
|
-
}
|
|
17
|
-
};
|