papagaio 0.7.0 → 0.7.3

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.
@@ -1,15 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>papagaio test</title>
7
- </head>
8
- <script src="../src/papagaio-bootstrap.mjs" type="module"></script>
9
- <script type="papagaio">
10
- $pattern {abc} {$eval{console.log(papagaio)} aaaaaaaaaaaaaaaaaaaaaaaaaaaa}
11
- abc
12
- </script>
13
- <body>
14
- </body>
15
- </html>
@@ -1,70 +0,0 @@
1
- // generic ts-like to wasm compiler
2
-
3
- // util patterns
4
- $pattern {// $comment $regex newline{[^\n]*}} {}
5
- $pattern {$regex spaces{\s\s}}{ }
6
-
7
- $eval{
8
- papagaio.exit = function()
9
- {
10
- papagaio.content = "(module\n" + papagaio.content + "\n)";
11
- papagaio.exit = null;
12
- };
13
- return ""
14
- }
15
-
16
- $pattern {export function $name ${(}{)}params:$rets ${}{}content} {
17
- $pattern {parametrize}
18
- {
19
- $eval {
20
- let str = "$params".replace("(", "").replace(")", "");
21
- let params = str.split(",").map(p => p.trim()).filter(p => p);
22
- let new_stuff = "";
23
- for (const param of params) {
24
- if (!param.includes(":")) continue; // Pula se não tem ':'
25
- const [name, type] = param.split(":");
26
- if (name && type) { // Verifica se ambos existem
27
- new_stuff += ` (param $${name.trim()} ${type.trim()}) `;
28
- }
29
- }
30
- return new_stuff;
31
- }
32
- }
33
-
34
- (func (export "$name") parametrize (result $rets)
35
- $content
36
- )
37
- }
38
-
39
- $pattern {function $name ${}{}params{(}{)}:$rets ${}{}content} {
40
- $pattern {parametrize}
41
- {
42
- $eval {
43
- let str = "$params".replace("(", "").replace(")", "");
44
- let params = str.split(",").map(p => p.trim()).filter(p => p);
45
- let new_stuff = "";
46
- for (const param of params) {
47
- if (!param.includes(":")) continue; // Pula se não tem ':'
48
- const [name, type] = param.split(":");
49
- if (name && type) { // Verifica se ambos existem
50
- new_stuff += ` (param $${name.trim()} ${type.trim()}) `;
51
- }
52
- }
53
- return new_stuff;
54
- }
55
- }
56
-
57
- (func $$name parametrize (result $rets)
58
- $content
59
- )
60
- }
61
-
62
- function name(a:i32, b:i32):i64 i64
63
- {
64
- contentnans
65
- }
66
-
67
- export function funcao_exportada(a:f32, b:f32, c:f32):i64 i64 i64 i64
68
- {
69
- fução expoortada1
70
- }
@@ -1,23 +0,0 @@
1
- // papagaio-bootstrap.js
2
- // only needed if using <script type="papagaio"> in browser
3
- import { Papagaio } from "./papagaio.js";
4
-
5
- (async () => {
6
- const p = new Papagaio();
7
-
8
- const nodes = [...document.querySelectorAll('script[type="papagaio"]')];
9
-
10
- for (const el of nodes) {
11
- let src = el.textContent;
12
-
13
- if (el.src) {
14
- src = await fetch(el.src).then(r => r.text());
15
- }
16
-
17
- const out = p.process(src);
18
-
19
- const s = document.createElement("div");
20
- s.textContent = out;
21
- window.document.body.appendChild(s);
22
- }
23
- })();