-
Notifications
You must be signed in to change notification settings - Fork 505
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle keyword
Self
after stripping enum type prefix (#998)
* Address #997: handle keyword `Self` after stripping enum type prefix * create sanitize_identifier * add to_snake back (i did it in two commits to not mess up the git blame) * small fixes * add test_sanitize_identifier * remove unnecessary comment * combine test_strip_enum_prefix and test_strip_enum_prefix_resulting_in_keyword * update enum_keyword_variant.proto * maybe improve docs of strip_enum_prefix?
- Loading branch information
1 parent
2e64d6f
commit 963e942
Showing
6 changed files
with
151 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
syntax = "proto3"; | ||
|
||
package enum_keyword_variant; | ||
|
||
enum Feeding { | ||
FEEDING_UNSPECIFIED = 0; | ||
FEEDING_ASSISTED = 1; | ||
// Careful: code generation resulted in "Self". Now it is "Self_". | ||
FEEDING_SELF = 2; | ||
FEEDING_ELSE = 3; | ||
} | ||
|
||
enum Grooming { | ||
UNSPECIFIED = 0; | ||
ASSISTED = 1; | ||
SELF = 2; | ||
ELSE = 3; | ||
} | ||
|
||
enum Number { | ||
NUMBER_UNSPECIFIED = 0; | ||
NUMBER_1 = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
mod enum_keyword_variant { | ||
include!(concat!(env!("OUT_DIR"), "/enum_keyword_variant.rs")); | ||
} | ||
|
||
#[test] | ||
fn dummy() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters