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:
@@ -1,13 +1,13 @@
|
||||
IO.write(Num == Num) // expect: true
|
||||
IO.write(Num == Bool) // expect: false
|
||||
IO.print(Num == Num) // expect: true
|
||||
IO.print(Num == Bool) // expect: false
|
||||
|
||||
// Not equal to other types.
|
||||
IO.write(Num == 123) // expect: false
|
||||
IO.write(Num == true) // expect: false
|
||||
IO.print(Num == 123) // expect: false
|
||||
IO.print(Num == true) // expect: false
|
||||
|
||||
IO.write(Num != Num) // expect: false
|
||||
IO.write(Num != Bool) // expect: true
|
||||
IO.print(Num != Num) // expect: false
|
||||
IO.print(Num != Bool) // expect: true
|
||||
|
||||
// Not equal to other types.
|
||||
IO.write(Num != 123) // expect: true
|
||||
IO.write(Num != true) // expect: true
|
||||
IO.print(Num != 123) // expect: true
|
||||
IO.print(Num != true) // expect: true
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
class Foo {
|
||||
static sayName {
|
||||
IO.write(Foo.toString)
|
||||
IO.print(Foo.toString)
|
||||
}
|
||||
|
||||
sayName {
|
||||
IO.write(Foo.toString)
|
||||
IO.print(Foo.toString)
|
||||
}
|
||||
|
||||
static toString { return "Foo!" }
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
class Foo {}
|
||||
|
||||
var foo = new Foo
|
||||
IO.write(foo is Foo) // expect: true
|
||||
IO.print(foo is Foo) // expect: true
|
||||
|
||||
// TODO: Test precedence and grammar of what follows "new".
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
class Foo {}
|
||||
|
||||
// A class is a class.
|
||||
IO.write(Foo is Class) // expect: true
|
||||
IO.print(Foo is Class) // expect: true
|
||||
|
||||
// It's metatype is also a class.
|
||||
IO.write(Foo.type is Class) // expect: true
|
||||
IO.print(Foo.type is Class) // expect: true
|
||||
|
||||
// The metatype's metatype is Class.
|
||||
IO.write(Foo.type.type == Class) // expect: true
|
||||
IO.print(Foo.type.type == Class) // expect: true
|
||||
|
||||
Reference in New Issue
Block a user