From bade043986a4514ee1877a06ae03d29e081b27c9 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Tue, 29 Jun 2021 07:56:08 -0700 Subject: [PATCH 1/2] update reserved names: add finally, fn, match, yield --- php/ext/google/protobuf/names.c | 31 +++---- php/src/Google/Protobuf/Internal/GPBUtil.php | 19 ++-- php/tests/GeneratedClassTest.php | 24 +++++ .../proto/test_reserved_enum_lower.proto | 4 + .../proto/test_reserved_enum_upper.proto | 90 ++++++++++--------- .../test_reserved_enum_value_lower.proto | 90 ++++++++++--------- .../proto/test_reserved_message_lower.proto | 4 + .../proto/test_reserved_message_upper.proto | 4 + .../protobuf/compiler/php/php_generator.cc | 33 +++---- 9 files changed, 173 insertions(+), 126 deletions(-) diff --git a/php/ext/google/protobuf/names.c b/php/ext/google/protobuf/names.c index ff04b3cbc35b..20a36a25ddef 100644 --- a/php/ext/google/protobuf/names.c +++ b/php/ext/google/protobuf/names.c @@ -71,21 +71,22 @@ static void stringsink_uninit(stringsink *sink) { free(sink->ptr); } /* def name -> classname ******************************************************/ const char *const kReservedNames[] = { - "abstract", "and", "array", "as", "break", - "callable", "case", "catch", "class", "clone", - "const", "continue", "declare", "default", "die", - "do", "echo", "else", "elseif", "empty", - "enddeclare", "endfor", "endforeach", "endif", "endswitch", - "endwhile", "eval", "exit", "extends", "final", - "for", "foreach", "function", "global", "goto", - "if", "implements", "include", "include_once", "instanceof", - "insteadof", "interface", "isset", "list", "namespace", - "new", "or", "print", "private", "protected", - "public", "require", "require_once", "return", "static", - "switch", "throw", "trait", "try", "unset", - "use", "var", "while", "xor", "int", - "float", "bool", "string", "true", "false", - "null", "void", "iterable", NULL}; + "abstract", "and", "array", "as", "break", + "callable", "case", "catch", "class", "clone", + "const", "continue", "declare", "default", "die", + "do", "echo", "else", "elseif", "empty", + "enddeclare", "endfor", "endforeach", "endif", "endswitch", + "endwhile", "eval", "exit", "extends", "final", + "finally", "fn" "for", "foreach", "function", + "if", "implements", "include", "include_once", "instanceof", + "global", "goto", "insteadof", "interface", "isset", + "list", "match", "namespace", "new", "or", + "print", "private", "protected", "public", "require", + "require_once", "return", "static", "switch", "throw", + "trait", "try", "unset", "use", "var", + "while", "xor", "yield", "int", "float", + "bool", "string", "true", "false", "null", + "void", "iterable", NULL}; bool is_reserved_name(const char* name) { int i; diff --git a/php/src/Google/Protobuf/Internal/GPBUtil.php b/php/src/Google/Protobuf/Internal/GPBUtil.php index cd65d8b7d453..1dd6645bcd0e 100644 --- a/php/src/Google/Protobuf/Internal/GPBUtil.php +++ b/php/src/Google/Protobuf/Internal/GPBUtil.php @@ -279,15 +279,16 @@ public static function getClassNamePrefix( "do"=>0, "echo"=>0, "else"=>0, "elseif"=>0, "empty"=>0, "enddeclare"=>0, "endfor"=>0, "endforeach"=>0, "endif"=>0, "endswitch"=>0, "endwhile"=>0, "eval"=>0, "exit"=>0, "extends"=>0, - "final"=>0, "for"=>0, "foreach"=>0, "function"=>0, "global"=>0, - "goto"=>0, "if"=>0, "implements"=>0, "include"=>0, - "include_once"=>0, "instanceof"=>0, "insteadof"=>0, "interface"=>0, - "isset"=>0, "list"=>0, "namespace"=>0, "new"=>0, "or"=>0, - "print"=>0, "private"=>0, "protected"=>0, "public"=>0, "require"=>0, - "require_once"=>0, "return"=>0, "static"=>0, "switch"=>0, - "throw"=>0, "trait"=>0, "try"=>0, "unset"=>0, "use"=>0, "var"=>0, - "while"=>0, "xor"=>0, "int"=>0, "float"=>0, "bool"=>0, "string"=>0, - "true"=>0, "false"=>0, "null"=>0, "void"=>0, "iterable"=>0 + "final"=>0, "finally"=>0, "fn"=>0, "for"=>0, "foreach"=>0, + "function"=>0, "global"=>0, "goto"=>0, "if"=>0, "implements"=>0, + "include"=>0, "include_once"=>0, "instanceof"=>0, "insteadof"=>0, + "interface"=>0, "isset"=>0, "list"=>0, "match"=>0, "namespace"=>0, + "new"=>0, "or"=>0, "print"=>0, "private"=>0, "protected"=>0, + "public"=>0, "require"=>0, "require_once"=>0, "return"=>0, + "static"=>0, "switch"=>0, "throw"=>0, "trait"=>0, "try"=>0, + "unset"=>0, "use"=>0, "var"=>0, "while"=>0, "xor"=>0, "yield"=>0, + "int"=>0, "float"=>0, "bool"=>0, "string"=>0, "true"=>0, "false"=>0, + "null"=>0, "void"=>0, "iterable"=>0 ); if (array_key_exists(strtolower($classname), $reserved_words)) { diff --git a/php/tests/GeneratedClassTest.php b/php/tests/GeneratedClassTest.php index 4874cb7e7893..2b15e42c817e 100644 --- a/php/tests/GeneratedClassTest.php +++ b/php/tests/GeneratedClassTest.php @@ -913,6 +913,8 @@ public function testPrefixForReservedWords() $m = new \Lower\PBexit(); $m = new \Lower\PBextends(); $m = new \Lower\PBfinal(); + $m = new \Lower\PBfinally(); + $m = new \Lower\PBfn(); $m = new \Lower\PBfor(); $m = new \Lower\PBforeach(); $m = new \Lower\PBfunction(); @@ -927,6 +929,7 @@ public function testPrefixForReservedWords() $m = new \Lower\PBinterface(); $m = new \Lower\PBisset(); $m = new \Lower\PBlist(); + $m = new \Lower\PBmatch(); $m = new \Lower\PBnamespace(); $m = new \Lower\PBnew(); $m = new \Lower\PBor(); @@ -947,6 +950,7 @@ public function testPrefixForReservedWords() $m = new \Lower\PBvar(); $m = new \Lower\PBwhile(); $m = new \Lower\PBxor(); + $m = new \Lower\PByield(); $m = new \Lower\PBint(); $m = new \Lower\PBfloat(); $m = new \Lower\PBbool(); @@ -987,6 +991,8 @@ public function testPrefixForReservedWords() $m = new \Upper\PBEXIT(); $m = new \Upper\PBEXTENDS(); $m = new \Upper\PBFINAL(); + $m = new \Upper\PBFINALLY(); + $m = new \Upper\PBFN(); $m = new \Upper\PBFOR(); $m = new \Upper\PBFOREACH(); $m = new \Upper\PBFUNCTION(); @@ -1001,6 +1007,7 @@ public function testPrefixForReservedWords() $m = new \Upper\PBINTERFACE(); $m = new \Upper\PBISSET(); $m = new \Upper\PBLIST(); + $m = new \Upper\PBMATCH(); $m = new \Upper\PBNAMESPACE(); $m = new \Upper\PBNEW(); $m = new \Upper\PBOR(); @@ -1021,6 +1028,7 @@ public function testPrefixForReservedWords() $m = new \Upper\PBVAR(); $m = new \Upper\PBWHILE(); $m = new \Upper\PBXOR(); + $m = new \Upper\PBYIELD(); $m = new \Upper\PBINT(); $m = new \Upper\PBFLOAT(); $m = new \Upper\PBBOOL(); @@ -1061,6 +1069,8 @@ public function testPrefixForReservedWords() $m = new \Lower_enum\PBexit(); $m = new \Lower_enum\PBextends(); $m = new \Lower_enum\PBfinal(); + $m = new \Lower_enum\PBfinally(); + $m = new \Lower_enum\PBfn(); $m = new \Lower_enum\PBfor(); $m = new \Lower_enum\PBforeach(); $m = new \Lower_enum\PBfunction(); @@ -1075,6 +1085,7 @@ public function testPrefixForReservedWords() $m = new \Lower_enum\PBinterface(); $m = new \Lower_enum\PBisset(); $m = new \Lower_enum\PBlist(); + $m = new \Lower_enum\PBmatch(); $m = new \Lower_enum\PBnamespace(); $m = new \Lower_enum\PBnew(); $m = new \Lower_enum\PBor(); @@ -1095,6 +1106,7 @@ public function testPrefixForReservedWords() $m = new \Lower_enum\PBvar(); $m = new \Lower_enum\PBwhile(); $m = new \Lower_enum\PBxor(); + $m = new \Lower_enum\PByield(); $m = new \Lower_enum\PBint(); $m = new \Lower_enum\PBfloat(); $m = new \Lower_enum\PBbool(); @@ -1135,6 +1147,8 @@ public function testPrefixForReservedWords() $m = new \Upper_enum\PBEXIT(); $m = new \Upper_enum\PBEXTENDS(); $m = new \Upper_enum\PBFINAL(); + $m = new \Upper_enum\PBFINALLY(); + $m = new \Upper_enum\PBFN(); $m = new \Upper_enum\PBFOR(); $m = new \Upper_enum\PBFOREACH(); $m = new \Upper_enum\PBFUNCTION(); @@ -1149,6 +1163,7 @@ public function testPrefixForReservedWords() $m = new \Upper_enum\PBINTERFACE(); $m = new \Upper_enum\PBISSET(); $m = new \Upper_enum\PBLIST(); + $m = new \Upper_enum\PBMATCH(); $m = new \Upper_enum\PBNAMESPACE(); $m = new \Upper_enum\PBNEW(); $m = new \Upper_enum\PBOR(); @@ -1169,6 +1184,7 @@ public function testPrefixForReservedWords() $m = new \Upper_enum\PBVAR(); $m = new \Upper_enum\PBWHILE(); $m = new \Upper_enum\PBXOR(); + $m = new \Upper_enum\PBYIELD(); $m = new \Upper_enum\PBINT(); $m = new \Upper_enum\PBFLOAT(); $m = new \Upper_enum\PBBOOL(); @@ -1209,6 +1225,8 @@ public function testPrefixForReservedWords() $m = \Lower_enum_value\NotAllowed::PBexit; $m = \Lower_enum_value\NotAllowed::PBextends; $m = \Lower_enum_value\NotAllowed::PBfinal; + $m = \Lower_enum_value\NotAllowed::PBfinally; + $m = \Lower_enum_value\NotAllowed::PBfn; $m = \Lower_enum_value\NotAllowed::PBfor; $m = \Lower_enum_value\NotAllowed::PBforeach; $m = \Lower_enum_value\NotAllowed::PBfunction; @@ -1223,6 +1241,7 @@ public function testPrefixForReservedWords() $m = \Lower_enum_value\NotAllowed::PBinterface; $m = \Lower_enum_value\NotAllowed::PBisset; $m = \Lower_enum_value\NotAllowed::PBlist; + $m = \Lower_enum_value\NotAllowed::PBmatch; $m = \Lower_enum_value\NotAllowed::PBnamespace; $m = \Lower_enum_value\NotAllowed::PBnew; $m = \Lower_enum_value\NotAllowed::PBor; @@ -1243,6 +1262,7 @@ public function testPrefixForReservedWords() $m = \Lower_enum_value\NotAllowed::PBvar; $m = \Lower_enum_value\NotAllowed::PBwhile; $m = \Lower_enum_value\NotAllowed::PBxor; + $m = \Lower_enum_value\NotAllowed::PByield; $m = \Lower_enum_value\NotAllowed::int; $m = \Lower_enum_value\NotAllowed::float; $m = \Lower_enum_value\NotAllowed::bool; @@ -1283,6 +1303,8 @@ public function testPrefixForReservedWords() $m = \Upper_enum_value\NotAllowed::PBEXIT; $m = \Upper_enum_value\NotAllowed::PBEXTENDS; $m = \Upper_enum_value\NotAllowed::PBFINAL; + $m = \Upper_enum_value\NotAllowed::PBFINALLY; + $m = \Upper_enum_value\NotAllowed::PBFN; $m = \Upper_enum_value\NotAllowed::PBFOR; $m = \Upper_enum_value\NotAllowed::PBFOREACH; $m = \Upper_enum_value\NotAllowed::PBFUNCTION; @@ -1297,6 +1319,7 @@ public function testPrefixForReservedWords() $m = \Upper_enum_value\NotAllowed::PBINTERFACE; $m = \Upper_enum_value\NotAllowed::PBISSET; $m = \Upper_enum_value\NotAllowed::PBLIST; + $m = \Upper_enum_value\NotAllowed::PBMATCH; $m = \Upper_enum_value\NotAllowed::PBNAMESPACE; $m = \Upper_enum_value\NotAllowed::PBNEW; $m = \Upper_enum_value\NotAllowed::PBOR; @@ -1317,6 +1340,7 @@ public function testPrefixForReservedWords() $m = \Upper_enum_value\NotAllowed::PBVAR; $m = \Upper_enum_value\NotAllowed::PBWHILE; $m = \Upper_enum_value\NotAllowed::PBXOR; + $m = \Upper_enum_value\NotAllowed::PBYIELD; $m = \Upper_enum_value\NotAllowed::INT; $m = \Upper_enum_value\NotAllowed::FLOAT; $m = \Upper_enum_value\NotAllowed::BOOL; diff --git a/php/tests/proto/test_reserved_enum_lower.proto b/php/tests/proto/test_reserved_enum_lower.proto index d2daeaff4a73..088459ba738c 100644 --- a/php/tests/proto/test_reserved_enum_lower.proto +++ b/php/tests/proto/test_reserved_enum_lower.proto @@ -32,6 +32,8 @@ enum eval { ZERO27 = 0; } enum exit { ZERO28 = 0; } enum extends { ZERO29 = 0; } enum final { ZERO30 = 0; } +enum finally { ZERO30 = 0; } +enum fn { ZERO30 = 0; } enum for { ZERO31 = 0; } enum foreach { ZERO32 = 0; } enum function { ZERO33 = 0; } @@ -46,6 +48,7 @@ enum insteadof { ZERO41 = 0; } enum interface { ZERO42 = 0; } enum isset { ZERO43 = 0; } enum list { ZERO44 = 0; } +enum match { ZERO30 = 0; } enum namespace { ZERO45 = 0; } enum new { ZERO46 = 0; } enum or { ZERO47 = 0; } @@ -66,6 +69,7 @@ enum use { ZERO61 = 0; } enum var { ZERO62 = 0; } enum while { ZERO63 = 0; } enum xor { ZERO64 = 0; } +enum yield { ZERO30 = 0; } enum int { ZERO65 = 0; } enum float { ZERO66 = 0; } enum bool { ZERO67 = 0; } diff --git a/php/tests/proto/test_reserved_enum_upper.proto b/php/tests/proto/test_reserved_enum_upper.proto index a396fea31c9e..a10733291855 100644 --- a/php/tests/proto/test_reserved_enum_upper.proto +++ b/php/tests/proto/test_reserved_enum_upper.proto @@ -32,46 +32,50 @@ enum EVAL { ZERO27 = 0; } enum EXIT { ZERO28 = 0; } enum EXTENDS { ZERO29 = 0; } enum FINAL { ZERO30 = 0; } -enum FOR { ZERO31 = 0; } -enum FOREACH { ZERO32 = 0; } -enum FUNCTION { ZERO33 = 0; } -enum GLOBAL { ZERO34 = 0; } -enum GOTO { ZERO35 = 0; } -enum IF { ZERO36 = 0; } -enum IMPLEMENTS { ZERO37 = 0; } -enum INCLUDE { ZERO38 = 0; } -enum INCLUDE_ONCE { ZERO39 = 0; } -enum INSTANCEOF { ZERO40 = 0; } -enum INSTEADOF { ZERO41 = 0; } -enum INTERFACE { ZERO42 = 0; } -enum ISSET { ZERO43 = 0; } -enum LIST { ZERO44 = 0; } -enum NAMESPACE { ZERO45 = 0; } -enum NEW { ZERO46 = 0; } -enum OR { ZERO47 = 0; } -enum PRINT { ZERO48 = 0; } -enum PRIVATE { ZERO49 = 0; } -enum PROTECTED { ZERO50 = 0; } -enum PUBLIC { ZERO51 = 0; } -enum REQUIRE { ZERO52 = 0; } -enum REQUIRE_ONCE { ZERO53 = 0; } -enum RETURN { ZERO54 = 0; } -enum STATIC { ZERO55 = 0; } -enum SWITCH { ZERO56 = 0; } -enum THROW { ZERO57 = 0; } -enum TRAIT { ZERO58 = 0; } -enum TRY { ZERO59 = 0; } -enum UNSET { ZERO60 = 0; } -enum USE { ZERO61 = 0; } -enum VAR { ZERO62 = 0; } -enum WHILE { ZERO63 = 0; } -enum XOR { ZERO64 = 0; } -enum INT { ZERO65 = 0; } -enum FLOAT { ZERO66 = 0; } -enum BOOL { ZERO67 = 0; } -enum STRING { ZERO68 = 0; } -enum TRUE { ZERO69 = 0; } -enum FALSE { ZERO70 = 0; } -enum NULL { ZERO71 = 0; } -enum VOID { ZERO72 = 0; } -enum ITERABLE { ZERO73 = 0; } +enum FINALLY { ZERO31 = 0; } +enum FN { ZERO32 = 0; } +enum FOR { ZERO33 = 0; } +enum FOREACH { ZERO34 = 0; } +enum FUNCTION { ZERO35 = 0; } +enum GLOBAL { ZERO36 = 0; } +enum GOTO { ZERO37 = 0; } +enum IF { ZERO38 = 0; } +enum IMPLEMENTS { ZERO39 = 0; } +enum INCLUDE { ZERO40 = 0; } +enum INCLUDE_ONCE { ZERO41 = 0; } +enum INSTANCEOF { ZERO42 = 0; } +enum INSTEADOF { ZERO43 = 0; } +enum INTERFACE { ZERO44 = 0; } +enum ISSET { ZERO45 = 0; } +enum LIST { ZERO46 = 0; } +enum MATCH { ZERO47 = 0; } +enum NAMESPACE { ZERO48 = 0; } +enum NEW { ZERO49 = 0; } +enum OR { ZERO50 = 0; } +enum PRINT { ZERO51 = 0; } +enum PRIVATE { ZERO52 = 0; } +enum PROTECTED { ZERO53 = 0; } +enum PUBLIC { ZERO54 = 0; } +enum REQUIRE { ZERO55 = 0; } +enum REQUIRE_ONCE { ZERO56 = 0; } +enum RETURN { ZERO57 = 0; } +enum STATIC { ZERO58 = 0; } +enum SWITCH { ZERO59 = 0; } +enum THROW { ZERO60 = 0; } +enum TRAIT { ZERO61 = 0; } +enum TRY { ZERO62 = 0; } +enum UNSET { ZERO63 = 0; } +enum USE { ZERO64 = 0; } +enum VAR { ZERO65 = 0; } +enum WHILE { ZERO66 = 0; } +enum XOR { ZERO67 = 0; } +enum YIELD { ZERO68 = 0; } +enum INT { ZERO69 = 0; } +enum FLOAT { ZERO70 = 0; } +enum BOOL { ZERO71 = 0; } +enum STRING { ZERO72 = 0; } +enum TRUE { ZERO73 = 0; } +enum FALSE { ZERO74 = 0; } +enum NULL { ZERO75 = 0; } +enum VOID { ZERO76 = 0; } +enum ITERABLE { ZERO77 = 0; } diff --git a/php/tests/proto/test_reserved_enum_value_lower.proto b/php/tests/proto/test_reserved_enum_value_lower.proto index 96da319e553c..46829060fcd7 100644 --- a/php/tests/proto/test_reserved_enum_value_lower.proto +++ b/php/tests/proto/test_reserved_enum_value_lower.proto @@ -33,47 +33,51 @@ enum NotAllowed { exit = 27; extends = 28; final = 29; - for = 30; - foreach = 31; - function = 32; - global = 33; - goto = 34; - if = 35; - implements = 36; - include = 37; - include_once = 38; - instanceof = 39; - insteadof = 40; - interface = 41; - isset = 42; - list = 43; - namespace = 44; - new = 45; - or = 46; - print = 47; - private = 48; - protected = 49; - public = 50; - require = 51; - require_once = 52; - return = 53; - static = 54; - switch = 55; - throw = 56; - trait = 57; - try = 58; - unset = 59; - use = 60; - var = 61; - while = 62; - xor = 63; - int = 64; - float = 65; - bool = 66; - string = 67; - true = 68; - false = 69; - null = 70; - void = 71; - iterable = 72; + finally = 30; + fn = 31; + for = 32; + foreach = 33; + function = 34; + global = 35; + goto = 36; + if = 37; + implements = 38; + include = 39; + include_once = 40; + instanceof = 41; + insteadof = 42; + interface = 43; + isset = 44; + list = 45; + match = 46; + namespace = 47; + new = 48; + or = 49; + print = 50; + private = 51; + protected = 52; + public = 53; + require = 54; + require_once = 55; + return = 56; + static = 57; + switch = 58; + throw = 59; + trait = 60; + try = 61; + unset = 62; + use = 63; + var = 64; + while = 65; + xor = 66; + yield = 67; + int = 68; + float = 69; + bool = 70; + string = 71; + true = 72; + false = 73; + null = 74; + void = 75; + iterable = 76; } diff --git a/php/tests/proto/test_reserved_message_lower.proto b/php/tests/proto/test_reserved_message_lower.proto index ed120808b7ce..05344fff5918 100644 --- a/php/tests/proto/test_reserved_message_lower.proto +++ b/php/tests/proto/test_reserved_message_lower.proto @@ -32,6 +32,8 @@ message eval {} message exit {} message extends {} message final {} +message finally {} +message fn {} message for {} message foreach {} message function {} @@ -46,6 +48,7 @@ message insteadof {} message interface {} message isset {} message list {} +message match {} message namespace {} message new {} message or {} @@ -66,6 +69,7 @@ message use {} message var {} message while {} message xor {} +message yield {} message int {} message float {} message bool {} diff --git a/php/tests/proto/test_reserved_message_upper.proto b/php/tests/proto/test_reserved_message_upper.proto index 2917fd11eaa6..853a17d40566 100644 --- a/php/tests/proto/test_reserved_message_upper.proto +++ b/php/tests/proto/test_reserved_message_upper.proto @@ -32,6 +32,8 @@ message EVAL {} message EXIT {} message EXTENDS {} message FINAL {} +message FINALLY {} +message FN {} message FOR {} message FOREACH {} message FUNCTION {} @@ -46,6 +48,7 @@ message INSTEADOF {} message INTERFACE {} message ISSET {} message LIST {} +message MATCH {} message NAMESPACE {} message NEW {} message OR {} @@ -66,6 +69,7 @@ message USE {} message VAR {} message WHILE {} message XOR {} +message YIELD {} message INT {} message FLOAT {} message BOOL {} diff --git a/src/google/protobuf/compiler/php/php_generator.cc b/src/google/protobuf/compiler/php/php_generator.cc index f351ccd2a48e..eae86b3af3e7 100644 --- a/src/google/protobuf/compiler/php/php_generator.cc +++ b/src/google/protobuf/compiler/php/php_generator.cc @@ -48,26 +48,27 @@ const std::string kDescriptorMetadataFile = const std::string kDescriptorDirName = "Google/Protobuf/Internal"; const std::string kDescriptorPackageName = "Google\\Protobuf\\Internal"; const char* const kReservedNames[] = { - "abstract", "and", "array", "as", "break", - "callable", "case", "catch", "class", "clone", - "const", "continue", "declare", "default", "die", - "do", "echo", "else", "elseif", "empty", - "enddeclare", "endfor", "endforeach", "endif", "endswitch", - "endwhile", "eval", "exit", "extends", "final", - "for", "foreach", "function", "global", "goto", - "if", "implements", "include", "include_once", "instanceof", - "insteadof", "interface", "isset", "list", "namespace", - "new", "or", "print", "private", "protected", - "public", "require", "require_once", "return", "static", - "switch", "throw", "trait", "try", "unset", - "use", "var", "while", "xor", "int", - "float", "bool", "string", "true", "false", - "null", "void", "iterable"}; + "abstract", "and", "array", "as", "break", + "callable", "case", "catch", "class", "clone", + "const", "continue", "declare", "default", "die", + "do", "echo", "else", "elseif", "empty", + "enddeclare", "endfor", "endforeach", "endif", "endswitch", + "endwhile", "eval", "exit", "extends", "final", + "finally", "fn", "for", "foreach", "function", + "global", "goto", "if", "implements", "include", + "include_once", "instanceof", "insteadof", "interface", "isset", + "list", "match", "namespace", "new", "or", + "print", "private", "protected", "public", "require", + "require_once", "return", "static", "switch", "throw", + "trait", "try", "unset", "use", "var", + "while", "xor", "yield" "int", "float", + "bool", "string", "true", "false", "null", + "void", "iterable"}; const char* const kValidConstantNames[] = { "int", "float", "bool", "string", "true", "false", "null", "void", "iterable", }; -const int kReservedNamesSize = 73; +const int kReservedNamesSize = 77; const int kValidConstantNamesSize = 9; const int kFieldSetter = 1; const int kFieldGetter = 2; From d995c1c18228d5b3361b33259d026726b3e2e5f9 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Tue, 29 Jun 2021 09:17:25 -0700 Subject: [PATCH 2/2] update counts --- .../proto/test_reserved_enum_lower.proto | 94 +++++++++---------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/php/tests/proto/test_reserved_enum_lower.proto b/php/tests/proto/test_reserved_enum_lower.proto index 088459ba738c..60807d97cb6f 100644 --- a/php/tests/proto/test_reserved_enum_lower.proto +++ b/php/tests/proto/test_reserved_enum_lower.proto @@ -32,50 +32,50 @@ enum eval { ZERO27 = 0; } enum exit { ZERO28 = 0; } enum extends { ZERO29 = 0; } enum final { ZERO30 = 0; } -enum finally { ZERO30 = 0; } -enum fn { ZERO30 = 0; } -enum for { ZERO31 = 0; } -enum foreach { ZERO32 = 0; } -enum function { ZERO33 = 0; } -enum global { ZERO34 = 0; } -enum goto { ZERO35 = 0; } -enum if { ZERO36 = 0; } -enum implements { ZERO37 = 0; } -enum include { ZERO38 = 0; } -enum include_once { ZERO39 = 0; } -enum instanceof { ZERO40 = 0; } -enum insteadof { ZERO41 = 0; } -enum interface { ZERO42 = 0; } -enum isset { ZERO43 = 0; } -enum list { ZERO44 = 0; } -enum match { ZERO30 = 0; } -enum namespace { ZERO45 = 0; } -enum new { ZERO46 = 0; } -enum or { ZERO47 = 0; } -enum print { ZERO48 = 0; } -enum private { ZERO49 = 0; } -enum protected { ZERO50 = 0; } -enum public { ZERO51 = 0; } -enum require { ZERO52 = 0; } -enum require_once { ZERO53 = 0; } -enum return { ZERO54 = 0; } -enum static { ZERO55 = 0; } -enum switch { ZERO56 = 0; } -enum throw { ZERO57 = 0; } -enum trait { ZERO58 = 0; } -enum try { ZERO59 = 0; } -enum unset { ZERO60 = 0; } -enum use { ZERO61 = 0; } -enum var { ZERO62 = 0; } -enum while { ZERO63 = 0; } -enum xor { ZERO64 = 0; } -enum yield { ZERO30 = 0; } -enum int { ZERO65 = 0; } -enum float { ZERO66 = 0; } -enum bool { ZERO67 = 0; } -enum string { ZERO68 = 0; } -enum true { ZERO69 = 0; } -enum false { ZERO70 = 0; } -enum null { ZERO71 = 0; } -enum void { ZERO72 = 0; } -enum iterable { ZERO73 = 0; } +enum finally { ZERO31 = 0; } +enum fn { ZERO32 = 0; } +enum for { ZERO33 = 0; } +enum foreach { ZERO34 = 0; } +enum function { ZERO35 = 0; } +enum global { ZERO36 = 0; } +enum goto { ZERO37 = 0; } +enum if { ZERO38 = 0; } +enum implements { ZERO39 = 0; } +enum include { ZERO40 = 0; } +enum include_once { ZERO41 = 0; } +enum instanceof { ZERO42 = 0; } +enum insteadof { ZERO43 = 0; } +enum interface { ZERO44 = 0; } +enum isset { ZERO45 = 0; } +enum list { ZERO46 = 0; } +enum match { ZERO47 = 0; } +enum namespace { ZERO48 = 0; } +enum new { ZERO49 = 0; } +enum or { ZERO50 = 0; } +enum print { ZERO51 = 0; } +enum private { ZERO52 = 0; } +enum protected { ZERO53 = 0; } +enum public { ZERO54 = 0; } +enum require { ZERO55 = 0; } +enum require_once { ZERO56 = 0; } +enum return { ZERO57 = 0; } +enum static { ZERO58 = 0; } +enum switch { ZERO59 = 0; } +enum throw { ZERO60 = 0; } +enum trait { ZERO61 = 0; } +enum try { ZERO62 = 0; } +enum unset { ZERO63 = 0; } +enum use { ZERO64 = 0; } +enum var { ZERO65 = 0; } +enum while { ZERO66 = 0; } +enum xor { ZERO67 = 0; } +enum yield { ZERO68 = 0; } +enum int { ZERO69 = 0; } +enum float { ZERO70 = 0; } +enum bool { ZERO71 = 0; } +enum string { ZERO72 = 0; } +enum true { ZERO73 = 0; } +enum false { ZERO74 = 0; } +enum null { ZERO75 = 0; } +enum void { ZERO76 = 0; } +enum iterable { ZERO77 = 0; }