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
+2 -2
View File
@@ -11,6 +11,6 @@ class Foo {
}
var foo = new Foo
IO.write(foo.closeOverGet.call) // expect: Foo field
IO.print(foo.closeOverGet.call) // expect: Foo field
foo.closeOverSet.call
IO.write(foo.closeOverGet.call) // expect: new value
IO.print(foo.closeOverGet.call) // expect: new value
+1 -1
View File
@@ -1,5 +1,5 @@
class Foo {
write { IO.write(_field) }
write { IO.print(_field) }
}
(new Foo).write // expect: null
+5 -5
View File
@@ -8,11 +8,11 @@ class Foo {
}
write {
IO.write(_a)
IO.write(_b)
IO.write(_c)
IO.write(_d)
IO.write(_e)
IO.print(_a)
IO.print(_b)
IO.print(_c)
IO.print(_d)
IO.print(_e)
}
}
+3 -3
View File
@@ -1,17 +1,17 @@
class Outer {
method {
_field = "outer"
IO.write(_field) // expect: outer
IO.print(_field) // expect: outer
class Inner {
method {
_field = "inner"
IO.write(_field) // expect: inner
IO.print(_field) // expect: inner
}
}
(new Inner).method
IO.write(_field) // expect: outer
IO.print(_field) // expect: outer
}
}
+1 -1
View File
@@ -11,7 +11,7 @@ class Node {
_left.write
}
IO.write(_value)
IO.print(_value)
if (_right is Node) {
_right.write
+1 -1
View File
@@ -1,5 +1,5 @@
class Foo {
write { IO.write(_field) } // Compile a use of the field...
write { IO.print(_field) } // Compile a use of the field...
init { _field = "value" } // ...before an assignment to it.
}