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:
@@ -11,6 +11,6 @@ class Foo {
|
||||
}
|
||||
|
||||
var foo = new Foo
|
||||
IO.write(foo.closeOverGet.call) // expect: Foo field
|
||||
IO.print(foo.closeOverGet.call) // expect: Foo field
|
||||
foo.closeOverSet.call
|
||||
IO.write(foo.closeOverGet.call) // expect: new value
|
||||
IO.print(foo.closeOverGet.call) // expect: new value
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Foo {
|
||||
write { IO.write(_field) }
|
||||
write { IO.print(_field) }
|
||||
}
|
||||
|
||||
(new Foo).write // expect: null
|
||||
|
||||
@@ -8,11 +8,11 @@ class Foo {
|
||||
}
|
||||
|
||||
write {
|
||||
IO.write(_a)
|
||||
IO.write(_b)
|
||||
IO.write(_c)
|
||||
IO.write(_d)
|
||||
IO.write(_e)
|
||||
IO.print(_a)
|
||||
IO.print(_b)
|
||||
IO.print(_c)
|
||||
IO.print(_d)
|
||||
IO.print(_e)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
class Outer {
|
||||
method {
|
||||
_field = "outer"
|
||||
IO.write(_field) // expect: outer
|
||||
IO.print(_field) // expect: outer
|
||||
|
||||
class Inner {
|
||||
method {
|
||||
_field = "inner"
|
||||
IO.write(_field) // expect: inner
|
||||
IO.print(_field) // expect: inner
|
||||
}
|
||||
}
|
||||
|
||||
(new Inner).method
|
||||
IO.write(_field) // expect: outer
|
||||
IO.print(_field) // expect: outer
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ class Node {
|
||||
_left.write
|
||||
}
|
||||
|
||||
IO.write(_value)
|
||||
IO.print(_value)
|
||||
|
||||
if (_right is Node) {
|
||||
_right.write
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Foo {
|
||||
write { IO.write(_field) } // Compile a use of the field...
|
||||
write { IO.print(_field) } // Compile a use of the field...
|
||||
init { _field = "value" } // ...before an assignment to it.
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user