From ada4bdefc7da9c81e0006553f218efe56a4349ce Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 3 Jun 2018 13:06:12 +0800 Subject: Standalone MIRI - Fix parse errors from mrustc changes, add recursion limit --- tools/standalone_miri/module_tree.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'tools/standalone_miri/module_tree.cpp') 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(')'); -- cgit v1.2.3