70 using ValueTypeID = uint64;
72 using EnumValueID = uint64;
76 using SoftEnumID = uint;
78 using ChainedSubcommandValueID = uint64;
80 using ChainedSubcommandID = uint;
82 using SemanticConstraintID = uchar;
84 using ConstrainedValueID = uint;
86 using ConstrainedValueLookupKey = ::std::pair<uint64, uint>;
88 using CustomStorageGetFn =
void* (*)(
::Command*,
int);
90 using CustomStorageIsSetFn =
bool* (*)(
::Command*,
int);
92 using CommandOverrideFunctor =
93 ::std::function<void(::std::string
const&,
::CommandFlag&, ::CommandPermissionLevel&)>;
94 using ScoreboardScoreAccessor = ::std::function<int(
bool&, ::std::string
const&,
::Actor const&)>;
96 using HardTerminal = ::CommandLexer::TokenType;
98 enum class HardNonTerminal :
int {
104 WildcardInt = 1048581,
106 CompareOperator = 1048583,
108 StandaloneSelection = 1048585,
109 WildcardSelection = 1048586,
110 NonIdSelector = 1048587,
112 ScoresArgs = 1048589,
113 ScoreSelectParam = 1048590,
114 ScoreSelector = 1048591,
115 TagSelector = 1048592,
117 FilePathVal = 1048594,
118 FilePathCont = 1048595,
119 IntegerRangeVal = 1048596,
120 IntegerRangePostVal = 1048597,
121 IntegerRange = 1048598,
122 FullIntegerRange = 1048599,
123 RationalRangeVal = 1048600,
124 RationalRangePostVal = 1048601,
125 RationalRange = 1048602,
126 FullRationalRange = 1048603,
135 HasPermissionArg = 1048612,
136 HasPermissionArgs = 1048613,
137 HasPermissionSelector = 1048614,
138 HasPermissionElement = 1048615,
139 HasPermissionElements = 1048616,
141 HasItemElement = 1048618,
142 HasItemElements = 1048619,
143 HasItemArg = 1048620,
144 HasItemArgs = 1048621,
145 HasItemSelector = 1048622,
146 EquipmentSlotEnum = 1048623,
147 PropertyValue = 1048624,
148 HasPropertyParamValue = 1048625,
149 HasPropertyParamEnumValue = 1048626,
150 HasPropertyArg = 1048627,
151 HasPropertyArgs = 1048628,
152 HasPropertyElement = 1048629,
153 HasPropertyElements = 1048630,
154 HasPropertySelector = 1048631,
160 CoordXFloat = 1048637,
161 CoordYFloat = 1048638,
162 CoordZFloat = 1048639,
164 PositionFloat = 1048641,
165 MessageExp = 1048642,
167 MessageRoot = 1048644,
168 PostSelector = 1048645,
170 RawTextCont = 1048647,
173 JsonObject = 1048650,
174 JsonObjectFields = 1048651,
175 JsonObjectCont = 1048652,
177 JsonArrayValues = 1048654,
178 JsonArrayCont = 1048655,
180 BlockStateKey = 1048657,
181 BlockStateValue = 1048658,
182 BlockStateValues = 1048659,
183 BlockStateArray = 1048660,
184 BlockStateArrayCont = 1048661,
186 SlashCommand = 1048663,
187 CodeBuilderArg = 1048664,
188 CodeBuilderArgs = 1048665,
189 CodeBuilderSelectParam = 1048666,
190 CodeBuilderSelector = 1048667,
197 static int const NonTerminalBit = 0x100000;
198 static int const EnumBit = 0x200000;
199 static int const OptionalBit = 0x400000;
200 static int const FactorizationBit = 0x800000;
201 static int const PostfixBit = 0x1000000;
202 static int const EnumValueBit = 0x2000000;
203 static int const SoftEnumBit = 0x4000000;
207 Symbol(
int val) : mValue(val) {}
212 Symbol(HardNonTerminal data) : mValue(
static_cast<int>(data)) {}
214 Symbol(CommandLexer::TokenType data) : mValue(
static_cast<int>(data)) {}
217 mValue = other.mValue;
221 [[nodiscard]]
inline bool operator==(
Symbol const& other)
const {
return mValue == other.mValue; }
223 uint64 toIndex()
const {
return mValue & 0xffffffffe00fffffull; }
230 uint64 operator()(::std::pair<::CommandRegistry::Symbol, ::CommandRegistry::Symbol>
const&)
const;
237 using SymbolVector = ::std::vector<::CommandRegistry::Symbol>;
240 ::entt::dense_set<::CommandRegistry::Symbol, ::CommandRegistry::SymbolHasher, ::std::equal_to<void>>;
242 using ParseMap = ::std::map<
244 ::entt::dense_set<::CommandRegistry::Symbol, ::CommandRegistry::SymbolHasher, ::std::equal_to<void>>>;
255 ::std::vector<::CommandParameterData> params;
258 ::std::vector<::CommandRegistry::Symbol> paramsSymbol;
267 ::std::string description;
268 ::std::vector<::CommandRegistry::Overload> overloads;
269 ::std::vector<uint> chainedSubcommandIndexes;
270 ::CommandPermissionLevel permissionLevel;
275 int firstFactorization;
336 ::std::unique_ptr<::CommandRegistry::ParseToken> child;
337 ::std::unique_ptr<::CommandRegistry::ParseToken> next;
347 MCAPI ::std::string toString()
const;
351 using ProcessFunction =
357 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> nonTerminal;
363 ::ll::TypedStorage<8, 24, ::std::vector<::CommandRegistry::Symbol>> derivation;
364 ::ll::TypedStorage<4, 8, ::CommandVersion> versions;
380 using RuleIndex = int;
386 ::ll::TypedStorage<4, 4, int> parameterCount;
387 ::ll::TypedStorage<4, 4, int> followingRuleIndex;
388 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> paramSymbol;
396 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> commandSymbol;
406 ::std::vector<::std::string>&
408 using EnumConversionFunction = ::std::function<void(
void*, uint64)>;
417 ::std::vector<::std::pair<uint64, uint64>> values;
433 using ChainedSubcommandConversionFunction = ::std::function<void(
void*, uint64)>;
442 ::std::vector<::std::pair<uint64, uint>> values;
463 ::std::vector<::std::string> mValues;
471 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> mValue;
472 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> mEnum;
473 ::ll::TypedStorage<8, 24, ::std::vector<uchar>> mConstraints;
481 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> x;
482 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> y;
483 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> z;
484 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> dx;
485 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> dy;
486 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> dz;
487 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> r;
488 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> rm;
489 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> rx;
490 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> rxm;
491 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> ry;
492 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> rym;
493 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> l;
494 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> lm;
495 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> c;
496 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> m;
497 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> name;
498 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> type;
499 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> family;
500 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> score;
501 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> tag;
502 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> hasitem;
503 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> haspermission;
504 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> hasproperty;
505 ::ll::TypedStorage<4, 4, ::CommandRegistry::Symbol> codebuilder;
525 ::ll::TypedStorage<4, 4, uint> signatureCount;
526 ::ll::TypedStorage<4, 4, uint> enumValueCount;
527 ::ll::TypedStorage<4, 4, uint> postfixCount;
528 ::ll::TypedStorage<4, 4, uint> enumCount;
529 ::ll::TypedStorage<4, 4, uint> enumLookupCount;
530 ::ll::TypedStorage<4, 4, uint> typeLookupCount;
531 ::ll::TypedStorage<4, 4, uint> factorizationCount;
532 ::ll::TypedStorage<4, 4, uint> optionalCount;
533 ::ll::TypedStorage<4, 4, uint> ruleCount;
534 ::ll::TypedStorage<4, 4, uint> softEnumCount;
535 ::ll::TypedStorage<4, 4, uint> constraintCount;
536 ::ll::TypedStorage<4, 4, uint> chainedSubcommandCount;
537 ::ll::TypedStorage<4, 4, uint> chainedSubcommandValueCount;
538 ::ll::TypedStorage<8, 24, ::std::vector<uint>> enumValuesCount;
539 ::ll::TypedStorage<8, 24, ::std::vector<uint>> constrainedValueCount;
540 ::ll::TypedStorage<8, 24, ::std::vector<uint>> softEnumValuesCount;
556 using PredictTable = ::entt::dense_map<
557 ::std::pair<::CommandRegistry::Symbol, ::CommandRegistry::Symbol>,
560 ::std::equal_to<void>>;
567 ::entt::dense_set<::CommandRegistry::Symbol, ::CommandRegistry::SymbolHasher, ::std::equal_to<void>>>
572 ::entt::dense_set<::CommandRegistry::Symbol, ::CommandRegistry::SymbolHasher, ::std::equal_to<void>>>
576 ::std::pair<::CommandRegistry::Symbol, ::CommandRegistry::Symbol>,
579 ::std::equal_to<void>>
582 ::std::chrono::nanoseconds buildDuration;
590 ::ll::TypedStorage<1, 1, bool> mIsValid;
591 ::ll::TypedStorage<8, 24, ::std::vector<::CommandRegistry::Symbol>> mConstrainedParams;
592 ::ll::TypedStorage<8, 32, ::std::string> mSoftEnumText;
593 ::ll::TypedStorage<8, 32, ::std::string> mSoftEnumEscapeCharExceptions;
594 ::ll::TypedStorage<8, 16, ::std::set<::CommandRegistry::Symbol>> mAlreadyCompletedSymbols;
598 using ParamVisitCallback = ::std::function<
602 using ParseTableMap = ::std::map<uint, ::CommandRegistry::ParseTable>;
608 ::ll::TypedStorage<8, 8, ::CommandRegistry const&> mRegistry;
609 ::ll::TypedStorage<8, 8, ::CommandRegistry::ParseTable const*> mParseTable;
610 ::ll::TypedStorage<8, 40, ::std::deque<::std::pair<::CommandRegistry::Symbol, ::CommandRegistry::ParseToken*>>>
612 ::ll::TypedStorage<8, 32, ::CommandRegistry::LexicalToken> mNext;
613 ::ll::TypedStorage<8, 32, ::std::string> mInput;
614 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::CommandRegistry::ParseToken>> mRoot;
615 ::ll::TypedStorage<8, 32, ::std::string> mError;
616 ::ll::TypedStorage<8, 24, ::std::vector<::std::string>> mErrorParams;
617 ::ll::TypedStorage<4, 4, int> mVersion;
618 ::ll::TypedStorage<1, 1, bool> mGenerateParams;
619 ::ll::TypedStorage<1, 1, bool> mBreakAtEnd;
633 MCAPI
bool _parse(::std::string
const& in);
635 MCAPI ::std::unique_ptr<::CommandSelector<::Actor>>
636 createSelector(::std::string
const& selectorString,
::CommandOrigin const& origin);
637 MCAPI ::std::vector<::std::string> getErrorParams()
const;
639 MCAPI
bool parseCommand(::std::string
const& in);
641 MCAPI
bool parseSelector(::std::string
const& in);
662 ::std::function<void(
::Packet const&)> mNetworkUpdateCallback;
663 ScoreboardScoreAccessor mGetScoreForObjective;
665 ::std::vector<::CommandRegistry::ParseRule> mRules;
666 ::std::map<uint, ::CommandRegistry::ParseTable> mParseTables;
667 ::std::vector<::CommandRegistry::OptionalParameterChain> mOptionals;
668 ::std::vector<::std::string> mEnumValues;
669 ::std::vector<::CommandRegistry::Enum> mEnums;
670 ::std::vector<::std::string> mChainedSubcommandValues;
671 ::std::vector<::CommandRegistry::ChainedSubcommand> mChainedSubcommands;
672 ::std::vector<::CommandRegistry::Factorization> mFactorizations;
673 ::std::vector<::std::string> mPostfixes;
674 ::std::map<::std::string, uint> mEnumLookup;
675 ::std::map<::std::string, uint64> mEnumValueLookup;
676 ::std::map<::std::string, uint> mChainedSubcommandLookup;
677 ::std::map<::std::string, uint64> mChainedSubcommandValueLookup;
678 ::std::vector<::CommandRegistry::Symbol> mCommandSymbols;
679 ::std::map<::std::string, ::CommandRegistry::Signature> mSignatures;
680 ::std::map<::Bedrock::typeid_t<::CommandRegistry>,
int> mTypeLookup;
681 ::std::map<::std::string, ::std::string> mAliases;
682 ::std::vector<::SemanticConstraint> mSemanticConstraints;
683 ::std::map<::SemanticConstraint, uchar> mSemanticConstraintLookup;
684 ::std::vector<::CommandRegistry::ConstrainedValue> mConstrainedValues;
685 ::std::map<::std::pair<uint64, uint>, uint> mConstrainedValueLookup;
686 ::std::vector<::CommandRegistry::SoftEnum> mSoftEnums;
687 ::std::map<::std::string, uint> mSoftEnumLookup;
688 ::std::vector<::CommandRegistry::RegistryState> mStateStack;
690 ::std::unordered_set<int> mSkipOnEpsAutocompleteSymbols;
691 ::std::unordered_set<int> mAllowEmptySymbols;
692 CommandOverrideFunctor mCommandOverrideFunctor;
693 ::std::unique_ptr<::CommandRunStats> mCommandRunStats;
703 std::vector<std::string>& errorParams
706 template <
class E,
class C>
713 std::vector<std::string>& errorParams
716 uint64 getEnumData(
ParseToken const& token)
const {
717 auto& values = mEnums[token.type.toIndex()].values;
718 return std::lower_bound(
721 token.child->type.toIndex(),
722 [](
auto& pair,
auto& child) { return pair.first < child; }
735 MCAPI ::CommandRegistry::Symbol _addChainedSubcommandValuesInternal(
736 ::std::string
const& name,
737 ::std::vector<::std::pair<::std::string, uint>>
const& strings,
745 ::std::vector<::std::string>&
750 MCAPI ::CommandRegistry::Symbol _addChainedSubcommandValuesInternal(
751 ::std::string
const& name,
752 ::std::vector<::std::pair<uint64, uint>>
const& values,
760 ::std::vector<::std::string>&
765 MCAPI ::CommandRegistry::Symbol _addEnumValuesInternal(
766 ::std::string
const& name,
767 ::std::vector<::std::pair<::std::string, uint64>>
const& strings,
775 ::std::vector<::std::string>&
779 MCAPI ::CommandRegistry::Symbol _addEnumValuesInternal(
780 ::std::string
const& name,
781 ::std::vector<::std::pair<uint64, uint64>>
const& values,
789 ::std::vector<::std::string>&
793 MCAPI ::CommandRegistry::Symbol _addFunctionSoftEnum();
795 MCAPI ::std::unique_ptr<::CommandSelector<::Actor>> _createSelector(
799 ::std::string& error,
800 ::std::vector<::std::string>& errorParams
805 MCAPI
bool _matchesEnumConstraintsSet(
809 ::SemanticConstraint requiredConstraints
812 MCAPI
void addChainedSubcommandValuesToExisting(uint index, ::std::vector<::std::pair<uint64, uint>>
const& values);
814 MCAPI
void addEnumValueConstraints(
815 ::std::string
const& enumName,
816 ::std::vector<::std::string>
const& values,
817 ::SemanticConstraint constraints
820 MCAPI
int addEnumValues(::std::string
const& name, ::std::vector<::std::string>
const& values);
822 MCAPI
void addEnumValuesToExisting(uint index, ::std::vector<::std::pair<uint64, uint64>>
const& values);
824 MCAPI ::CommandRegistry::Symbol addPostfix(::std::string
const& name);
828 ::std::vector<::CommandRegistry::Symbol> derivation,
834 MCAPI
void addSemanticConstraint(::SemanticConstraint constraintType);
836 MCAPI
int addSoftEnum(::std::string
const& name, ::std::vector<::std::string> values);
838 MCAPI
void addSoftEnumValues(::std::string
const& enumName, ::std::vector<::std::string> values);
840 MCAPI ::CommandRegistry::Symbol addSoftTerminal(::std::string
const& name);
844 MCAPI
void buildFollowSet(
848 ::std::set<::CommandRegistry::Symbol>& workingSet
851 MCAPI ::CommandRegistry::Symbol buildOptionalRuleChain(
853 ::std::vector<::CommandParameterData>
const& params,
854 ::std::vector<::CommandRegistry::Symbol>
const& symbols
857 MCAPI
void buildParseTable(uint version)
const;
861 MCAPI ::CommandRegistry::Symbol buildRules(
863 ::std::vector<::gsl::not_null<::CommandRegistry::Overload*>>
const& overloads,
870 MCAPI ::std::unique_ptr<::Command> createCommand(
874 ::std::string& error,
875 ::std::vector<::std::string>& errorParams
882 MCAPI ::std::string describe(
884 ::std::string
const& alias,
891 MCAPI ::CommandRegistry::Signature
const* findCommand(::std::string
const&)
const;
893 MCFOLD ::CommandRegistry::Signature* findCommand(::std::string
const& name);
895 MCAPI ::CommandRegistry::Symbol findEnumValue(::std::string
const& name)
const;
897 MCAPI ::CommandRegistry::Symbol findIdentifierInfo(::std::string
const& name)
const;
899 MCAPI ::CommandRegistry::Symbol findPostfix(::std::string
const& input)
const;
901 MCAPI
void fireCommandParseTableTelemetry(
::IMinecraftEventing const& eventing,
bool isServer)
const;
905 MCAPI ::Json::Value generateDocumentationMetadata(
bool generateInternalMetadata)
const;
907 MCAPI ::std::vector<::std::string> getAliases(::std::string
const& command)
const;
909 MCAPI ::std::vector<::std::string> getAlphabeticalLookup(
::CommandOrigin const& origin)
const;
911 MCAPI ::std::string getCommandName(::std::string
const& commandLine)
const;
913 MCAPI ::CommandSyntaxInformation
914 getCommandOverloadSyntaxInformation(
::CommandOrigin const& origin, ::std::string
const& commandName)
const;
924 MCAPI
bool parseSelector(
929 ::std::string& error,
930 ::std::vector<::std::string>& errorParams
933 MCAPI
void registerAlias(::std::string name, ::std::string alias);
935 MCAPI
void registerCommand(
936 ::std::string
const& name,
937 char const* description,
938 ::CommandPermissionLevel requirement,
943 MCAPI
void registerOverload(
946 ::std::function<::std::unique_ptr<::Command>()> allocFn,
947 ::std::vector<::CommandParameterData> params
952 MCAPI
void removeSoftEnumValues(::std::string
const& enumName, ::std::vector<::std::string> values);
954 MCAPI ::AvailableCommandsPacket serializeAvailableCommands()
const;
956 MCAPI
void setCommandRegistrationOverride(CommandOverrideFunctor functor);
958 MCAPI
void setSoftEnumValues(::std::string
const& enumName, ::std::vector<::std::string> values);
972 MCAPI static ::std::string _removeStringQuotes(::std::string
const& str);
974 MCFOLD static ::CommandRegistry::ParseToken*
977 MCAPI static ::CommandRegistry::ParseToken* collapseOn(
983 MCAPI static ::CommandRegistry::ParseToken*
986 MCAPI static ::CommandRegistry::ParseToken* expandExcept(
992 MCAPI static ::CommandRegistry::ParseToken* fold(
998 MCAPI static ::CommandRegistry::ParseToken*
1001 MCAPI
static bool readFloat(
1004 ::std::string& error,
1005 ::std::vector<::std::string>& errorParams
1008 MCAPI
static bool readInt(
1011 ::std::string& error,
1012 ::std::vector<::std::string>& errorParams
1015 MCAPI
static bool readRelativeCoordinate(
1019 bool readIntegerAsCentered,
1020 ::std::string& error,
1021 ::std::vector<::std::string>& errorParams
1024 MCAPI
static bool readString(
1025 ::std::string& value,
1027 ::std::string& error,
1028 ::std::vector<::std::string>& errorParams
1035 MCAPI
static char const*& CODE_STATUS_PROPERTY_NAME();
1037 MCAPI
static char const*& COMMAND_NAME_ENUM_NAME();
1039 MCAPI
static char const*& FUNCTION_NAME_SOFTENUM_NAME();
1041 MCAPI
static char const*& HASITEM_PARAM_DATA();
1043 MCAPI
static char const*& HASITEM_PARAM_ITEM();
1045 MCAPI
static char const*& HASITEM_PARAM_LOCATION();
1047 MCAPI
static char const*& HASITEM_PARAM_QUANTITY();
1049 MCAPI
static char const*& HASITEM_PARAM_SLOT();
1051 MCAPI
static char const*& HASPERMISSIONSTATE_ENUM_DISABLED();
1053 MCAPI
static char const*& HASPERMISSIONSTATE_ENUM_ENABLED();
1055 MCAPI
static char const*& HASPROPERTY_PARAM_PROPERTY_NAME();
1057 MCAPI static ::std::add_lvalue_reference_t<::std::pair<
1064 ::std::vector<::std::string>&
1069 MCAPI
static char const*& TAG_VALUES_SOFTENUM_NAME();
1071 MCAPI
static char const*& UNLOCKABLE_RECIPES_SOFTENUM_NAME();
1077 MCAPI
void* $ctor(
bool isEduMode);