Loading system/gd/packet/parser/enum_def.cc +1 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ EnumDef::EnumDef(std::string name, int size) : TypeDef(name, size) {} void EnumDef::AddEntry(std::string name, uint32_t value) { void EnumDef::AddEntry(std::string name, uint64_t value) { if (!util::IsEnumCase(name)) { ERROR() << __func__ << ": Enum " << name << "(" << value << ") should be all uppercase with underscores"; } Loading system/gd/packet/parser/enum_def.h +2 −2 Original line number Diff line number Diff line Loading @@ -30,14 +30,14 @@ class EnumDef : public TypeDef { virtual PacketField* GetNewField(const std::string& name, ParseLocation loc) const; void AddEntry(std::string name, uint32_t value); void AddEntry(std::string name, uint64_t value); bool HasEntry(std::string name) const; virtual Type GetDefinitionType() const override; // data std::map<uint32_t, std::string> constants_; std::map<uint64_t, std::string> constants_; std::set<std::string> entries_; EnumDef* try_from_enum_ = nullptr; Loading system/gd/packet/parser/enum_gen.cc +1 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,7 @@ void EnumGen::GenLogging(std::ostream& stream) { void EnumGen::GenRustDef(std::ostream& stream) { stream << "#[derive(FromPrimitive, ToPrimitive, Debug, Hash, Eq, PartialEq, Clone, Copy)]\n"; stream << "#[repr(u64)]\n"; stream << "pub enum " << e_.name_ << " {"; for (const auto& pair : e_.constants_) { stream << util::ConstantCaseToCamelCase(pair.second) << " = 0x" << std::hex << pair.first << std::dec << ","; Loading system/gd/packet/parser/language_l.ll +2 −2 Original line number Diff line number Diff line Loading @@ -101,12 +101,12 @@ string_literal \".*\" } {intvalue} { yylval->integer = std::stoi(std::string(yytext), nullptr, 10); yylval->integer = std::stoull(std::string(yytext), nullptr, 10); return token::INTEGER; } {hexvalue} { yylval->integer = std::stoi(std::string(yytext), nullptr, 16); yylval->integer = std::stoull(std::string(yytext), nullptr, 16); return token::INTEGER; } Loading system/gd/packet/parser/language_y.yy +5 −5 Original line number Diff line number Diff line Loading @@ -34,12 +34,12 @@ %verbose %union { int integer; uint64_t integer; std::string* string; EnumDef* enum_definition; std::map<int, std::string>* enumeration_values; std::pair<int, std::string>* enumeration_value; std::map<uint64_t, std::string>* enumeration_values; std::pair<uint64_t, std::string>* enumeration_value; PacketDef* packet_definition_value; FieldList* packet_field_definitions; Loading Loading @@ -173,7 +173,7 @@ enumeration_list : enumeration { DEBUG() << "Enumerator with comma\n"; $$ = new std::map<int, std::string>(); $$ = new std::map<uint64_t, std::string>(); $$->insert(std::move(*$1)); delete $1; } Loading Loading @@ -589,7 +589,7 @@ constraint { DEBUG() << "Group with a fixed integer value=" << $1 << " value=" << $3 << "\n"; $$ = new std::pair(*$1, std::variant<int64_t,std::string>($3)); $$ = new std::pair(*$1, std::variant<int64_t,std::string>((int64_t)$3)); delete $1; } | IDENTIFIER '=' IDENTIFIER Loading Loading
system/gd/packet/parser/enum_def.cc +1 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ EnumDef::EnumDef(std::string name, int size) : TypeDef(name, size) {} void EnumDef::AddEntry(std::string name, uint32_t value) { void EnumDef::AddEntry(std::string name, uint64_t value) { if (!util::IsEnumCase(name)) { ERROR() << __func__ << ": Enum " << name << "(" << value << ") should be all uppercase with underscores"; } Loading
system/gd/packet/parser/enum_def.h +2 −2 Original line number Diff line number Diff line Loading @@ -30,14 +30,14 @@ class EnumDef : public TypeDef { virtual PacketField* GetNewField(const std::string& name, ParseLocation loc) const; void AddEntry(std::string name, uint32_t value); void AddEntry(std::string name, uint64_t value); bool HasEntry(std::string name) const; virtual Type GetDefinitionType() const override; // data std::map<uint32_t, std::string> constants_; std::map<uint64_t, std::string> constants_; std::set<std::string> entries_; EnumDef* try_from_enum_ = nullptr; Loading
system/gd/packet/parser/enum_gen.cc +1 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,7 @@ void EnumGen::GenLogging(std::ostream& stream) { void EnumGen::GenRustDef(std::ostream& stream) { stream << "#[derive(FromPrimitive, ToPrimitive, Debug, Hash, Eq, PartialEq, Clone, Copy)]\n"; stream << "#[repr(u64)]\n"; stream << "pub enum " << e_.name_ << " {"; for (const auto& pair : e_.constants_) { stream << util::ConstantCaseToCamelCase(pair.second) << " = 0x" << std::hex << pair.first << std::dec << ","; Loading
system/gd/packet/parser/language_l.ll +2 −2 Original line number Diff line number Diff line Loading @@ -101,12 +101,12 @@ string_literal \".*\" } {intvalue} { yylval->integer = std::stoi(std::string(yytext), nullptr, 10); yylval->integer = std::stoull(std::string(yytext), nullptr, 10); return token::INTEGER; } {hexvalue} { yylval->integer = std::stoi(std::string(yytext), nullptr, 16); yylval->integer = std::stoull(std::string(yytext), nullptr, 16); return token::INTEGER; } Loading
system/gd/packet/parser/language_y.yy +5 −5 Original line number Diff line number Diff line Loading @@ -34,12 +34,12 @@ %verbose %union { int integer; uint64_t integer; std::string* string; EnumDef* enum_definition; std::map<int, std::string>* enumeration_values; std::pair<int, std::string>* enumeration_value; std::map<uint64_t, std::string>* enumeration_values; std::pair<uint64_t, std::string>* enumeration_value; PacketDef* packet_definition_value; FieldList* packet_field_definitions; Loading Loading @@ -173,7 +173,7 @@ enumeration_list : enumeration { DEBUG() << "Enumerator with comma\n"; $$ = new std::map<int, std::string>(); $$ = new std::map<uint64_t, std::string>(); $$->insert(std::move(*$1)); delete $1; } Loading Loading @@ -589,7 +589,7 @@ constraint { DEBUG() << "Group with a fixed integer value=" << $1 << " value=" << $3 << "\n"; $$ = new std::pair(*$1, std::variant<int64_t,std::string>($3)); $$ = new std::pair(*$1, std::variant<int64_t,std::string>((int64_t)$3)); delete $1; } | IDENTIFIER '=' IDENTIFIER Loading