mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:58:11 +00:00
cpp-lexer: Port to LibMain :^)
This commit is contained in:
parent
601b60324a
commit
1a81d79705
2 changed files with 6 additions and 2 deletions
|
@ -73,6 +73,7 @@ target_link_libraries(comm LibMain)
|
||||||
target_link_libraries(config LibConfig)
|
target_link_libraries(config LibConfig)
|
||||||
target_link_libraries(copy LibGUI LibMain)
|
target_link_libraries(copy LibGUI LibMain)
|
||||||
target_link_libraries(cp LibMain)
|
target_link_libraries(cp LibMain)
|
||||||
|
target_link_libraries(cpp-lexer LibMain)
|
||||||
target_link_libraries(diff LibDiff)
|
target_link_libraries(diff LibDiff)
|
||||||
target_link_libraries(disasm LibX86)
|
target_link_libraries(disasm LibX86)
|
||||||
target_link_libraries(dmesg LibMain)
|
target_link_libraries(dmesg LibMain)
|
||||||
|
|
|
@ -7,13 +7,14 @@
|
||||||
#include <LibCore/ArgsParser.h>
|
#include <LibCore/ArgsParser.h>
|
||||||
#include <LibCore/File.h>
|
#include <LibCore/File.h>
|
||||||
#include <LibCpp/Lexer.h>
|
#include <LibCpp/Lexer.h>
|
||||||
|
#include <LibMain/Main.h>
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
{
|
{
|
||||||
Core::ArgsParser args_parser;
|
Core::ArgsParser args_parser;
|
||||||
const char* path = nullptr;
|
const char* path = nullptr;
|
||||||
args_parser.add_positional_argument(path, "Cpp File", "cpp-file", Core::ArgsParser::Required::Yes);
|
args_parser.add_positional_argument(path, "Cpp File", "cpp-file", Core::ArgsParser::Required::Yes);
|
||||||
args_parser.parse(argc, argv);
|
args_parser.parse(arguments);
|
||||||
|
|
||||||
auto file = Core::File::construct(path);
|
auto file = Core::File::construct(path);
|
||||||
if (!file->open(Core::OpenMode::ReadOnly)) {
|
if (!file->open(Core::OpenMode::ReadOnly)) {
|
||||||
|
@ -27,4 +28,6 @@ int main(int argc, char** argv)
|
||||||
lexer.lex_iterable([](auto token) {
|
lexer.lex_iterable([](auto token) {
|
||||||
outln("{}", token.to_string());
|
outln("{}", token.to_string());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue