Lines Matching defs:N
58 // Tries to parse N into F, returning false if it failed and we couldn't
60 bool parse(Fragment &F, Node &N) {
62 Dict.handle("If", [&](Node &N) { parse(F.If, N); });
63 Dict.handle("CompileFlags", [&](Node &N) { parse(F.CompileFlags, N); });
64 Dict.handle("Index", [&](Node &N) { parse(F.Index, N); });
65 Dict.handle("Style", [&](Node &N) { parse(F.Style, N); });
66 Dict.handle("Diagnostics", [&](Node &N) { parse(F.Diagnostics, N); });
67 Dict.handle("Completion", [&](Node &N) { parse(F.Completion, N); });
68 Dict.handle("Hover", [&](Node &N) { parse(F.Hover, N); });
69 Dict.handle("InlayHints", [&](Node &N) { parse(F.InlayHints, N); });
70 Dict.handle("SemanticTokens", [&](Node &N) { parse(F.SemanticTokens, N); });
71 Dict.parse(N);
72 return !(N.failed() || HadError);
76 void parse(Fragment::IfBlock &F, Node &N) {
82 Dict.handle("PathMatch", [&](Node &N) {
83 if (auto Values = scalarValues(N))
86 Dict.handle("PathExclude", [&](Node &N) {
87 if (auto Values = scalarValues(N))
90 Dict.parse(N);
93 void parse(Fragment::CompileFlagsBlock &F, Node &N) {
95 Dict.handle("Compiler", [&](Node &N) {
96 if (auto Value = scalarValue(N, "Compiler"))
99 Dict.handle("Add", [&](Node &N) {
100 if (auto Values = scalarValues(N))
103 Dict.handle("Remove", [&](Node &N) {
104 if (auto Values = scalarValues(N))
107 Dict.handle("CompilationDatabase", [&](Node &N) {
108 F.CompilationDatabase = scalarValue(N, "CompilationDatabase");
110 Dict.parse(N);
113 void parse(Fragment::StyleBlock &F, Node &N) {
115 Dict.handle("FullyQualifiedNamespaces", [&](Node &N) {
116 if (auto Values = scalarValues(N))
119 Dict.handle("QuotedHeaders", [&](Node &N) {
120 if (auto Values = scalarValues(N))
123 Dict.handle("AngledHeaders", [&](Node &N) {
124 if (auto Values = scalarValues(N))
127 Dict.parse(N);
130 void parse(Fragment::DiagnosticsBlock &F, Node &N) {
132 Dict.handle("Suppress", [&](Node &N) {
133 if (auto Values = scalarValues(N))
136 Dict.handle("UnusedIncludes", [&](Node &N) {
137 F.UnusedIncludes = scalarValue(N, "UnusedIncludes");
139 Dict.handle("MissingIncludes", [&](Node &N) {
140 F.MissingIncludes = scalarValue(N, "MissingIncludes");
142 Dict.handle("Includes", [&](Node &N) { parse(F.Includes, N); });
143 Dict.handle("ClangTidy", [&](Node &N) { parse(F.ClangTidy, N); });
144 Dict.parse(N);
147 void parse(Fragment::DiagnosticsBlock::ClangTidyBlock &F, Node &N) {
149 Dict.handle("Add", [&](Node &N) {
150 if (auto Values = scalarValues(N))
153 Dict.handle("Remove", [&](Node &N) {
154 if (auto Values = scalarValues(N))
157 Dict.handle("CheckOptions", [&](Node &N) {
164 CheckOptDict.parse(N);
166 Dict.handle("FastCheckFilter", [&](Node &N) {
167 if (auto FastCheckFilter = scalarValue(N, "FastCheckFilter"))
170 Dict.parse(N);
173 void parse(Fragment::DiagnosticsBlock::IncludesBlock &F, Node &N) {
175 Dict.handle("IgnoreHeader", [&](Node &N) {
176 if (auto Values = scalarValues(N))
179 Dict.handle("AnalyzeAngledIncludes", [&](Node &N) {
180 if (auto Value = boolValue(N, "AnalyzeAngledIncludes"))
183 Dict.parse(N);
186 void parse(Fragment::IndexBlock &F, Node &N) {
189 [&](Node &N) { F.Background = scalarValue(N, "Background"); });
190 Dict.handle("External", [&](Node &N) {
194 if (N.getType() == Node::NK_Mapping) {
195 parse(External, N);
196 } else if (N.getType() == Node::NK_Scalar ||
197 N.getType() == Node::NK_BlockScalar) {
198 parse(External, *scalarValue(N, "External"));
200 error("External must be either a scalar or a mapping.", N);
204 F.External->Range = N.getSourceRange();
206 Dict.handle("StandardLibrary", [&](Node &N) {
207 if (auto StandardLibrary = boolValue(N, "StandardLibrary"))
210 Dict.parse(N);
224 void parse(Fragment::IndexBlock::ExternalBlock &F, Node &N) {
226 Dict.handle("File", [&](Node &N) { F.File = scalarValue(N, "File"); });
228 [&](Node &N) { F.Server = scalarValue(N, "Server"); });
230 [&](Node &N) { F.MountPoint = scalarValue(N, "MountPoint"); });
231 Dict.parse(N);
234 void parse(Fragment::CompletionBlock &F, Node &N) {
236 Dict.handle("AllScopes", [&](Node &N) {
237 if (auto AllScopes = boolValue(N, "AllScopes"))
240 Dict.handle("ArgumentLists", [&](Node &N) {
241 if (auto ArgumentLists = scalarValue(N, "ArgumentLists"))
244 Dict.parse(N);
247 void parse(Fragment::HoverBlock &F, Node &N) {
249 Dict.handle("ShowAKA", [&](Node &N) {
250 if (auto ShowAKA = boolValue(N, "ShowAKA"))
253 Dict.parse(N);
256 void parse(Fragment::InlayHintsBlock &F, Node &N) {
258 Dict.handle("Enabled", [&](Node &N) {
259 if (auto Value = boolValue(N, "Enabled"))
262 Dict.handle("ParameterNames", [&](Node &N) {
263 if (auto Value = boolValue(N, "ParameterNames"))
266 Dict.handle("DeducedTypes", [&](Node &N) {
267 if (auto Value = boolValue(N, "DeducedTypes"))
270 Dict.handle("Designators", [&](Node &N) {
271 if (auto Value = boolValue(N, "Designators"))
274 Dict.handle("BlockEnd", [&](Node &N) {
275 if (auto Value = boolValue(N, "BlockEnd"))
278 Dict.handle("DefaultArguments", [&](Node &N) {
279 if (auto Value = boolValue(N, "DefaultArguments"))
282 Dict.handle("TypeNameLimit", [&](Node &N) {
283 if (auto Value = uint32Value(N, "TypeNameLimit"))
286 Dict.parse(N);
289 void parse(Fragment::SemanticTokensBlock &F, Node &N) {
291 Dict.handle("DisabledKinds", [&](Node &N) {
292 if (auto Values = scalarValues(N))
295 Dict.handle("DisabledModifiers", [&](Node &N) {
296 if (auto Values = scalarValues(N))
299 Dict.parse(N);
334 void parse(Node &N) const {
335 if (N.getType() != Node::NK_Mapping) {
336 Outer->error(Description + " should be a dictionary", N);
342 for (auto &KV : llvm::cast<MappingNode>(N)) {
400 std::optional<Located<std::string>> scalarValue(Node &N,
403 if (auto *S = llvm::dyn_cast<ScalarNode>(&N))
404 return Located<std::string>(S->getValue(Buf).str(), N.getSourceRange());
405 if (auto *BS = llvm::dyn_cast<BlockScalarNode>(&N))
406 return Located<std::string>(BS->getValue().str(), N.getSourceRange());
407 warning(Desc + " should be scalar", N);
411 std::optional<Located<bool>> boolValue(Node &N, llvm::StringRef Desc) {
412 if (auto Scalar = scalarValue(N, Desc)) {
415 warning(Desc + " should be a boolean", N);
420 std::optional<Located<uint32_t>> uint32Value(Node &N, llvm::StringRef Desc) {
421 if (auto Scalar = scalarValue(N, Desc)) {
427 warning(Desc + " invalid number", N);
432 std::optional<std::vector<Located<std::string>>> scalarValues(Node &N) {
434 if (auto *S = llvm::dyn_cast<ScalarNode>(&N)) {
436 Result.emplace_back(S->getValue(Buf).str(), N.getSourceRange());
437 } else if (auto *S = llvm::dyn_cast<BlockScalarNode>(&N)) {
438 Result.emplace_back(S->getValue().str(), N.getSourceRange());
439 } else if (auto *S = llvm::dyn_cast<SequenceNode>(&N)) {
446 warning("Expected scalar or list of scalars", N);
457 void error(const llvm::Twine &Msg, const Node &N) {
458 return error(Msg, N.getSourceRange());
465 void warning(const llvm::Twine &Msg, const Node &N) {
466 return warning(Msg, N.getSourceRange());
488 if (Node *N = Doc.getRoot()) {
491 Fragment.Source.Location = N->getSourceRange().Start;
494 if (Parser(*SM).parse(Fragment, *N))