feat: add wasm build targets, profile hooks, os_demo example, and restructure manual source

- Add `wasm`, `wasm-clean`, and `install-emscripten` phony targets to Makefile for WebAssembly cross-compilation
- Insert `WREN_PROFILE_ENTER`/`WREN_PROFILE_EXIT` macros in `wren_vm.h` and `wren_vm.c` to support optional runtime profiling via `WREN_PROFILE_ENABLED`
- Create `example/os_demo.wren` demonstrating Platform, Process, and conditional exit usage
- Update `example/regex_demo.wren` to import `Match` and exercise Match object properties, groups, and `matchAll`
- Remove static HTML manual pages (`base64.html`, `dns.html`, `json.html`) and replace with structured `manual_src/` directory containing Jinja2 templates, YAML metadata, and content pages
- Expand `README.md` with build targets table, manual building instructions, source layout, and guide for adding new module documentation
This commit is contained in:
2026-01-26 04:12:14 +00:00
parent 79ff93c9a2
commit 04e467e09b
143 changed files with 13333 additions and 15112 deletions
+33 -1
View File
@@ -1,6 +1,6 @@
// retoor <retoor@molodetz.nl>
import "regex" for Regex
import "regex" for Regex, Match
System.print("=== Regex Module Demo ===\n")
@@ -128,3 +128,35 @@ var sentence = "hello, world; foo bar"
var tokens = tokenSeparator.split(sentence)
System.print("Input: %(sentence)")
System.print("Tokens: %(tokens)")
System.print("\n--- Match Object ---")
var emailRe = Regex.new("(\\w+)@(\\w+)\\.(\\w+)")
var match = emailRe.match("Contact: alice@example.com for info")
if (match != null) {
System.print("Full match: %(match.text)")
System.print("Start index: %(match.start)")
System.print("End index: %(match.end)")
System.print("group(0): %(match.group(0))")
System.print("group(1): %(match.group(1))")
System.print("group(2): %(match.group(2))")
System.print("group(3): %(match.group(3))")
}
System.print("\n--- Groups Property ---")
var dateRe = Regex.new("(\\d{4})-(\\d{2})-(\\d{2})")
var dateMatch = dateRe.match("Date: 2024-01-15")
if (dateMatch != null) {
System.print("groups[0] (full match): %(dateMatch.groups[0])")
System.print("groups[1] (year): %(dateMatch.groups[1])")
System.print("groups[2] (month): %(dateMatch.groups[2])")
System.print("groups[3] (day): %(dateMatch.groups[3])")
System.print("Total groups: %(dateMatch.groups.count)")
}
System.print("\n--- Find All Matches ---")
var numRe = Regex.new("\\d+")
var allMatches = numRe.matchAll("Order 123 has 5 items at $99 each")
System.print("Found %(allMatches.count) numbers:")
for (m in allMatches) {
System.print(" '%(m.text)' at position %(m.start)-%(m.end)")
}