feat: rename IO.write to IO.print and add Unicode escape support in strings
Rename the IO.write method to IO.print, which now prints without a trailing newline, and add a new IO.print method that appends a newline after output. Update all benchmark, example, and test files to use IO.print instead of IO.write. Additionally, implement Unicode escape sequence parsing in the compiler's string tokenizer, supporting \uXXXX and \u{...} syntax with proper UTF-8 encoding for code points up to U+10FFFF.
This commit is contained in:
@@ -4,15 +4,15 @@ var g = null
|
||||
{
|
||||
var local = "local"
|
||||
f = fn {
|
||||
IO.write(local)
|
||||
IO.print(local)
|
||||
local = "after f"
|
||||
IO.write(local)
|
||||
IO.print(local)
|
||||
}
|
||||
|
||||
g = fn {
|
||||
IO.write(local)
|
||||
IO.print(local)
|
||||
local = "after g"
|
||||
IO.write(local)
|
||||
IO.print(local)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ var f = null
|
||||
|
||||
fn(param) {
|
||||
f = fn {
|
||||
IO.write(param)
|
||||
IO.print(param)
|
||||
}
|
||||
}.call("param")
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ var f = null
|
||||
class Foo {
|
||||
method(param) {
|
||||
f = fn {
|
||||
IO.write(param)
|
||||
IO.print(param)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ var f = null
|
||||
{
|
||||
var local = "local"
|
||||
f = fn {
|
||||
IO.write(local)
|
||||
IO.print(local)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ var foo = null
|
||||
var local = "local"
|
||||
class Foo {
|
||||
method {
|
||||
IO.write(local)
|
||||
IO.print(local)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@ fn {
|
||||
fn {
|
||||
var c = "c"
|
||||
f = fn {
|
||||
IO.write(a)
|
||||
IO.write(b)
|
||||
IO.write(c)
|
||||
IO.print(a)
|
||||
IO.print(b)
|
||||
IO.print(c)
|
||||
}
|
||||
}.call
|
||||
}.call
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
var local = "local"
|
||||
fn {
|
||||
IO.write(local) // expect: local
|
||||
IO.print(local) // expect: local
|
||||
}.call
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
var local = "local"
|
||||
class Foo {
|
||||
method {
|
||||
IO.write(local)
|
||||
IO.print(local)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ var f = null
|
||||
{
|
||||
var a = "a"
|
||||
f = fn {
|
||||
IO.write(a)
|
||||
IO.write(a)
|
||||
IO.print(a)
|
||||
IO.print(a)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
{
|
||||
var a = "a"
|
||||
f = fn IO.write(a)
|
||||
f = fn IO.print(a)
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
@@ -2,5 +2,5 @@ var global = "global"
|
||||
// TODO: Forward reference to global declared after use.
|
||||
|
||||
fn {
|
||||
IO.write(global) // expect: global
|
||||
IO.print(global) // expect: global
|
||||
}.call
|
||||
|
||||
@@ -3,11 +3,11 @@ var global = "global"
|
||||
|
||||
class Foo {
|
||||
method {
|
||||
IO.write(global)
|
||||
IO.print(global)
|
||||
}
|
||||
|
||||
static classMethod {
|
||||
IO.write(global)
|
||||
IO.print(global)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user