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:
Bob Nystrom
2014-01-05 20:27:12 +00:00
parent e23e0ce6a3
commit c72db7d594
159 changed files with 1690 additions and 1599 deletions
+3 -3
View File
@@ -3,10 +3,10 @@ class Foo {
}
// Calls toString on argument.
IO.write(new Foo) // expect: Foo.toString
IO.print(new Foo) // expect: Foo.toString
// Returns argument.
var result = IO.write(123) // expect: 123
IO.write(result == 123) // expect: true
var result = IO.print(123) // expect: 123
IO.print(result == 123) // expect: true
// TODO: What if toString on argument doesn't return a string?