vladx 1.2.6 → 1.3.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/package.json
CHANGED
package/programs/main/index.vx
CHANGED
|
@@ -1,21 +1,12 @@
|
|
|
1
|
-
variabile
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
stampa(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
variabile lista_di_liste = [[1, 2], [3, 4], [5, 6]]
|
|
14
|
-
stampa(`Lista di liste: ${lista_di_liste}`)
|
|
15
|
-
|
|
16
|
-
variabile lista_di_liste_di_liste = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]]
|
|
17
|
-
stampa(`Lista di liste di liste: ${lista_di_liste_di_liste}`)
|
|
18
|
-
|
|
19
|
-
variabile lista_di_liste_di_liste_di_liste = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]]
|
|
20
|
-
stampa(`Lista di liste di liste di liste: ${lista_di_liste_di_liste_di_liste}`)
|
|
21
|
-
|
|
1
|
+
variabile passport = {}
|
|
2
|
+
passport.nome = chiedi("Come ti chiami? ")
|
|
3
|
+
passport.eta = chiedi("Quanti anni hai? ")
|
|
4
|
+
|
|
5
|
+
se(passport.eta >= 18) {
|
|
6
|
+
stampa("Sei maggiorenne")
|
|
7
|
+
} altrimenti {
|
|
8
|
+
stampa("Sei minorenne")
|
|
9
|
+
}
|
|
10
|
+
stampa(passport)
|
|
11
|
+
|
|
12
|
+
Archivio.scrivi(`passports/${passport.nome}.txt`, JSON.stringify(passport))
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"nome":"Vlad","eta":"12"}
|
package/src/cli/cli.js
CHANGED
|
@@ -10,7 +10,8 @@ const { Parser } = require('../parser/parser.js');
|
|
|
10
10
|
const { Interpreter } = require('../interpreter/interpreter.js');
|
|
11
11
|
const { startREPL } = require('../repl/repl.js');
|
|
12
12
|
|
|
13
|
-
const
|
|
13
|
+
const packageJson = require('../../package.json');
|
|
14
|
+
const VERSION = packageJson.version;
|
|
14
15
|
|
|
15
16
|
const COLORS = {
|
|
16
17
|
reset: '\x1b[0m',
|
|
@@ -225,6 +225,23 @@ class Interpreter {
|
|
|
225
225
|
call: (_, args) => Array.isArray(args[0])
|
|
226
226
|
});
|
|
227
227
|
|
|
228
|
+
this.globals.define('booleano', {
|
|
229
|
+
call: (_, args) => Boolean(args[0])
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
this.globals.define('intero', {
|
|
233
|
+
call: (_, args) => parseInt(args[0])
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
this.globals.define('JSON', {
|
|
237
|
+
stringify: {
|
|
238
|
+
call: (_, args) => JSON.stringify(args[0], args[1], args[2])
|
|
239
|
+
},
|
|
240
|
+
parse: {
|
|
241
|
+
call: (_, args) => JSON.parse(args[0])
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
|
|
228
245
|
this.globals.define('aspetta', {
|
|
229
246
|
call: (_, args) => {
|
|
230
247
|
const ms = args[0];
|