LibIDL: Support multiple import base paths for resolving imports

This allows us to specify multiple base paths to look for imported IDL
files in. This will allow us to import IDL files from sources and from
the Build directory (i.e. for generated IDL files).
This commit is contained in:
Luke Wilde 2024-11-14 16:13:44 +00:00 committed by Andreas Kling
commit 300f212044
Notes: github-actions[bot] 2024-11-14 18:51:33 +00:00
4 changed files with 49 additions and 21 deletions

View file

@ -17,7 +17,7 @@ namespace IDL {
class Parser {
public:
Parser(ByteString filename, StringView contents, ByteString import_base_path);
Parser(ByteString filename, StringView contents, Vector<StringView> import_base_paths);
Interface& parse();
Vector<ByteString> imported_files() const;
@ -35,7 +35,7 @@ private:
Yes,
};
Parser(Parser* parent, ByteString filename, StringView contents, ByteString import_base_path);
Parser(Parser* parent, ByteString filename, StringView contents, Vector<StringView> import_base_path);
void assert_specific(char ch);
void assert_string(StringView expected);
@ -68,7 +68,7 @@ private:
ByteString parse_identifier_ending_with_space();
ByteString parse_identifier_ending_with_space_or(auto... possible_terminating_characters);
ByteString import_base_path;
Vector<StringView> import_base_paths;
ByteString filename;
StringView input;
LineTrackingLexer lexer;