@@ -40,24 +40,25 @@ import ast::{_mod, add, alt_check, alt_exhaustive, arg, arm, attribute,
40
40
lit_int_unsuffixed, lit_nil, lit_str, lit_uint, local, m_const,
41
41
m_imm, m_mutbl, mac_, mac_aq, mac_ellipsis, mac_invoc,
42
42
mac_invoc_tt, mac_var, matcher, match_nonterminal, match_seq,
43
- match_tok, method, mode, mt, mul, mutability, named_field, neg,
44
- noreturn, not, pat, pat_box, pat_enum, pat_ident, pat_lit,
45
- pat_range, pat_rec, pat_struct, pat_tup, pat_uniq, pat_wild,
46
- path, private, proto, proto_bare, proto_block, proto_box,
47
- proto_uniq, provided, public, pure_fn, purity, re_anon, re_named,
48
- region, rem, required, ret_style, return_val, self_ty, shl, shr,
49
- stmt, stmt_decl, stmt_expr, stmt_semi, struct_def, struct_field,
50
- struct_variant_kind, subtract, sty_box, sty_by_ref, sty_region,
51
- sty_static, sty_uniq, sty_value, token_tree, trait_method,
52
- trait_ref, tt_delim, tt_seq, tt_tok, tt_nonterminal, ty, ty_,
53
- ty_bot, ty_box, ty_field, ty_fn, ty_infer, ty_mac, ty_method,
54
- ty_nil, ty_param, ty_param_bound, ty_path, ty_ptr, ty_rec,
55
- ty_rptr, ty_tup, ty_u32, ty_uniq, ty_vec, ty_fixed_length,
56
- tuple_variant_kind, unchecked_blk, uniq, unnamed_field,
57
- unsafe_blk, unsafe_fn, variant, view_item, view_item_,
58
- view_item_export, view_item_import, view_item_use, view_path,
59
- view_path_glob, view_path_list, view_path_simple, visibility,
60
- vstore, vstore_box, vstore_fixed, vstore_slice, vstore_uniq} ;
43
+ match_tok, method, mode, module_ns, mt, mul, mutability,
44
+ named_field, neg, noreturn, not, pat, pat_box, pat_enum,
45
+ pat_ident, pat_lit, pat_range, pat_rec, pat_struct, pat_tup,
46
+ pat_uniq, pat_wild, path, private, proto, proto_bare,
47
+ proto_block, proto_box, proto_uniq, provided, public, pure_fn,
48
+ purity, re_anon, re_named, region, rem, required, ret_style,
49
+ return_val, self_ty, shl, shr, stmt, stmt_decl, stmt_expr,
50
+ stmt_semi, struct_def, struct_field, struct_variant_kind,
51
+ subtract, sty_box, sty_by_ref, sty_region, sty_static, sty_uniq,
52
+ sty_value, token_tree, trait_method, trait_ref, tt_delim, tt_seq,
53
+ tt_tok, tt_nonterminal, tuple_variant_kind, ty, ty_, ty_bot,
54
+ ty_box, ty_field, ty_fn, ty_infer, ty_mac, ty_method, ty_nil,
55
+ ty_param, ty_param_bound, ty_path, ty_ptr, ty_rec, ty_rptr,
56
+ ty_tup, ty_u32, ty_uniq, ty_vec, ty_fixed_length, type_value_ns,
57
+ unchecked_blk, uniq, unnamed_field, unsafe_blk, unsafe_fn,
58
+ variant, view_item, view_item_, view_item_export,
59
+ view_item_import, view_item_use, view_path, view_path_glob,
60
+ view_path_list, view_path_simple, visibility, vstore, vstore_box,
61
+ vstore_fixed, vstore_slice, vstore_uniq} ;
61
62
62
63
export file_type;
63
64
export parser;
@@ -3336,6 +3337,14 @@ struct parser {
3336
3337
3337
3338
fn parse_view_path ( ) -> @view_path {
3338
3339
let lo = self . span . lo ;
3340
+
3341
+ let namespace;
3342
+ if self . eat_keyword ( ~"mod ") {
3343
+ namespace = module_ns;
3344
+ } else {
3345
+ namespace = type_value_ns;
3346
+ }
3347
+
3339
3348
let first_ident = self . parse_ident ( ) ;
3340
3349
let mut path = ~[ first_ident] ;
3341
3350
debug ! ( "parsed view_path: %s" , * self . id_to_str( first_ident) ) ;
@@ -3352,7 +3361,8 @@ struct parser {
3352
3361
let path = @{ span: mk_sp ( lo, self . span . hi ) , global: false ,
3353
3362
idents: path, rp: None , types: ~[ ] } ;
3354
3363
return @spanned ( lo, self . span . hi ,
3355
- view_path_simple ( first_ident, path, self . get_id ( ) ) ) ;
3364
+ view_path_simple ( first_ident, path, namespace,
3365
+ self . get_id ( ) ) ) ;
3356
3366
}
3357
3367
3358
3368
token:: MOD_SEP => {
@@ -3400,7 +3410,7 @@ struct parser {
3400
3410
let path = @{ span: mk_sp ( lo, self . span . hi ) , global: false ,
3401
3411
idents: path, rp: None , types: ~[ ] } ;
3402
3412
return @spanned ( lo, self . span . hi ,
3403
- view_path_simple ( last, path, self . get_id ( ) ) ) ;
3413
+ view_path_simple ( last, path, namespace , self . get_id ( ) ) ) ;
3404
3414
}
3405
3415
3406
3416
fn parse_view_paths ( ) -> ~[ @view_path ] {
0 commit comments