mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-04 15:19:42 +00:00
cpp-lexer: Port to LibMain :^)
This commit is contained in:
parent
601b60324a
commit
1a81d79705
Notes:
sideshowbarker
2024-07-17 22:56:14 +09:00
Author: https://github.com/kennethmyhra
Commit: 1a81d79705
Pull-request: https://github.com/SerenityOS/serenity/pull/11101
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/bgianfo ✅
Reviewed-by: https://github.com/creator1creeper1 ✅
Reviewed-by: https://github.com/kleinesfilmroellchen ✅
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