summaryrefslogtreecommitdiff
path: root/tools/standalone_miri/module_tree.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2018-06-03 13:06:12 +0800
committerJohn Hodge <tpg@mutabah.net>2018-06-03 13:06:44 +0800
commitada4bdefc7da9c81e0006553f218efe56a4349ce (patch)
tree51809c1bf87d3f7543c499bade055bf0fd785c2d /tools/standalone_miri/module_tree.cpp
parentb635b94597796728194de0f8d2619f2c1f5ee542 (diff)
downloadmrust-ada4bdefc7da9c81e0006553f218efe56a4349ce.tar.gz
Standalone MIRI - Fix parse errors from mrustc changes, add recursion limit
Diffstat (limited to 'tools/standalone_miri/module_tree.cpp')
-rw-r--r--tools/standalone_miri/module_tree.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/tools/standalone_miri/module_tree.cpp b/tools/standalone_miri/module_tree.cpp
index db5fd495..8beba018 100644
--- a/tools/standalone_miri/module_tree.cpp
+++ b/tools/standalone_miri/module_tree.cpp
@@ -56,7 +56,7 @@ void ModuleTree::load_file(const ::std::string& path)
bool Parser::parse_one()
{
//TRACE_FUNCTION_F("");
- if( lex.next() == "" ) // EOF?
+ if( lex.next() == TokenClass::Eof )
{
return false;
}
@@ -1145,6 +1145,11 @@ RawType Parser::parse_core_type()
}
else if( lex.consume_if('&') )
{
+ if( lex.next() == TokenClass::Lifetime )
+ {
+ // TODO: Handle lifetime names (require them?)
+ lex.consume();
+ }
auto bt = ::HIR::BorrowType::Shared;
if( lex.consume_if("move") )
bt = ::HIR::BorrowType::Move;
@@ -1240,8 +1245,15 @@ RawType Parser::parse_core_type()
::std::vector<::HIR::GenericPath> markers;
while(lex.consume_if('+'))
{
- // TODO: Detect/parse lifetimes?
- markers.push_back(parse_genericpath());
+ if( lex.next() == TokenClass::Lifetime )
+ {
+ // TODO: Include lifetimes in output?
+ lex.consume();
+ }
+ else
+ {
+ markers.push_back(parse_genericpath());
+ }
}
lex.consume_if(')');