Skip to content

Commit a3895b6

Browse files
committed
Add function for Unicode NFC normalization
gcc/rust/ChangeLog: * Make-lang.in: Add rust-unicode.o * rust-lang.cc (run_rust_tests): Add test. * rust-system.h: Include <array> * util/make-rust-unicode.py: Generater of rust-unicode-data.h. * util/rust-unicode-data.h: Auto-generated file. * util/rust-unicode.cc: New file. * util/rust-unicode.h: New file. Signed-off-by: Raiki Tamura <[email protected]>
1 parent 86bfc84 commit a3895b6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

gcc/rust/rust-session-manager.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,12 @@ validate_crate_name (const std::string &crate_name, Error &error)
126126
}
127127
for (auto &c : crate_name)
128128
{
129-
if (!(ISALNUM (c) || c == '_'))
129+
std::cout << "check for " << c.as_string () << std::endl;
130+
std::cout << is_alphabetic (c.value);
131+
std::cout << "is_al_ok" << std::endl;
132+
std::cout << is_numeric (c.value);
133+
std::cout << "is_num_ok" << std::endl;
134+
if (!(is_alphabetic (c.value) || is_numeric (c.value) || c.value == '_'))
130135
{
131136
error = Error (UNDEF_LOCATION,
132137
"invalid character %<%c%> in crate name: %<%s%>", c,
@@ -1226,6 +1231,8 @@ namespace selftest {
12261231
void
12271232
rust_crate_name_validation_test (void)
12281233
{
1234+
std::cout << "1 is numeric?" << Rust::is_numeric ('1') << std::endl;
1235+
12291236
auto error = Rust::Error (UNDEF_LOCATION, std::string ());
12301237
ASSERT_TRUE (Rust::validate_crate_name ("example", error));
12311238
ASSERT_TRUE (Rust::validate_crate_name ("abcdefg_1234", error));

0 commit comments

Comments
 (0)