1
Fork 0

Accept prefix notation for writing the types of str/~ and friends.

This commit is contained in:
Michael Sullivan 2012-07-11 23:42:26 -07:00
parent acb86921a6
commit 2ea9c8df0f
37 changed files with 198 additions and 147 deletions

View file

@ -29,7 +29,7 @@ export null;
/// Represents a json value
enum json {
num(float),
string(@str),
string(@str/~),
boolean(bool),
list(@~[json]),
dict(map::hashmap<str, json>),
@ -39,7 +39,7 @@ enum json {
type error = {
line: uint,
col: uint,
msg: @str,
msg: @str/~,
};
/// Serializes a json value into a io::writer
@ -324,7 +324,7 @@ impl parser for parser {
ok(res)
}
fn parse_str() -> result<@str, error> {
fn parse_str() -> result<@str/~, error> {
let mut escape = false;
let mut res = "";
@ -579,7 +579,7 @@ impl of to_json for str {
fn to_json() -> json { string(@copy self) }
}
impl of to_json for @str {
impl of to_json for @str/~ {
fn to_json() -> json { string(self) }
}