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
+14 -14
View File
@@ -1,22 +1,22 @@
IO.write(~0) // expect: 4294967295
IO.write(~1) // expect: 4294967294
IO.write(~23) // expect: 4294967272
IO.print(~0) // expect: 4294967295
IO.print(~1) // expect: 4294967294
IO.print(~23) // expect: 4294967272
// Max u32 value.
IO.write(~4294967295) // expect: 0
IO.print(~4294967295) // expect: 0
// Past max u32 value.
IO.write(~4294967296) // expect: 4294967295
IO.print(~4294967296) // expect: 4294967295
// Negative numbers.
IO.write(~-1) // expect: 0
IO.write(~-123) // expect: 122
IO.write(~-4294967294) // expect: 4294967293
IO.write(~-4294967295) // expect: 4294967294
IO.write(~-4294967296) // expect: 4294967295
IO.print(~-1) // expect: 0
IO.print(~-123) // expect: 122
IO.print(~-4294967294) // expect: 4294967293
IO.print(~-4294967295) // expect: 4294967294
IO.print(~-4294967296) // expect: 4294967295
// Floating point values.
IO.write(~1.23) // expect: 4294967294
IO.write(~0.00123) // expect: 4294967295
IO.write(~345.67) // expect: 4294966950
IO.write(~-12.34) // expect: 11
IO.print(~1.23) // expect: 4294967294
IO.print(~0.00123) // expect: 4294967295
IO.print(~345.67) // expect: 4294966950
IO.print(~-12.34) // expect: 11