Clean up text handling a bit:

- Rename IO.write -> IO.print.
- Make IO.write not print a newline.
- Support \u Unicode escapes in strings.
This commit is contained in:
Bob Nystrom
2014-01-05 12:27:12 -08:00
parent 870f3b8b93
commit b979272305
159 changed files with 1690 additions and 1599 deletions
+8 -8
View File
@@ -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
+2 -2
View File
@@ -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
View File
@@ -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".
+3 -3
View File
@@ -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