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:
@@ -0,0 +1,18 @@
|
||||
// One byte UTF-8 Sequences.
|
||||
IO.print("\u0041") // expect: A
|
||||
IO.print("\u007e") // expect: ~
|
||||
|
||||
// Two byte sequences.
|
||||
IO.print("\u00b6") // expect: ¶
|
||||
IO.print("\u00de") // expect: Þ
|
||||
|
||||
// Three byte sequences.
|
||||
IO.print("\u0950") // expect: ॐ
|
||||
IO.print("\u0b83") // expect: ஃ
|
||||
|
||||
// Capitalized hex.
|
||||
IO.print("\u00B6") // expect: ¶
|
||||
IO.print("\u00DE") // expect: Þ
|
||||
|
||||
// TODO: Missing digits in escape.
|
||||
// TODO: Syntax for Unicode escapes > 0xffff?
|
||||
Reference in New Issue
Block a user