Utilities: Rename PreprocessorTest=>cpp-preprocessor

This commit is contained in:
Itamar authored and Andreas Kling committed 2021-08-14 12:40:55 +02:00
1 parent 7d493bbf98
commit 06e47ce7aa
2 files changed
+1 -1

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
/*
* Copyright (c) 2021, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibCore/File.h>
#include <LibCpp/Preprocessor.h>
int main(int, char**)
{
auto file = Core::File::construct("/home/anon/Source/little/other.h");
if (!file->open(Core::OpenMode::ReadOnly)) {
perror("open");
exit(1);
}
auto content = file->read_all();
Cpp::Preprocessor cpp("other.h", StringView { content });
auto tokens = cpp.process_and_lex();
for (auto& token : tokens) {
dbgln("{}", token.to_string());
}
}