feat: add await syntax for direct async function calls and new generator/phonebook apps
Add compiler support for calling async functions directly with `await fn(args)` syntax, automatically translating to `await fn.call(args)`. Introduce `create_merge` Makefile target for merging Wren source files. Include new `apps/generator.wren` source code generator using OpenRouter API, `apps/phonebook.wren` CLI phonebook with SQLite backend, and `apps/minitut.md` Wren tutorial reference. Update `example/await_demo.wren` with parameterized async functions, nested awaits, and expression usage. Fix JSON parsing in `example/openrouter_demo.wren` to strip markdown code fences. Document new await syntax in `manual/api/scheduler.html`.
This commit is contained in:
Vendored
+9
-1
@@ -39,7 +39,15 @@ System.print("Status: %(response.statusCode)")
|
||||
System.print("")
|
||||
|
||||
if (response.ok) {
|
||||
var data = Json.parse(response.body)
|
||||
let text = response.body
|
||||
if(text.startsWith("```")){
|
||||
text = text.trim("```")
|
||||
text = text.trim("json")
|
||||
text = text.trim("\n")
|
||||
|
||||
}
|
||||
System.print(text)
|
||||
var data = Json.parse(text)
|
||||
if (data != null && data["choices"] != null && data["choices"].count > 0) {
|
||||
var message = data["choices"][0]["message"]
|
||||
if (message != null && message["content"] != null) {
|
||||
|
||||
Reference in New Issue
Block a user