@@ -658,8 +658,6 @@ static const std::string COMMENT_END("*/");
658658
659659void simplecpp::TokenList::readfile (Stream &stream, const std::string &filename, OutputList *outputList)
660660{
661- std::stack<simplecpp::Location> loc;
662-
663661 unsigned int multiline = 0U ;
664662
665663 const Token *oldLastToken = nullptr ;
@@ -705,26 +703,15 @@ void simplecpp::TokenList::readfile(Stream &stream, const std::string &filename,
705703 if (!llTok->next )
706704 continue ;
707705 if (llNextToken->next ) {
708- // #file "file.c"
709- if (llNextToken->str () == " file" &&
710- llNextToken->next ->str ()[0 ] == ' \" ' )
711- {
712- const Token *strtok = cback ();
713- while (strtok->comment )
714- strtok = strtok->previous ;
715- loc.push (location);
716- location.fileIndex = fileIndex (strtok->str ().substr (1U , strtok->str ().size () - 2U ));
717- location.line = 1U ;
718- }
719706 // TODO: add support for "# 3"
720707 // #3 "file.c"
721708 // #line 3 "file.c"
722- else if ((llNextToken->number &&
723- llNextToken->next ->str ()[0 ] == ' \" ' ) ||
724- (llNextToken->str () == " line" &&
725- llNextToken->next ->number &&
726- llNextToken->next ->next &&
727- llNextToken->next ->next ->str ()[0 ] == ' \" ' ))
709+ if ((llNextToken->number &&
710+ llNextToken->next ->str ()[0 ] == ' \" ' ) ||
711+ (llNextToken->str () == " line" &&
712+ llNextToken->next ->number &&
713+ llNextToken->next ->next &&
714+ llNextToken->next ->next ->str ()[0 ] == ' \" ' ))
728715 {
729716 const Token *strtok = cback ();
730717 while (strtok->comment )
@@ -745,12 +732,6 @@ void simplecpp::TokenList::readfile(Stream &stream, const std::string &filename,
745732 lineDirective (location.fileIndex , std::atol (numtok->str ().c_str ()), location);
746733 }
747734 }
748- // #endfile
749- else if (llNextToken->str () == " endfile" && !loc.empty ())
750- {
751- location = loc.top ();
752- loc.pop ();
753- }
754735 }
755736
756737 continue ;
0 commit comments