2021-02-06 15:51:04 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2021, the SerenityOS developers.
|
|
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2021-02-06 15:51:04 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <LibCore/File.h>
|
|
|
|
|
#include <LibCpp/Preprocessor.h>
|
|
|
|
|
|
|
|
|
|
int main(int, char**)
|
|
|
|
|
{
|
|
|
|
|
auto file = Core::File::construct("/home/anon/Source/little/other.h");
|
2021-05-12 13:56:43 +04:30
|
|
|
if (!file->open(Core::OpenMode::ReadOnly)) {
|
2021-02-06 15:51:04 +02:00
|
|
|
perror("open");
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
|
|
|
|
auto content = file->read_all();
|
2021-03-13 10:37:23 +02:00
|
|
|
Cpp::Preprocessor cpp("other.h", StringView { content });
|
2021-08-06 10:29:57 +03:00
|
|
|
auto tokens = cpp.process_and_lex();
|
|
|
|
|
for (auto& token : tokens) {
|
|
|
|
|
dbgln("{}", token.to_string());
|
|
|
|
|
}
|
2021-02-06 15:51:04 +02:00
|
|
|
}
|