plainscript-lang 1.0.3-beta → 1.0.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.
- package/README.md +97 -120
- package/compiler/bundler.js +83 -12
- package/compiler/cli.js +62 -11
- package/compiler/dependency-detector.js +11 -0
- package/compiler/generator.js +280 -15
- package/compiler/lexer.js +2 -0
- package/compiler/parser.js +410 -28
- package/compiler/sourcemap.js +142 -0
- package/compiler/version.js +1 -1
- package/docs/CAPABILITY_GAP_AUDIT.md +17 -15
- package/docs/PLAINSCRIPT-SPEC.md +41 -39
- package/docs/index.html +60 -33
- package/docs/website/script.js +168 -19
- package/docs/website/style.css +187 -41
- package/examples/ai-providers.pln +1 -1
- package/examples/arrays.pln +1 -1
- package/examples/async-errors.pln +1 -1
- package/examples/auth-api.pln +1 -1
- package/examples/auth-sessions.pln +1 -1
- package/examples/basics.pln +1 -1
- package/examples/bots.pln +1 -1
- package/examples/cache-and-jobs.pln +1 -1
- package/examples/cache-schedule.pln +1 -1
- package/examples/collections.pln +1 -1
- package/examples/concurrency.pln +1 -1
- package/examples/conditions.pln +1 -1
- package/examples/database.pln +1 -1
- package/examples/day2.pln +1 -1
- package/examples/day3.pln +1 -1
- package/examples/deployment.pln +1 -1
- package/examples/email-send.pln +1 -1
- package/examples/error-handling.pln +1 -1
- package/examples/expressions.pln +1 -1
- package/examples/file-uploads.pln +1 -1
- package/examples/files-and-config.pln +1 -1
- package/examples/files.pln +1 -1
- package/examples/football-backend/app.pln +1 -1
- package/examples/functions.pln +1 -1
- package/examples/hello.pln +1 -1
- package/examples/http-client.pln +1 -1
- package/examples/http.pln +1 -1
- package/examples/id-verification/app.pln +1 -1
- package/examples/json.pln +1 -1
- package/examples/loops.pln +1 -1
- package/examples/modules/app.pln +1 -1
- package/examples/modules/main.pln +1 -1
- package/examples/modules/math.pln +1 -1
- package/examples/mongo.pln +33 -0
- package/examples/objects.pln +1 -1
- package/examples/ocr.pln +1 -1
- package/examples/packages.pln +1 -1
- package/examples/record-kinds.pln +1 -1
- package/examples/records.pln +1 -1
- package/examples/rest-api-fetch.pln +1 -1
- package/examples/rest-api.pln +1 -1
- package/examples/scheduled-tasks.pln +1 -1
- package/examples/search-and-filter.pln +1 -1
- package/examples/server.pln +1 -1
- package/examples/sessions-and-cookies.pln +1 -1
- package/examples/sqlite.pln +1 -1
- package/examples/start.pln +1 -1
- package/examples/stdlib.pln +1 -1
- package/examples/string-verbs.pln +16 -0
- package/examples/telegram-ai-bot.pln +1 -1
- package/examples/telegram-bot.pln +1 -1
- package/examples/testing.pln +1 -1
- package/examples/web-api.pln +1 -1
- package/examples/web-app.pln +1 -1
- package/examples/websocket-server.pln +1 -1
- package/examples/websocket.pln +1 -1
- package/examples/whatsapp-bot/pairing.pln +1 -1
- package/examples/whatsapp-bot/qr.pln +1 -1
- package/package.json +3 -2
package/examples/functions.pln
CHANGED
package/examples/hello.pln
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
// PlainScript 1.0.3
|
|
1
|
+
// PlainScript 1.0.3: hello world.
|
|
2
2
|
show "Hello, PlainScript!"
|
package/examples/http-client.pln
CHANGED
package/examples/http.pln
CHANGED
package/examples/json.pln
CHANGED
package/examples/loops.pln
CHANGED
package/examples/modules/app.pln
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// PlainScript 1.0.3: MongoDB.
|
|
2
|
+
//
|
|
3
|
+
// The `mongo` statement binds a connection to a MongoDB instance using the
|
|
4
|
+
// official `mongodb` driver. Give it a connection string and an optional
|
|
5
|
+
// database name:
|
|
6
|
+
//
|
|
7
|
+
// mongo "<connection-string>" [db "<name>"]
|
|
8
|
+
//
|
|
9
|
+
// After connecting, the `remember ... as query` and `insert`/`update`/`delete`
|
|
10
|
+
// blocks run against the bound database. MongoDB understands a light SQL-like
|
|
11
|
+
// subset here:
|
|
12
|
+
//
|
|
13
|
+
// - SELECT <fields|*> FROM <collection> (query)
|
|
14
|
+
// - INSERT INTO <collection> (a, b) VALUES (?, ?) (insert)
|
|
15
|
+
//
|
|
16
|
+
// Swap the connection string below for your own server to run this file.
|
|
17
|
+
|
|
18
|
+
mongo "mongodb://localhost:27017" db "testdb"
|
|
19
|
+
|
|
20
|
+
// Fetch every user document. The result of the query block is stored in the
|
|
21
|
+
// `users` variable so it can be inspected or returned later.
|
|
22
|
+
remember users as query
|
|
23
|
+
SELECT * FROM users
|
|
24
|
+
done
|
|
25
|
+
show users
|
|
26
|
+
|
|
27
|
+
// Insert a new user document from a PlainScript variable. Field names and the
|
|
28
|
+
// order they appear in VALUES must match the column list.
|
|
29
|
+
remember name as "Ada"
|
|
30
|
+
remember email as "ada@example.com"
|
|
31
|
+
insert
|
|
32
|
+
INSERT INTO users (name, email) VALUES ({name}, {email})
|
|
33
|
+
done
|
package/examples/objects.pln
CHANGED
package/examples/ocr.pln
CHANGED
package/examples/packages.pln
CHANGED
package/examples/records.pln
CHANGED
package/examples/rest-api.pln
CHANGED
package/examples/server.pln
CHANGED
package/examples/sqlite.pln
CHANGED
package/examples/start.pln
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
// PlainScript 1.0.3
|
|
1
|
+
// PlainScript 1.0.3: start command entry point.
|
|
2
2
|
show "PlainScript started"
|
package/examples/stdlib.pln
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// PlainScript 1.0.3: natural string verbs — transform a variable in place.
|
|
2
|
+
|
|
3
|
+
make capitalize(title)
|
|
4
|
+
lowercase title
|
|
5
|
+
split title by " "
|
|
6
|
+
uppercase first letter of each word in title
|
|
7
|
+
join title by " "
|
|
8
|
+
give title
|
|
9
|
+
done
|
|
10
|
+
|
|
11
|
+
remember headline as "hello world from plainscript"
|
|
12
|
+
show capitalize(headline)
|
|
13
|
+
|
|
14
|
+
remember label as " just a label "
|
|
15
|
+
trim label
|
|
16
|
+
show label
|
package/examples/testing.pln
CHANGED
package/examples/web-api.pln
CHANGED
package/examples/web-app.pln
CHANGED
package/examples/websocket.pln
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "plainscript-lang",
|
|
3
|
-
"version": "1.0.3
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "PlainScript — an Intent-Oriented Programming Language. When even a simple sentence can be code.",
|
|
5
5
|
"main": "compiler/cli.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"plainscript": "./compiler/cli.js"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"test": "node tests/compiler.test.js && node tests/build.test.js && node tests/telegram.test.js && node tests/ocr.test.js && node tests/nesting.test.js && node tests/backend.test.js && node tests/runtime.test.js && node tests/acceptance.test.js && node tests/whatsapp.test.js && node tests/audit.test.js && node tests/docs.test.js && node tests/compat/language.test.js && node tests/compat/node.test.js && node tests/compat/binary.test.js && node tests/compat/errors.test.js && node tests/compat/async.test.js && node tests/compat/modules.test.js && node tests/compat/npm.test.js && node tests/compat/web.test.js && node tests/compat/real-world.test.js"
|
|
10
|
+
"test": "node tests/compiler.test.js && node tests/build.test.js && node tests/telegram.test.js && node tests/ocr.test.js && node tests/nesting.test.js && node tests/backend.test.js && node tests/runtime.test.js && node tests/acceptance.test.js && node tests/whatsapp.test.js && node tests/audit.test.js && node tests/sourcemap.test.js && node tests/modules.test.js && node tests/datastructures.test.js && node tests/docs.test.js && node tests/compat/language.test.js && node tests/compat/node.test.js && node tests/compat/binary.test.js && node tests/compat/errors.test.js && node tests/compat/async.test.js && node tests/compat/modules.test.js && node tests/compat/npm.test.js && node tests/compat/web.test.js && node tests/compat/real-world.test.js"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
13
|
"compiler",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"ws": "^8.21.3"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
+
"mongodb": "^7.6.0",
|
|
45
46
|
"tesseract.js": "^7.0.0"
|
|
46
47
|
}
|
|
47
48
|
}
|