loom

Форк
0
93 строки · 3.3 Кб
1
#include "simodo/inout/token/Tokenizer.h"
2
#include "simodo/inout/log/Logger.h"
3
#include "DocumentOperationFactory.h"
4
#include "fuze/FuzeDocumentOperation.h"
5
#include "script/ScriptSemanticTokenLegend.h"
6

7
using namespace simodo;
8

9
int main(int argc, char *argv[])
10
{
11
    std::string                   semantics_dir;
12
    std::string                   modules_dir;
13
    std::string                   grammar_dir;
14
    inout::Logger::SeverityLevel  log_level = inout::Logger::SeverityLevel::Info;
15
    bool                          save_mode = false;
16
    std::unique_ptr<std::ostream> log_stream;
17
    std::unique_ptr<std::istream> in;
18

19
    if (argc > 1)
20
        semantics_dir = argv[1];
21

22
    if (argc > 2)
23
        modules_dir = argv[2];
24

25
    if (argc > 3)
26
        grammar_dir = argv[3];
27

28
    if (argc > 4)
29
        log_stream = std::make_unique<std::ofstream>(argv[4]);
30

31
    if (argc > 5)
32
    {
33
        if (std::string(argv[5]) == "Debug")
34
            log_level = inout::Logger::SeverityLevel::Debug;
35
        else if (std::string(argv[5]) == "Info")
36
            log_level = inout::Logger::SeverityLevel::Info;
37
        else if (std::string(argv[5]) == "Warning")
38
            log_level = inout::Logger::SeverityLevel::Warning;
39
        else if (std::string(argv[5]) == "Error")
40
            log_level = inout::Logger::SeverityLevel::Error;
41
        else if (std::string(argv[5]) == "Critical")
42
            log_level = inout::Logger::SeverityLevel::Critical;
43
    }
44

45
    if (argc > 6)
46
        save_mode = std::string(argv[6]) == "save";
47

48
    if (argc > 7)
49
#ifdef CROSS_WIN
50
        in = std::make_unique<std::ifstream>(simodo::inout::fromUtf8CharToWChar(argv[7]).c_str());
51
#else
52
        in = std::make_unique<std::ifstream>(argv[7]);
53
#endif
54
    inout::Logger log(log_stream ? *log_stream : std::cerr,
55
                    "SIMODO-LSP", 
56
                    log_level);
57

58
    lsp::ServerCapabilities server_capabilities;
59

60
    server_capabilities.hoverProvider = true;
61
    server_capabilities.documentSymbolProvider = true;
62
    server_capabilities.declarationProvider = true;
63
    server_capabilities.definitionProvider = true;
64
    server_capabilities.completionProvider.triggerCharacters = {u"."};
65
    server_capabilities.completionProvider.resolveProvider = false;
66
    server_capabilities.completionProvider.completionItem.labelDetailsSupport = false;
67
    server_capabilities.semanticTokensProvider.legend = SCRIPT_SEMANTIC_TOKENS_LEGEND;
68

69
    lsp::SimodoCapabilities simodo_capabilities;
70

71
    simodo_capabilities.runnerProvider  = true;
72
    simodo_capabilities.runnerOptions   = {
73
                                            {u"fuze",           SLR_method_report},
74
                                            {u"fuze",           LR1_method_report}, 
75
                                            {u"simodo-script",  execution_report},
76
                                            // {u"teragraph",      execution_report},
77
                                        };
78

79
    DocumentOperationFactory factory(semantics_dir, modules_dir, grammar_dir);
80

81
    lsp::ServerContext server(u"SIMODO",
82
                              server_capabilities,
83
                              simodo_capabilities,
84
                              factory,
85
                              log,
86
                              in ? *in : std::cin,
87
                              std::cout,
88
                              save_mode);
89

90
    server.run();
91

92
    return 0;
93
}

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.