LeviLamina
Loading...
Searching...
No Matches
CommandRegistry.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/utility/typeid_t.h"
7#include "mc/platform/brstd/copyable_function.h"
8#include "mc/server/commands/CommandFlag.h"
9#include "mc/server/commands/CommandLexer.h"
10#include "mc/server/commands/CommandPermissionLevel.h"
11#include "mc/server/commands/CommandSelector.h"
12#include "mc/server/commands/CommandVersion.h"
13#include "mc/server/commands/SemanticConstraint.h"
14#include "mc/world/actor/selectors/InvertableFilter.h"
15
16// auto generated forward declare list
17// clang-format off
18class Actor;
20class BlockType;
21class Command;
22class CommandOrigin;
24class CommandRunStats;
26class Packet;
31namespace Json { class Value; }
32// clang-format on
33
35public:
36 // CommandRegistry inner types declare
37 // clang-format off
38 struct ChainedSubcommand;
39 struct ConstrainedValue;
40 struct Enum;
41 struct Factorization;
42 struct LexicalToken;
44 struct Overload;
45 struct ParamSymbols;
46 struct ParseRule;
47 struct ParseTable;
48 struct ParseToken;
49 class Parser;
50 struct RegistryState;
51 struct SemanticInfo;
52 struct Signature;
53 struct SoftEnum;
54 class Symbol;
55 struct SymbolHasher;
56 struct SymbolPairHasher;
57 // clang-format on
58
59 // CommandRegistry inner types define
60 using ValueTypeID = uint64;
61
62 using EnumValueID = uint64;
63
64 using EnumID = uint;
65
66 using SoftEnumID = uint;
67
68 using ChainedSubcommandValueID = uint64;
69
70 using ChainedSubcommandID = uint;
71
72 using SemanticConstraintID = uchar;
73
74 using ConstrainedValueID = uint;
75
76 using ConstrainedValueLookupKey = ::std::pair<uint64, uint>;
77
78 using CustomStorageGetFn = void* (*)(::Command*, int);
79
80 using CustomStorageIsSetFn = bool* (*)(::Command*, int);
81
82 using CommandOverrideFunctor =
83 ::std::function<void(::std::string const&, ::CommandFlag&, ::CommandPermissionLevel&)>;
84
85 using ScoreboardScoreAccessor = ::std::function<int(bool&, ::std::string const&, ::Actor const&)>;
86
87 using HardTerminal = ::CommandLexer::TokenType;
88
89 enum class HardNonTerminal : int {
90 Epsilon = 1048576,
91 Int = 1048577,
92 Float = 1048578,
93 Val = 1048579,
94 RVal = 1048580,
95 WildcardInt = 1048581,
96 Operator = 1048582,
97 CompareOperator = 1048583,
98 Selection = 1048584,
99 StandaloneSelection = 1048585,
100 WildcardSelection = 1048586,
101 NonIdSelector = 1048587,
102 ScoresArg = 1048588,
103 ScoresArgs = 1048589,
104 ScoreSelectParam = 1048590,
105 ScoreSelector = 1048591,
106 TagSelector = 1048592,
107 FilePath = 1048593,
108 FilePathVal = 1048594,
109 FilePathCont = 1048595,
110 IntegerRangeVal = 1048596,
111 IntegerRangePostVal = 1048597,
112 IntegerRange = 1048598,
113 FullIntegerRange = 1048599,
114 RationalRangeVal = 1048600,
115 RationalRangePostVal = 1048601,
116 RationalRange = 1048602,
117 FullRationalRange = 1048603,
118 SelArgs = 1048604,
119 Args = 1048605,
120 Arg = 1048606,
121 MArg = 1048607,
122 MValue = 1048608,
123 NameArg = 1048609,
124 TypeArg = 1048610,
125 FamilyArg = 1048611,
126 HasPermissionArg = 1048612,
127 HasPermissionArgs = 1048613,
128 HasPermissionSelector = 1048614,
129 HasPermissionElement = 1048615,
130 HasPermissionElements = 1048616,
131 TagArg = 1048617,
132 HasItemElement = 1048618,
133 HasItemElements = 1048619,
134 HasItemArg = 1048620,
135 HasItemArgs = 1048621,
136 HasItemSelector = 1048622,
137 EquipmentSlotEnum = 1048623,
138 PropertyValue = 1048624,
139 HasPropertyParamValue = 1048625,
140 HasPropertyParamEnumValue = 1048626,
141 HasPropertyArg = 1048627,
142 HasPropertyArgs = 1048628,
143 HasPropertyElement = 1048629,
144 HasPropertyElements = 1048630,
145 HasPropertySelector = 1048631,
146 Id = 1048632,
147 IdCont = 1048633,
148 CoordXInt = 1048634,
149 CoordYInt = 1048635,
150 CoordZInt = 1048636,
151 CoordXFloat = 1048637,
152 CoordYFloat = 1048638,
153 CoordZFloat = 1048639,
154 Position = 1048640,
155 PositionFloat = 1048641,
156 MessageExp = 1048642,
157 Message = 1048643,
158 MessageRoot = 1048644,
159 PostSelector = 1048645,
160 RawText = 1048646,
161 RawTextCont = 1048647,
162 JsonValue = 1048648,
163 JsonField = 1048649,
164 JsonObject = 1048650,
165 JsonObjectFields = 1048651,
166 JsonObjectCont = 1048652,
167 JsonArray = 1048653,
168 JsonArrayValues = 1048654,
169 JsonArrayCont = 1048655,
170 BlockState = 1048656,
171 BlockStateKey = 1048657,
172 BlockStateValue = 1048658,
173 BlockStateValues = 1048659,
174 BlockStateArray = 1048660,
175 BlockStateArrayCont = 1048661,
176 Command = 1048662,
177 SlashCommand = 1048663,
178 CodeBuilderArg = 1048664,
179 CodeBuilderArgs = 1048665,
180 CodeBuilderSelectParam = 1048666,
181 CodeBuilderSelector = 1048667,
182 };
183
184 class Symbol {
185 public:
186 // member variables
187 // NOLINTBEGIN
188 ::ll::TypedStorage<4, 4, int> mValue;
189 // NOLINTEND
190
191 public:
192 // member functions
193 // NOLINTBEGIN
194 MCAPI bool isTerminal() const;
195 // NOLINTEND
196 };
197
198 struct SymbolHasher {};
199
201
203
205
206 using SymbolVector = ::std::vector<::CommandRegistry::Symbol>;
207
208 using SymbolSet =
209 ::entt::dense_set<::CommandRegistry::Symbol, ::CommandRegistry::SymbolHasher, ::std::equal_to<void>>;
210
211 using ParseMap = ::std::map<
213 ::entt::dense_set<::CommandRegistry::Symbol, ::CommandRegistry::SymbolHasher, ::std::equal_to<void>>>;
214
215 struct Overload {
216 public:
217 // Overload inner types define
219
220 public:
221 // member variables
222 // NOLINTBEGIN
223 ::ll::TypedStorage<4, 8, ::CommandVersion> version;
224 ::ll::TypedStorage<8, 64, ::brstd::copyable_function<::std::unique_ptr<::Command>() const>> alloc;
225 ::ll::TypedStorage<8, 24, ::std::vector<::CommandParameterData>> params;
226 ::ll::TypedStorage<4, 4, int> versionOffset;
227 ::ll::TypedStorage<1, 1, bool> isChaining;
228 ::ll::TypedStorage<8, 24, ::std::vector<::CommandRegistry::Symbol>> paramsSymbol;
229 // NOLINTEND
230 };
231
232 struct Signature {
233 public:
234 // member variables
235 // NOLINTBEGIN
236 ::ll::TypedStorage<8, 32, ::std::string> name;
237 ::ll::TypedStorage<8, 32, ::std::string> description;
238 ::ll::TypedStorage<8, 24, ::std::vector<::CommandRegistry::Overload>> overloads;
239 ::ll::TypedStorage<8, 24, ::std::vector<uint>> chainedSubcommandIndexes;
240 ::ll::TypedStorage<1, 1, ::CommandPermissionLevel> permissionLevel;
241 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> commandSymbol;
242 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> commandAliasEnum;
243 ::ll::TypedStorage<2, 2, ::CommandFlag> flags;
244 ::ll::TypedStorage<4, 4, int> firstRule;
245 ::ll::TypedStorage<4, 4, int> firstFactorization;
246 ::ll::TypedStorage<4, 4, int> firstOptional;
247 ::ll::TypedStorage<1, 1, bool> runnable;
248 ::ll::TypedStorage<8, 8, uint64> ruleCounter;
249 // NOLINTEND
250
251 public:
252 // prevent constructor by default
253 Signature& operator=(Signature const&);
254 Signature(Signature const&);
255 Signature();
256
257 public:
258 // member functions
259 // NOLINTBEGIN
261
262 MCAPI ~Signature();
263 // NOLINTEND
264
265 public:
266 // constructor thunks
267 // NOLINTBEGIN
268 MCAPI void* $ctor(::CommandRegistry::Signature&&);
269 // NOLINTEND
270
271 public:
272 // destructor thunk
273 // NOLINTBEGIN
274 MCAPI void $dtor();
275 // NOLINTEND
276 };
277
279 public:
280 // member variables
281 // NOLINTBEGIN
282 ::ll::TypedStorage<8, 8, char const*> mText;
283 ::ll::TypedStorage<4, 4, uint> mLength;
284 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> mType;
285 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> mIdentifierInfo;
286 ::ll::TypedStorage<8, 8, ::CommandRegistry const&> mRegistry;
287 // NOLINTEND
288
289 public:
290 // prevent constructor by default
291 LexicalToken& operator=(LexicalToken const&);
293 LexicalToken();
294
295 public:
296 // member functions
297 // NOLINTBEGIN
298 MCAPI ::CommandRegistry::LexicalToken& operator=(::CommandLexer::Token const& token);
299 // NOLINTEND
300 };
301
302 struct ParseToken {
303 public:
304 // member variables
305 // NOLINTBEGIN
306 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::CommandRegistry::ParseToken>> child;
307 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::CommandRegistry::ParseToken>> next;
308 ::ll::TypedStorage<8, 8, ::CommandRegistry::ParseToken*> parent;
309 ::ll::TypedStorage<8, 8, char const*> text;
310 ::ll::TypedStorage<4, 4, uint> length;
311 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> type;
312 // NOLINTEND
313
314 public:
315 // member functions
316 // NOLINTBEGIN
317 MCAPI ::std::string toString() const;
318 // NOLINTEND
319 };
320
321 using ProcessFunction =
323
324 struct ParseRule {
325 public:
326 // member variables
327 // NOLINTBEGIN
328 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> nonTerminal;
329 ::ll::TypedStorage<
330 8,
331 64,
333 process;
334 ::ll::TypedStorage<8, 24, ::std::vector<::CommandRegistry::Symbol>> derivation;
335 ::ll::TypedStorage<4, 8, ::CommandVersion> versions;
336 // NOLINTEND
337
338 public:
339 // prevent constructor by default
340 ParseRule& operator=(ParseRule const&);
341 ParseRule(ParseRule const&);
342 ParseRule();
343
344 public:
345 // member functions
346 // NOLINTBEGIN
347 MCAPI ::CommandRegistry::ParseRule& operator=(::CommandRegistry::ParseRule&& rhs);
348 // NOLINTEND
349 };
350
351 using RuleIndex = int;
352
354 public:
355 // member variables
356 // NOLINTBEGIN
357 ::ll::TypedStorage<4, 4, int> parameterCount;
358 ::ll::TypedStorage<4, 4, int> followingRuleIndex;
359 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> paramSymbol;
360 // NOLINTEND
361 };
362
364 public:
365 // member variables
366 // NOLINTBEGIN
367 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> commandSymbol;
368 // NOLINTEND
369 };
370
371 using ParseFunction = bool (::CommandRegistry::*)(
372 void*,
374 ::CommandOrigin const&,
375 int,
376 ::std::string&,
377 ::std::vector<::std::string>&
378 ) const;
379
380 using EnumConversionFunction = ::std::function<void(void*, uint64)>;
381
382 struct Enum {
383 public:
384 // member variables
385 // NOLINTBEGIN
386 ::ll::TypedStorage<8, 32, ::std::string> name;
387 ::ll::TypedStorage<2, 2, ::Bedrock::typeid_t<::CommandRegistry>> type;
388 ::ll::TypedStorage<
389 8,
390 8,
391 bool (::CommandRegistry::*)(
392 void*,
394 ::CommandOrigin const&,
395 int,
396 ::std::string&,
397 ::std::vector<::std::string>&
398 ) const>
399 parse;
400 ::ll::TypedStorage<8, 24, ::std::vector<::std::pair<uint64, uint64>>> values;
401 // NOLINTEND
402
403 public:
404 // member functions
405 // NOLINTBEGIN
406 MCAPI ~Enum();
407 // NOLINTEND
408
409 public:
410 // destructor thunk
411 // NOLINTBEGIN
412 MCFOLD void $dtor();
413 // NOLINTEND
414 };
415
416 using ChainedSubcommandConversionFunction = ::std::function<void(void*, uint64)>;
417
419 public:
420 // member variables
421 // NOLINTBEGIN
422 ::ll::TypedStorage<8, 32, ::std::string> name;
423 ::ll::TypedStorage<2, 2, ::Bedrock::typeid_t<::CommandRegistry>> type;
424 ::ll::TypedStorage<
425 8,
426 8,
427 bool (::CommandRegistry::*)(
428 void*,
430 ::CommandOrigin const&,
431 int,
432 ::std::string&,
433 ::std::vector<::std::string>&
434 ) const>
435 parse;
436 ::ll::TypedStorage<8, 24, ::std::vector<::std::pair<uint64, uint>>> values;
437 // NOLINTEND
438
439 public:
440 // member functions
441 // NOLINTBEGIN
442 MCAPI ~ChainedSubcommand();
443 // NOLINTEND
444
445 public:
446 // destructor thunk
447 // NOLINTBEGIN
448 MCFOLD void $dtor();
449 // NOLINTEND
450 };
451
452 struct SoftEnum {
453 public:
454 // member variables
455 // NOLINTBEGIN
456 ::ll::TypedStorage<8, 32, ::std::string> mName;
457 ::ll::TypedStorage<8, 24, ::std::vector<::std::string>> mValues;
458 // NOLINTEND
459 };
460
462 public:
463 // member variables
464 // NOLINTBEGIN
465 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> mValue;
466 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> mEnum;
467 ::ll::TypedStorage<8, 24, ::std::vector<uchar>> mConstraints;
468 // NOLINTEND
469 };
470
472 public:
473 // member variables
474 // NOLINTBEGIN
475 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> x;
476 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> y;
477 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> z;
478 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> dx;
479 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> dy;
480 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> dz;
481 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> r;
482 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> rm;
483 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> rx;
484 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> rxm;
485 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> ry;
486 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> rym;
487 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> l;
488 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> lm;
489 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> c;
490 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> m;
491 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> name;
492 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> type;
493 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> family;
494 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> score;
495 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> tag;
496 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> hasitem;
497 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> haspermission;
498 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> hasproperty;
499 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> codebuilder;
500 // NOLINTEND
501
502 public:
503 // member functions
504 // NOLINTBEGIN
505 MCAPI ParamSymbols();
506 // NOLINTEND
507
508 public:
509 // constructor thunks
510 // NOLINTBEGIN
511 MCAPI void* $ctor();
512 // NOLINTEND
513 };
514
516 public:
517 // member variables
518 // NOLINTBEGIN
519 ::ll::TypedStorage<4, 4, uint> signatureCount;
520 ::ll::TypedStorage<4, 4, uint> enumValueCount;
521 ::ll::TypedStorage<4, 4, uint> postfixCount;
522 ::ll::TypedStorage<4, 4, uint> enumCount;
523 ::ll::TypedStorage<4, 4, uint> enumLookupCount;
524 ::ll::TypedStorage<4, 4, uint> typeLookupCount;
525 ::ll::TypedStorage<4, 4, uint> factorizationCount;
526 ::ll::TypedStorage<4, 4, uint> optionalCount;
527 ::ll::TypedStorage<4, 4, uint> ruleCount;
528 ::ll::TypedStorage<4, 4, uint> softEnumCount;
529 ::ll::TypedStorage<4, 4, uint> constraintCount;
530 ::ll::TypedStorage<4, 4, uint> chainedSubcommandCount;
531 ::ll::TypedStorage<4, 4, uint> chainedSubcommandValueCount;
532 ::ll::TypedStorage<8, 24, ::std::vector<uint>> enumValuesCount;
533 ::ll::TypedStorage<8, 24, ::std::vector<uint>> constrainedValueCount;
534 ::ll::TypedStorage<8, 24, ::std::vector<uint>> softEnumValuesCount;
535 // NOLINTEND
536
537 public:
538 // member functions
539 // NOLINTBEGIN
540 MCAPI ~RegistryState();
541 // NOLINTEND
542
543 public:
544 // destructor thunk
545 // NOLINTBEGIN
546 MCAPI void $dtor();
547 // NOLINTEND
548 };
549
550 using PredictTable = ::entt::dense_map<
551 ::std::pair<::CommandRegistry::Symbol, ::CommandRegistry::Symbol>,
552 int,
554 ::std::equal_to<void>>;
555
556 struct ParseTable {
557 public:
558 // member variables
559 // NOLINTBEGIN
560 ::ll::TypedStorage<
561 8,
562 16,
563 ::std::map<
565 ::entt::dense_set<::CommandRegistry::Symbol, ::CommandRegistry::SymbolHasher, ::std::equal_to<void>>>>
566 first;
567 ::ll::TypedStorage<
568 8,
569 16,
570 ::std::map<
572 ::entt::dense_set<::CommandRegistry::Symbol, ::CommandRegistry::SymbolHasher, ::std::equal_to<void>>>>
573 follow;
574 ::ll::TypedStorage<
575 8,
576 72,
577 ::entt::dense_map<
578 ::std::pair<::CommandRegistry::Symbol, ::CommandRegistry::Symbol>,
579 int,
581 ::std::equal_to<void>>>
582 predict;
583 ::ll::TypedStorage<8, 8, ::std::chrono::nanoseconds> buildDuration;
584 // NOLINTEND
585 };
586
588 public:
589 // member variables
590 // NOLINTBEGIN
591 ::ll::TypedStorage<1, 1, bool> mIsValid;
592 ::ll::TypedStorage<8, 24, ::std::vector<::CommandRegistry::Symbol>> mConstrainedParams;
593 ::ll::TypedStorage<8, 32, ::std::string> mSoftEnumText;
594 ::ll::TypedStorage<8, 32, ::std::string> mSoftEnumEscapeCharExceptions;
595 ::ll::TypedStorage<8, 16, ::std::set<::CommandRegistry::Symbol>> mAlreadyCompletedSymbols;
596 // NOLINTEND
597
598 public:
599 // member functions
600 // NOLINTBEGIN
601 MCAPI ~SemanticInfo();
602 // NOLINTEND
603
604 public:
605 // destructor thunk
606 // NOLINTBEGIN
607 MCAPI void $dtor();
608 // NOLINTEND
609 };
610
611 using ParamVisitCallback = ::std::function<
613
614 using CommandVisitCallback = ::std::function<bool(::CommandRegistry::ParseToken const*, ::CommandOrigin const&)>;
615
616 using ParseTableMap = ::std::map<uint, ::CommandRegistry::ParseTable>;
617
618 class Parser {
619 public:
620 // member variables
621 // NOLINTBEGIN
622 ::ll::TypedStorage<8, 8, ::CommandRegistry const&> mRegistry;
623 ::ll::TypedStorage<8, 8, ::CommandRegistry::ParseTable const*> mParseTable;
624 ::ll::TypedStorage<8, 40, ::std::deque<::std::pair<::CommandRegistry::Symbol, ::CommandRegistry::ParseToken*>>>
625 mStack;
626 ::ll::TypedStorage<8, 32, ::CommandRegistry::LexicalToken> mNext;
627 ::ll::TypedStorage<8, 32, ::std::string> mInput;
628 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::CommandRegistry::ParseToken>> mRoot;
629 ::ll::TypedStorage<8, 32, ::std::string> mError;
630 ::ll::TypedStorage<8, 24, ::std::vector<::std::string>> mErrorParams;
631 ::ll::TypedStorage<4, 4, int> mVersion;
632 ::ll::TypedStorage<1, 1, bool> mGenerateParams;
633 ::ll::TypedStorage<1, 1, bool> mBreakAtEnd;
634 // NOLINTEND
635
636 public:
637 // prevent constructor by default
638 Parser& operator=(Parser const&);
639 Parser(Parser const&);
640 Parser();
641
642 public:
643 // member functions
644 // NOLINTBEGIN
645 MCAPI Parser(::CommandRegistry const& registry, int version);
646
647 MCAPI bool _parse(::std::string const& in);
648
649 MCAPI ::std::unique_ptr<::CommandSelector<::Actor>>
650 createSelector(::std::string const& selectorString, ::CommandOrigin const& origin);
651
652 MCAPI ::std::vector<::std::string> getErrorParams() const;
653
654 MCAPI bool parseCommand(::std::string const& in);
655
656 MCAPI bool parseSelector(::std::string const& in);
657
658 MCAPI ~Parser();
659 // NOLINTEND
660
661 public:
662 // constructor thunks
663 // NOLINTBEGIN
664 MCAPI void* $ctor(::CommandRegistry const& registry, int version);
665 // NOLINTEND
666
667 public:
668 // destructor thunk
669 // NOLINTBEGIN
670 MCAPI void $dtor();
671 // NOLINTEND
672 };
673
674public:
675 // member variables
676 // NOLINTBEGIN
677 ::ll::TypedStorage<8, 64, ::std::function<void(::Packet const&)>> mNetworkUpdateCallback;
678 ::ll::TypedStorage<8, 64, ::std::function<int(bool&, ::std::string const&, ::Actor const&)>> mGetScoreForObjective;
679 ::ll::TypedStorage<1, 1, bool> mIsEduMode;
680 ::ll::TypedStorage<8, 24, ::std::vector<::CommandRegistry::ParseRule>> mRules;
681 ::ll::TypedStorage<8, 16, ::std::map<uint, ::CommandRegistry::ParseTable>> mParseTables;
682 ::ll::TypedStorage<8, 24, ::std::vector<::CommandRegistry::OptionalParameterChain>> mOptionals;
683 ::ll::TypedStorage<8, 24, ::std::vector<::std::string>> mEnumValues;
684 ::ll::TypedStorage<8, 24, ::std::vector<::CommandRegistry::Enum>> mEnums;
685 ::ll::TypedStorage<8, 24, ::std::vector<::std::string>> mChainedSubcommandValues;
686 ::ll::TypedStorage<8, 24, ::std::vector<::CommandRegistry::ChainedSubcommand>> mChainedSubcommands;
687 ::ll::TypedStorage<8, 24, ::std::vector<::CommandRegistry::Factorization>> mFactorizations;
688 ::ll::TypedStorage<8, 24, ::std::vector<::std::string>> mPostfixes;
689 ::ll::TypedStorage<8, 16, ::std::map<::std::string, uint>> mEnumLookup;
690 ::ll::TypedStorage<8, 16, ::std::map<::std::string, uint64>> mEnumValueLookup;
691 ::ll::TypedStorage<8, 16, ::std::map<::std::string, uint>> mChainedSubcommandLookup;
692 ::ll::TypedStorage<8, 16, ::std::map<::std::string, uint64>> mChainedSubcommandValueLookup;
693 ::ll::TypedStorage<8, 24, ::std::vector<::CommandRegistry::Symbol>> mCommandSymbols;
694 ::ll::TypedStorage<8, 16, ::std::map<::std::string, ::CommandRegistry::Signature>> mSignatures;
695 ::ll::TypedStorage<8, 16, ::std::map<::Bedrock::typeid_t<::CommandRegistry>, int>> mTypeLookup;
696 ::ll::TypedStorage<8, 16, ::std::map<::std::string, ::std::string>> mAliases;
697 ::ll::TypedStorage<8, 24, ::std::vector<::SemanticConstraint>> mSemanticConstraints;
698 ::ll::TypedStorage<8, 16, ::std::map<::SemanticConstraint, uchar>> mSemanticConstraintLookup;
699 ::ll::TypedStorage<8, 24, ::std::vector<::CommandRegistry::ConstrainedValue>> mConstrainedValues;
700 ::ll::TypedStorage<8, 16, ::std::map<::std::pair<uint64, uint>, uint>> mConstrainedValueLookup;
701 ::ll::TypedStorage<8, 24, ::std::vector<::CommandRegistry::SoftEnum>> mSoftEnums;
702 ::ll::TypedStorage<8, 16, ::std::map<::std::string, uint>> mSoftEnumLookup;
703 ::ll::TypedStorage<8, 24, ::std::vector<::CommandRegistry::RegistryState>> mStateStack;
704 ::ll::TypedStorage<4, 100, ::CommandRegistry::ParamSymbols> mArgs;
705 ::ll::TypedStorage<8, 64, ::std::unordered_set<int>> mSkipOnEpsAutocompleteSymbols;
706 ::ll::TypedStorage<8, 64, ::std::unordered_set<int>> mAllowEmptySymbols;
707 ::ll::TypedStorage<8, 64, ::std::function<void(::std::string const&, ::CommandFlag&, ::CommandPermissionLevel&)>>
708 mCommandOverrideFunctor;
709 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::CommandRunStats>> mCommandRunStats;
710 // NOLINTEND
711
712public:
713 // prevent constructor by default
715
716public:
717 // member functions
718 // NOLINTBEGIN
719 MCAPI explicit CommandRegistry(bool isEduMode);
720
721 MCAPI ::CommandRegistry::Symbol _addChainedSubcommandValuesInternal(
722 ::std::string const& name,
723 ::std::vector<::std::pair<::std::string, uint>> const& strings,
725 bool (CommandRegistry::*parse)(
726 void*,
728 ::CommandOrigin const&,
729 int,
730 ::std::string&,
731 ::std::vector<::std::string>&
732 ) const,
734 );
735
736 MCAPI ::CommandRegistry::Symbol _addChainedSubcommandValuesInternal(
737 ::std::string const& name,
738 ::std::vector<::std::pair<uint64, uint>> const& values,
740 bool (CommandRegistry::*parse)(
741 void*,
743 ::CommandOrigin const&,
744 int,
745 ::std::string&,
746 ::std::vector<::std::string>&
747 ) const,
749 );
750
751 MCAPI ::CommandRegistry::Symbol _addEnumValuesInternal(
752 ::std::string const& name,
753 ::std::vector<::std::pair<::std::string, uint64>> const& strings,
755 bool (CommandRegistry::*parse)(
756 void*,
758 ::CommandOrigin const&,
759 int,
760 ::std::string&,
761 ::std::vector<::std::string>&
762 ) const
763 );
764
765 MCAPI ::CommandRegistry::Symbol _addEnumValuesInternal(
766 ::std::string const& name,
767 ::std::vector<::std::pair<uint64, uint64>> const& values,
769 bool (CommandRegistry::*parse)(
770 void*,
772 ::CommandOrigin const&,
773 int,
774 ::std::string&,
775 ::std::vector<::std::string>&
776 ) const
777 );
778
779 MCAPI ::CommandRegistry::Symbol _addFunctionSoftEnum();
780
781 MCAPI ::std::unique_ptr<::CommandSelector<::Actor>> _createSelector(
783 ::CommandOrigin const& origin,
784 int version,
785 ::std::string& error,
786 ::std::vector<::std::string>& errorParams
787 ) const;
788
789 MCAPI ::CommandRegistry::Symbol _getConstrainedParamEnumSymbol(::CommandRegistry::Symbol symbol) const;
790
791 MCAPI bool _matchesEnumConstraintsSet(
792 ::CommandRegistry::Symbol const& commandParamSymbol,
793 ::CommandOrigin const& origin,
794 ::CommandRegistry::Symbol const& value,
795 ::SemanticConstraint requiredConstraints
796 ) const;
797
798 MCAPI ::std::vector<::CommandRegistry::Symbol> _reconstructParseStack(
799 ::CommandRegistry::ParseToken const* paramTree,
801 ) const;
802
803 MCAPI ::std::vector<::CommandRegistry::Symbol> _reconstructParseStack(
804 ::std::vector<::CommandParameterData> const& params,
805 uint matchedParams,
806 ::CommandRegistry::ParseToken const* commandParseTree,
808 ) const;
809
810 MCAPI void addChainedSubcommandValuesToExisting(uint index, ::std::vector<::std::pair<uint64, uint>> const& values);
811
812 MCAPI void addEnumValueConstraints(
813 ::std::string const& enumName,
814 ::std::vector<::std::string> const& values,
815 ::SemanticConstraint constraints
816 );
817
818 MCAPI int addEnumValues(::std::string const& name, ::std::vector<::std::string> const& values);
819
820 MCAPI void addEnumValuesToExisting(uint index, ::std::vector<::std::pair<uint64, uint64>> const& values);
821
822 MCAPI ::CommandRegistry::Symbol addPostfix(::std::string const& name);
823
824 MCAPI void addRule(
826 ::std::vector<::CommandRegistry::Symbol> derivation,
828 process,
829 ::CommandVersion versions
830 );
831
832 MCAPI void addSemanticConstraint(::SemanticConstraint constraintType);
833
834 MCAPI int addSoftEnum(::std::string const& name, ::std::vector<::std::string> values);
835
836 MCAPI void addSoftEnumValues(::std::string const& enumName, ::std::vector<::std::string> values);
837
838 MCAPI ::CommandRegistry::Symbol addSoftTerminal(::std::string const& name);
839
840 MCAPI void autoComplete(
842 ::std::string const& cmdLine,
843 ::std::string const& partialMatch,
844 bool newWord,
845 ::CommandOrigin const& origin,
848 ) const;
849
850 MCAPI void autoCompleteCommand(
851 ::std::string const& partialMatch,
852 ::CommandOrigin const& origin,
854 ) const;
855
856 MCAPI void buildFirstSet(::CommandRegistry::ParseTable& table, ::CommandRegistry::Symbol t, uint version) const;
857
858 MCAPI void buildFollowSet(
861 uint version,
862 ::std::set<::CommandRegistry::Symbol>& workingSet
863 ) const;
864
865 MCAPI ::CommandRegistry::Symbol buildOptionalRuleChain(
866 ::CommandRegistry::Signature const& signature,
867 ::std::vector<::CommandParameterData> const& params,
868 ::std::vector<::CommandRegistry::Symbol> const& symbols
869 );
870
871 MCAPI void buildParseTable(uint version) const;
872
873 MCAPI void buildPredictTable(::CommandRegistry::ParseTable& table, uint version) const;
874
875 MCAPI ::CommandRegistry::Symbol buildRules(
877 ::std::vector<::gsl::not_null<::CommandRegistry::Overload*>> const& overloads,
878 uint64 firstParam
879 );
880
881 MCAPI bool
882 buildSelector(::ActorSelectorArgs const& args, ::CommandSelectorBase* output, ::std::string& error) const;
883
884 MCAPI ::std::unique_ptr<::Command> createCommand(
886 ::CommandOrigin const& origin,
887 int version,
888 ::std::string& error,
889 ::std::vector<::std::string>& errorParams
890 ) const;
891
892 MCAPI ::std::string describe(::CommandParameterData const& param) const;
893
894 MCAPI ::std::string describe(::CommandRegistry::Symbol symbol) const;
895
896 MCAPI ::std::string describe(
897 ::CommandRegistry::Signature const& command,
898 ::std::string const& alias,
899 ::CommandRegistry::Overload const& overload,
900 uint highlight,
901 uint* start,
902 uint* length
903 ) const;
904
905 MCAPI ::CommandRegistry::Signature const* findCommand(::std::string const&) const;
906
907 MCFOLD ::CommandRegistry::Signature* findCommand(::std::string const& name);
908
909 MCAPI ::CommandRegistry::Symbol findEnumValue(::std::string const& name) const;
910
911 MCAPI ::CommandRegistry::Symbol findIdentifierInfo(::std::string const& name) const;
912
913 MCAPI ::CommandRegistry::Symbol findPostfix(::std::string const& input) const;
914
915 MCAPI ::CommandRegistry::Symbol findSoftEnum(::std::string const& name) const;
916
917 MCAPI void fireCommandParseTableTelemetry(::IMinecraftEventing const& eventing, bool isServer) const;
918
919 MCAPI void forEachNonTerminal(::std::function<void(::CommandRegistry::Symbol)> func) const;
920
921 MCAPI ::Json::Value generateDocumentationMetadata(bool generateInternalMetadata) const;
922
923 MCAPI ::std::vector<::std::string> getAliases(::std::string const& command) const;
924
925 MCAPI ::std::vector<::std::string> getAlphabeticalLookup(::CommandOrigin const& origin) const;
926
927 MCAPI ::std::unique_ptr<::AutoCompleteInformation> getAutoCompleteOptions(
928 ::CommandOrigin const& origin,
929 ::std::string const& _cmdLine,
930 uint cursorPositionUnsafe
931 ) const;
932
933 MCAPI ::std::string getCommandName(::std::string const& commandLine) const;
934
935 MCAPI ::CommandSyntaxInformation
936 getCommandOverloadSyntaxInformation(::CommandOrigin const& origin, ::std::string const& commandName) const;
937
938 MCAPI ::InvertableFilter<::std::string> getInvertableFilter(::CommandRegistry::ParseToken const& token) const;
939
940 MCAPI ::CommandSyntaxInformation getOverloadSyntaxInformation(
941 ::CommandOrigin const& origin,
942 ::std::string const& cmdLine,
943 uint cursorPosition
944 ) const;
945
946 MCAPI bool isValid(::CommandRegistry::Symbol symbol) const;
947
948 MCAPI void loadRemoteCommands(::AvailableCommandsPacket const& packet);
949
950 MCAPI bool originCanRun(::CommandOrigin const& origin, ::CommandRegistry::Signature const& command) const;
951
952 MCAPI bool originCanRun(::CommandOrigin const& origin, ::CommandRegistry::Overload const& overload) const;
953
954 MCAPI bool originCanRunOverloadWithParam(::CommandOrigin const& origin, ::CommandParameterData const& param) const;
955
956 MCAPI ::std::string parsePartialCommand(
958 ::std::string const& _cmdLine,
959 uint cursorPosition,
960 bool cutLastToken
961 ) const;
962
963 MCAPI bool parseSelector(
966 ::CommandOrigin const& origin,
967 int version,
968 ::std::string& error,
969 ::std::vector<::std::string>& errorParams
970 ) const;
971
972 MCAPI void popState();
973
974 MCAPI void pushState();
975
976 MCAPI void registerAlias(::std::string name, ::std::string alias);
977
978 MCAPI void registerCommand(
979 ::std::string const& name,
980 char const* description,
981 ::CommandPermissionLevel requirement,
982 ::CommandFlag f1,
984 );
985
986 MCAPI void registerOverload(
987 char const* command,
988 ::CommandVersion version,
989 ::std::function<::std::unique_ptr<::Command>()> allocFn,
990 ::std::vector<::CommandParameterData> params
991 );
992
993 MCAPI void registerOverloadInternal(::CommandRegistry::Signature& signature, ::CommandRegistry::Overload& overload);
994
995 MCAPI void removeSoftEnumValues(::std::string const& enumName, ::std::vector<::std::string> values);
996
997 MCAPI ::AvailableCommandsPacket serializeAvailableCommands() const;
998
999 MCAPI void setCommandRegistrationOverride(
1000 ::std::function<void(::std::string const&, ::CommandFlag&, ::CommandPermissionLevel&)> functor
1001 );
1002
1003 MCAPI void setSoftEnumValues(::std::string const& enumName, ::std::vector<::std::string> values);
1004
1005 MCAPI void setupChainedSubcommandOverloadRules(::CommandRegistry::Signature& signature);
1006
1007 MCAPI void setupOverloadRules(::CommandRegistry::Signature& signature);
1008
1009 MCAPI ::std::string symbolToString(::CommandRegistry::Symbol symbol) const;
1010
1011 MCAPI ~CommandRegistry();
1012 // NOLINTEND
1013
1014public:
1015 // static functions
1016 // NOLINTBEGIN
1017 MCAPI static ::BlockType const* _getBlockFromCmdParameters(::std::string const& parameters);
1018
1019 MCAPI static ::std::string _removeStringQuotes(::std::string const& str);
1020
1021 MCFOLD static ::CommandRegistry::ParseToken*
1023
1024 MCAPI static ::CommandRegistry::ParseToken* collapseOn(
1027 ::CommandRegistry::Symbol boundSymbol
1028 );
1029
1030 MCAPI static ::CommandRegistry::ParseToken*
1032
1033 MCAPI static ::CommandRegistry::ParseToken* expandExcept(
1036 ::CommandRegistry::Symbol boundSymbol
1037 );
1038
1039 MCAPI static ::CommandRegistry::ParseToken* fold(
1042 ::CommandRegistry::Symbol boundSymbol
1043 );
1044
1045 MCAPI static ::CommandRegistry::ParseToken*
1047
1048 MCAPI static bool readFloat(
1049 float& value,
1050 ::CommandRegistry::ParseToken const& token,
1051 ::std::string& error,
1052 ::std::vector<::std::string>& errorParams
1053 );
1054
1055 MCAPI static bool readInt(
1056 int& value,
1057 ::CommandRegistry::ParseToken const& token,
1058 ::std::string& error,
1059 ::std::vector<::std::string>& errorParams
1060 );
1061
1062 MCAPI static bool readRelativeCoordinate(
1063 bool& relative,
1064 float& offset,
1065 ::CommandRegistry::ParseToken const& token,
1066 bool readIntegerAsCentered,
1067 ::std::string& error,
1068 ::std::vector<::std::string>& errorParams
1069 );
1070
1071 MCAPI static bool readString(
1072 ::std::string& value,
1073 ::CommandRegistry::ParseToken const& token,
1074 ::std::string& error,
1075 ::std::vector<::std::string>& errorParams
1076 );
1077 // NOLINTEND
1078
1079public:
1080 // static variables
1081 // NOLINTBEGIN
1082 MCAPI static char const*& CODE_STATUS_PROPERTY_NAME();
1083
1084 MCAPI static char const*& COMMAND_NAME_ENUM_NAME();
1085
1086 MCAPI static char const*& FUNCTION_NAME_SOFTENUM_NAME();
1087
1088 MCAPI static char const*& HASITEM_PARAM_DATA();
1089
1090 MCAPI static char const*& HASITEM_PARAM_ITEM();
1091
1092 MCAPI static char const*& HASITEM_PARAM_LOCATION();
1093
1094 MCAPI static char const*& HASITEM_PARAM_QUANTITY();
1095
1096 MCAPI static char const*& HASITEM_PARAM_SLOT();
1097
1098 MCAPI static char const*& HASPERMISSIONSTATE_ENUM_DISABLED();
1099
1100 MCAPI static char const*& HASPERMISSIONSTATE_ENUM_ENABLED();
1101
1102 MCAPI static char const*& HASPROPERTY_PARAM_PROPERTY_NAME();
1103
1104 MCAPI static ::std::add_lvalue_reference_t<::std::pair<
1105 bool (CommandRegistry::*)(
1106 void*,
1108 ::CommandOrigin const&,
1109 int,
1110 ::std::string&,
1111 ::std::vector<::std::string>&
1112 ) const,
1114 ParseRuleSymbols();
1115
1116 MCAPI static char const*& TAG_VALUES_SOFTENUM_NAME();
1117
1118 MCAPI static char const*& UNLOCKABLE_RECIPES_SOFTENUM_NAME();
1119 // NOLINTEND
1120
1121public:
1122 // constructor thunks
1123 // NOLINTBEGIN
1124 MCAPI void* $ctor(bool isEduMode);
1125 // NOLINTEND
1126
1127public:
1128 // destructor thunk
1129 // NOLINTBEGIN
1130 MCAPI void $dtor();
1131 // NOLINTEND
1132};
Definition Actor.h:102
Definition AvailableCommandsPacket.h:17
Definition typeid_t.h:8
Definition BlockState.h:13
Definition BlockType.h:81
Definition CommandOrigin.h:30
Definition CommandParameterData.h:18
Definition CommandRegistry.h:618
Definition CommandRegistry.h:184
Definition CommandRegistry.h:34
Definition CommandRunStats.h:8
Definition CommandSelectorBase.h:24
Definition CommandVersion.h:13
Definition Command.h:17
Definition Packet.h:22
Definition copyable_function.h:8
Definition ActorSelectorArgs.h:21
Definition AutoCompleteInformation.h:5
Definition CommandFlag.h:5
Definition CommandLexer.h:50
Definition CommandRegistry.h:418
Definition CommandRegistry.h:461
Definition CommandRegistry.h:382
Definition CommandRegistry.h:363
Definition CommandRegistry.h:278
Definition CommandRegistry.h:353
Definition CommandRegistry.h:215
Definition CommandRegistry.h:471
Definition CommandRegistry.h:324
Definition CommandRegistry.h:556
Definition CommandRegistry.h:302
Definition CommandRegistry.h:515
Definition CommandRegistry.h:587
Definition CommandRegistry.h:232
Definition CommandRegistry.h:452
Definition CommandRegistry.h:198
Definition CommandRegistry.h:200
Definition CommandSyntaxInformation.h:5
Definition IMinecraftEventing.h:5