This commit is contained in:
Ethan Mahintorabi 2026-05-29 04:05:34 -03:00 committed by GitHub
commit d3fda29664
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 4 deletions

View File

@ -49,15 +49,25 @@ parseLibertyFile(std::string_view filename,
std::string fn(filename);
gzstream::igzstream stream(fn.c_str());
if (stream.is_open()) {
LibertyParser reader(filename, library_visitor, report);
LibertyScanner scanner(&stream, filename, &reader, report);
LibertyParse parser(&scanner, &reader);
parser.parse();
parseLibertyFile(stream, filename, library_visitor, report);
}
else
throw FileNotReadable(filename);
}
void
parseLibertyFile(std::istream& file_contents,
std::string_view filename,
LibertyGroupVisitor *library_visitor,
Report *report)
{
LibertyParser reader(filename, library_visitor, report);
LibertyScanner scanner(&file_contents, filename, &reader, report);
LibertyParse parser(&scanner, &reader);
parser.parse();
}
LibertyParser::LibertyParser(std::string_view filename,
LibertyGroupVisitor *library_visitor,
Report *report) :

View File

@ -25,6 +25,7 @@
#pragma once
#include <functional>
#include <istream>
#include <string_view>
#include <vector>
#include <map>
@ -277,6 +278,11 @@ public:
virtual void visitVariable(LibertyVariable *variable) = 0;
};
void
parseLibertyFile(std::istream& file_contents,
std::string_view filename,
LibertyGroupVisitor *library_visitor,
Report *report);
void
parseLibertyFile(std::string_view filename,
LibertyGroupVisitor *library_visitor,