summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-02-25 16:00:44 +0800
committerJohn Hodge <tpg@mutabah.net>2016-02-25 16:00:44 +0800
commit387a8358dd42355fc88a0b8c4779a0e2b0296d32 (patch)
tree91f325fd3d0ac176fb1e0b1262429a7c5b52ad27 /src
parentd87ee8e9cf5e867aea7f5dba58781993f35d508e (diff)
downloadmrust-387a8358dd42355fc88a0b8c4779a0e2b0296d32.tar.gz
Parse/use - Fix parsing of braces and renames
Diffstat (limited to 'src')
-rw-r--r--src/parse/root.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/parse/root.cpp b/src/parse/root.cpp
index 5706d958..aa3b78d7 100644
--- a/src/parse/root.cpp
+++ b/src/parse/root.cpp
@@ -1024,17 +1024,28 @@ void Parse_Use_Set(TokenStream& lex, const AST::Path& base_path, ::std::function
Token tok;
do {
-
+ AST::Path path;
+ ::std::string name;
if( GET_TOK(tok, lex) == TOK_RWORD_SELF ) {
- fcn(base_path, base_path[base_path.size()-1].name());
+ path = ::AST::Path(base_path);
+ name = base_path[base_path.size()-1].name();
}
else if( tok.type() == TOK_BRACE_CLOSE ) {
break ;
}
else {
CHECK_TOK(tok, TOK_IDENT);
- fcn(base_path + AST::PathNode(tok.str(), {}), tok.str());
+ path = base_path + AST::PathNode(tok.str(), {});
+ name = mv$(tok.str());
+ }
+ if( GET_TOK(tok, lex) == TOK_RWORD_AS ) {
+ GET_CHECK_TOK(tok, lex, TOK_IDENT);
+ name = mv$(tok.str());
+ }
+ else {
+ lex.putback(tok);
}
+ fcn(mv$(path), mv$(name));
} while( GET_TOK(tok, lex) == TOK_COMMA );
lex.putback(tok);
}