14 #include "llvm/Support/CommandLine.h"
15 #include "llvm/Support/Program.h"
21 llvm::cl::opt<JSONStreamStyle> inputStyle{
23 llvm::cl::desc(
"Input JSON stream encoding"),
25 "usual LSP protocol"),
27 "messages delimited by `// -----` lines, "
28 "with // comment support")),
32 llvm::cl::opt<bool> litTest{
35 "Abbreviation for -input-style=delimited -pretty -log=verbose. "
36 "Intended to simplify lit tests"),
37 llvm::cl::init(
false),
39 llvm::cl::opt<Logger::Level> logLevel{
41 llvm::cl::desc(
"Verbosity of log messages written to stderr"),
45 "High level execution tracing"),
49 llvm::cl::opt<bool> prettyPrint{
51 llvm::cl::desc(
"Pretty-print JSON output"),
52 llvm::cl::init(
false),
54 llvm::cl::list<std::string> extraIncludeDirs(
55 "pdll-extra-dir", llvm::cl::desc(
"Extra directory of include files"),
56 llvm::cl::value_desc(
"directory"), llvm::cl::Prefix);
57 llvm::cl::list<std::string> compilationDatabases(
58 "pdll-compilation-database",
59 llvm::cl::desc(
"Compilation YAML databases containing additional "
60 "compilation information for .pdll files"));
62 llvm::cl::ParseCommandLineOptions(argc, argv,
"PDLL LSP Language Server");
74 llvm::sys::ChangeStdinToBinary();
75 JSONTransport transport(stdin, llvm::outs(), inputStyle, prettyPrint);
static llvm::ManagedStatic< PassManagerOptions > options
A transport class that performs the JSON-RPC communication with the LSP client.
static void setLogLevel(Level logLevel)
Set the severity level of the logger.
This class implements all of the PDLL related functionality necessary for a language server.
llvm::LogicalResult runPdllLSPServer(PDLLServer &server, JSONTransport &transport)
Run the main loop of the LSP server using the given PDLL server and transport.
@ Delimited
Messages are delimited by a '// --—' line. Comment lines start with //.
@ Standard
Encoding per the LSP specification, with mandatory Content-Length header.
Include the generated interface declarations.
llvm::LogicalResult MlirPdllLspServerMain(int argc, char **argv)
Implementation for tools like mlir-pdll-lsp-server.