syntax: remove the handling of @str and @[] from the parser completely.
This commit is contained in:
@@ -417,7 +417,6 @@ pub enum Vstore {
|
||||
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
|
||||
pub enum ExprVstore {
|
||||
ExprVstoreUniq, // ~[1,2,3,4]
|
||||
ExprVstoreBox, // @[1,2,3,4]
|
||||
ExprVstoreSlice, // &[1,2,3,4]
|
||||
ExprVstoreMutSlice, // &mut [1,2,3,4]
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ use ast::{ExprField, ExprFnBlock, ExprIf, ExprIndex};
|
||||
use ast::{ExprLit, ExprLogLevel, ExprLoop, ExprMac};
|
||||
use ast::{ExprMethodCall, ExprParen, ExprPath, ExprProc};
|
||||
use ast::{ExprRepeat, ExprRet, ExprStruct, ExprTup, ExprUnary};
|
||||
use ast::{ExprVec, ExprVstore, ExprVstoreSlice, ExprVstoreBox};
|
||||
use ast::{ExprVec, ExprVstore, ExprVstoreSlice};
|
||||
use ast::{ExprVstoreMutSlice, ExprWhile, ExprForLoop, ExternFn, Field, FnDecl};
|
||||
use ast::{ExprVstoreUniq, Onceness, Once, Many};
|
||||
use ast::{ForeignItem, ForeignItemStatic, ForeignItemFn, ForeignMod};
|
||||
@@ -2291,16 +2291,18 @@ impl Parser {
|
||||
self.bump();
|
||||
let e = self.parse_prefix_expr();
|
||||
hi = e.span.hi;
|
||||
// HACK: turn @[...] into a @-vec
|
||||
// HACK: pretending @[] is a (removed) @-vec
|
||||
ex = match e.node {
|
||||
ExprVec(..) |
|
||||
ExprRepeat(..) => {
|
||||
self.obsolete(e.span, ObsoleteManagedVec);
|
||||
ExprVstore(e, ExprVstoreBox)
|
||||
// the above error means that no-one will know we're
|
||||
// lying... hopefully.
|
||||
ExprVstore(e, ExprVstoreUniq)
|
||||
}
|
||||
ExprLit(lit) if lit_is_str(lit) => {
|
||||
self.obsolete(self.last_span, ObsoleteManagedString);
|
||||
ExprVstore(e, ExprVstoreBox)
|
||||
ExprVstore(e, ExprVstoreUniq)
|
||||
}
|
||||
_ => self.mk_unary(UnBox, e)
|
||||
};
|
||||
@@ -2819,34 +2821,11 @@ impl Parser {
|
||||
token::AT => {
|
||||
self.bump();
|
||||
let sub = self.parse_pat();
|
||||
hi = sub.span.hi;
|
||||
// HACK: parse @"..." as a literal of a vstore @str
|
||||
pat = match sub.node {
|
||||
PatLit(e) => {
|
||||
match e.node {
|
||||
ExprLit(lit) if lit_is_str(lit) => {
|
||||
let vst = @Expr {
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
node: ExprVstore(e, ExprVstoreBox),
|
||||
span: mk_sp(lo, hi),
|
||||
};
|
||||
PatLit(vst)
|
||||
}
|
||||
_ => {
|
||||
self.obsolete(self.span, ObsoleteManagedPattern);
|
||||
PatUniq(sub)
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
self.obsolete(self.span, ObsoleteManagedPattern);
|
||||
PatUniq(sub)
|
||||
}
|
||||
};
|
||||
hi = self.last_span.hi;
|
||||
self.obsolete(self.span, ObsoleteManagedPattern);
|
||||
let hi = self.last_span.hi;
|
||||
return @ast::Pat {
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
node: pat,
|
||||
node: sub,
|
||||
span: mk_sp(lo, hi)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1074,7 +1074,6 @@ pub fn print_vstore(s: &mut State, t: ast::Vstore) {
|
||||
pub fn print_expr_vstore(s: &mut State, t: ast::ExprVstore) {
|
||||
match t {
|
||||
ast::ExprVstoreUniq => word(&mut s.s, "~"),
|
||||
ast::ExprVstoreBox => word(&mut s.s, "@"),
|
||||
ast::ExprVstoreSlice => word(&mut s.s, "&"),
|
||||
ast::ExprVstoreMutSlice => {
|
||||
word(&mut s.s, "&");
|
||||
|
||||
Reference in New Issue
Block a user