mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-01 14:18:15 +00:00
Utilities: Rename PreprocessorTest=>cpp-preprocessor
This commit is contained in:
23
Userland/Utilities/cpp-preprocessor.cpp
Normal file
23
Userland/Utilities/cpp-preprocessor.cpp
Normal 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());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user