Skip to content

Commit b44de0d

Browse files
paulstansifergraydon
authored andcommitted
---
yaml --- r: 35291 b: refs/heads/master c: bd92499 h: refs/heads/master i: 35289: 1a2c6b0 35287: a092e61 v: v3
1 parent a99708a commit b44de0d

File tree

2 files changed

+40
-7
lines changed

2 files changed

+40
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 9814e58815a847e93c42c3987c3659104708f484
2+
refs/heads/master: bd92499c5e65248b3dd2078e2f428f33004cba3d
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: eb8fd119c65c67f3b1b8268cc7341c22d39b7b61
55
refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024

trunk/src/libsyntax/parse/parser.rs

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ use ast::{_mod, add, arg, arm, attribute,
5252
pat_tup, pat_uniq, pat_wild, path, private, Proto, ProtoBare,
5353
ProtoBorrowed, ProtoBox, ProtoUniq, provided, public, pure_fn,
5454
purity, re_static, re_self, re_anon, re_named, region,
55-
rem, required, ret_style,
56-
return_val, self_ty, shl, shr, stmt, stmt_decl, stmt_expr,
57-
stmt_semi, struct_def, struct_field, struct_variant_kind,
58-
subtract, sty_box, sty_by_ref, sty_region, sty_static, sty_uniq,
59-
sty_value, token_tree, trait_method, trait_ref, tt_delim, tt_seq,
60-
tt_tok, tt_nonterminal, tuple_variant_kind, Ty, ty_, ty_bot,
55+
rem, required, ret_style, return_val, self_ty, shl, shr, stmt,
56+
stmt_decl, stmt_expr, stmt_semi, stmt_mac, struct_def,
57+
struct_field, struct_variant_kind, subtract, sty_box, sty_by_ref,
58+
sty_region, sty_static, sty_uniq, sty_value, token_tree,
59+
trait_method, trait_ref, tt_delim, tt_seq, tt_tok,
60+
tt_nonterminal, tuple_variant_kind, Ty, ty_, ty_bot,
6161
ty_box, ty_field, ty_fn, ty_infer, ty_mac, ty_method, ty_nil,
6262
ty_param, ty_param_bound, ty_path, ty_ptr, ty_rec, ty_rptr,
6363
ty_tup, ty_u32, ty_uniq, ty_vec, ty_fixed_length_vec,
@@ -2207,6 +2207,39 @@ impl Parser {
22072207
self.expect_keyword(~"let");
22082208
let decl = self.parse_let();
22092209
return @spanned(lo, decl.span.hi, stmt_decl(decl, self.get_id()));
2210+
} else if is_ident(self.token)
2211+
&& !self.is_any_keyword(copy self.token)
2212+
&& self.look_ahead(1) == token::NOT {
2213+
// Potential trouble: if we allow macros with paths instead of
2214+
// idents, we'd need to look ahead past the whole path here...
2215+
let pth = self.parse_value_path();
2216+
self.bump();
2217+
2218+
let id = if self.token == token::LPAREN {
2219+
token::special_idents::invalid // no special identifier
2220+
} else {
2221+
self.parse_ident()
2222+
};
2223+
2224+
let tts = self.parse_unspanned_seq(
2225+
token::LPAREN, token::RPAREN, seq_sep_none(),
2226+
|p| p.parse_token_tree());
2227+
let hi = self.span.hi;
2228+
2229+
if id == token::special_idents::invalid {
2230+
return @spanned(lo, hi, stmt_mac(
2231+
spanned(lo, hi, mac_invoc_tt(pth, tts))));
2232+
} else {
2233+
// if it has a special ident, it's definitely an item
2234+
return @spanned(lo, hi, stmt_decl(
2235+
@spanned(lo, hi, decl_item(
2236+
self.mk_item(
2237+
lo, hi, id /*id is good here*/,
2238+
item_mac(spanned(lo, hi, mac_invoc_tt(pth, tts))),
2239+
inherited, ~[/*no attrs*/]))),
2240+
self.get_id()));
2241+
}
2242+
22102243
} else {
22112244
let mut item_attrs;
22122245
match self.parse_outer_attrs_or_ext(first_item_attrs) {

0 commit comments

Comments
 (0)