1
Fork 0

update syntax to include a slash

This commit is contained in:
Niko Matsakis 2012-04-19 20:05:50 -07:00
parent 3c995fb8f3
commit 3d6c79109e
9 changed files with 22 additions and 17 deletions

View file

@ -2249,7 +2249,12 @@ fn parse_item_type(p: parser, attrs: [ast::attribute]) -> @ast::item {
} }
fn parse_region_param(p: parser) -> ast::region_param { fn parse_region_param(p: parser) -> ast::region_param {
if eat(p, token::BINOP(token::AND)) {ast::rp_self} else {ast::rp_none} if eat(p, token::BINOP(token::SLASH)) {
expect(p, token::BINOP(token::AND));
ast::rp_self
} else {
ast::rp_none
}
} }
fn parse_item_enum(p: parser, attrs: [ast::attribute]) -> @ast::item { fn parse_item_enum(p: parser, attrs: [ast::attribute]) -> @ast::item {

View file

@ -1407,7 +1407,7 @@ fn print_bounds(s: ps, bounds: @[ast::ty_param_bound]) {
fn print_region_param(s: ps, rp: ast::region_param) { fn print_region_param(s: ps, rp: ast::region_param) {
alt rp { alt rp {
ast::rp_self { word(s.s, "&") } ast::rp_self { word(s.s, "/&") }
ast::rp_none { } ast::rp_none { }
} }
} }

View file

@ -2,7 +2,7 @@ use std;
import std::arena; import std::arena;
import std::arena::arena; import std::arena::arena;
enum tree& { nil, node(&tree, &tree, int), } enum tree/& { nil, node(&tree, &tree, int), }
fn item_check(t: &tree) -> int { fn item_check(t: &tree) -> int {
alt *t { alt *t {

View file

@ -1,4 +1,4 @@
enum ast& { enum ast/& {
num(uint), num(uint),
add(&ast, &ast) add(&ast, &ast)
} }

View file

@ -10,15 +10,15 @@ enum no2 {
x2(&foo.uint) //! ERROR named regions other than `self` are not allowed as part of a type declaration x2(&foo.uint) //! ERROR named regions other than `self` are not allowed as part of a type declaration
} }
enum yes0& { enum yes0/& {
x3(&uint) x3(&uint)
} }
enum yes1& { enum yes1/& {
x4(&self.uint) x4(&self.uint)
} }
enum yes2& { enum yes2/& {
x5(&foo.uint) //! ERROR named regions other than `self` are not allowed as part of a type declaration x5(&foo.uint) //! ERROR named regions other than `self` are not allowed as part of a type declaration
} }

View file

@ -7,13 +7,13 @@ resource no1(x: &self.uint) { //! ERROR to use region types here, the containing
resource no2(x: &foo.uint) { //! ERROR named regions other than `self` are not allowed as part of a type declaration resource no2(x: &foo.uint) { //! ERROR named regions other than `self` are not allowed as part of a type declaration
} }
resource yes0&(x: &uint) { resource yes0/&(x: &uint) {
} }
resource yes1&(x: &self.uint) { resource yes1/&(x: &self.uint) {
} }
resource yes2&(x: &foo.uint) { //! ERROR named regions other than `self` are not allowed as part of a type declaration resource yes2/&(x: &foo.uint) { //! ERROR named regions other than `self` are not allowed as part of a type declaration
} }
fn main() {} fn main() {}

View file

@ -10,15 +10,15 @@ type item_ty_no2 = {
x: &foo.uint //! ERROR named regions other than `self` are not allowed as part of a type declaration x: &foo.uint //! ERROR named regions other than `self` are not allowed as part of a type declaration
}; };
type item_ty_yes0& = { type item_ty_yes0/& = {
x: &uint x: &uint
}; };
type item_ty_yes1& = { type item_ty_yes1/& = {
x: &self.uint x: &self.uint
}; };
type item_ty_yes2& = { type item_ty_yes2/& = {
x: &foo.uint //! ERROR named regions other than `self` are not allowed as part of a type declaration x: &foo.uint //! ERROR named regions other than `self` are not allowed as part of a type declaration
}; };

View file

@ -2,11 +2,11 @@ import libc, sys, unsafe;
enum arena = (); enum arena = ();
type bcx& = { type bcx/& = {
fcx: &fcx fcx: &fcx
}; };
type fcx& = { type fcx/& = {
arena: &arena, arena: &arena,
ccx: &ccx ccx: &ccx
}; };

View file

@ -2,11 +2,11 @@ import libc, sys, unsafe;
enum arena = (); enum arena = ();
type bcx& = { type bcx/& = {
fcx: &fcx fcx: &fcx
}; };
type fcx& = { type fcx/& = {
arena: &arena, arena: &arena,
ccx: &ccx ccx: &ccx
}; };