feat: add async/await keywords, Num/String extensions, and Jinja markdown example
Add `async` and `await` token support to the Wren compiler with scheduler resolution logic, extend `Num` with `e` constant, hyperbolic trig, base conversion, and new methods (`isZero`, `gcd`, `lcm`, `digits`, etc.), extend `String` with `lower`, `upper`, `capitalize`, `title`, and regenerate `wren_core.wren.inc`. Include `Makefile` for multi-platform builds, rewrite `README.md` with updated build instructions, and add `example/await_demo.wren` and `example/jinja_markdown.wren` demonstrating new features.
This commit is contained in:
Vendored
+51
@@ -0,0 +1,51 @@
|
||||
// retoor <retoor@molodetz.nl>
|
||||
|
||||
System.print("=== Num Extensions Demo ===\n")
|
||||
|
||||
System.print("--- Constants ---")
|
||||
System.print("Num.pi: %(Num.pi)")
|
||||
System.print("Num.tau: %(Num.tau)")
|
||||
System.print("Num.e: %(Num.e)")
|
||||
|
||||
System.print("\n--- Query Methods ---")
|
||||
System.print("0.isZero: %(0.isZero)")
|
||||
System.print("5.isPositive: %(5.isPositive)")
|
||||
System.print("(-3).isNegative: %((-3).isNegative)")
|
||||
System.print("42.isFinite: %(42.isFinite)")
|
||||
System.print("(1/0).isFinite: %((1/0).isFinite)")
|
||||
System.print("4.isEven: %(4.isEven)")
|
||||
System.print("3.isOdd: %(3.isOdd)")
|
||||
System.print("5.isBetween(1, 10): %(5.isBetween(1, 10))")
|
||||
|
||||
System.print("\n--- Math Functions ---")
|
||||
System.print("100.log10: %(100.log10)")
|
||||
System.print("0.sinh: %(0.sinh)")
|
||||
System.print("0.cosh: %(0.cosh)")
|
||||
System.print("0.tanh: %(0.tanh)")
|
||||
|
||||
System.print("\n--- Angle Conversion ---")
|
||||
var pi = Num.pi
|
||||
System.print("pi.toDegrees: %(pi.toDegrees)")
|
||||
System.print("180.toRadians: %(180.toRadians)")
|
||||
|
||||
System.print("\n--- Base Conversion ---")
|
||||
System.print("255.toHex: %(255.toHex)")
|
||||
System.print("10.toBinary: %(10.toBinary)")
|
||||
System.print("8.toOctal: %(8.toOctal)")
|
||||
System.print("255.toBase(16): %(255.toBase(16))")
|
||||
System.print("100.toBase(36): %(100.toBase(36))")
|
||||
|
||||
System.print("\n--- Character Conversion ---")
|
||||
System.print("65.toChar: %(65.toChar)")
|
||||
System.print("97.toChar: %(97.toChar)")
|
||||
|
||||
System.print("\n--- Formatting ---")
|
||||
System.print("3.14159.format(2): %(3.14159.format(2))")
|
||||
System.print("42.format(3): %(42.format(3))")
|
||||
System.print("(-1.5).format(1): %((-1.5).format(1))")
|
||||
|
||||
System.print("\n--- Integer Operations ---")
|
||||
System.print("12.gcd(8): %(12.gcd(8))")
|
||||
System.print("4.lcm(6): %(4.lcm(6))")
|
||||
System.print("123.digits: %(123.digits)")
|
||||
System.print("0.digits: %(0.digits)")
|
||||
Reference in New Issue
Block a user