Skip to content

Commit aa8336e

Browse files
authored
Merge pull request #4582 from youknowone/unicode_names2
Another temporary fix for #4566
2 parents 733ff9a + c0f5266 commit aa8336e

14 files changed

+353
-6
lines changed

Cargo.lock

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ static_assertions = "1.1"
5555
syn = "1.0.91"
5656
thiserror = "1.0"
5757
thread_local = "1.1.4"
58+
unicode_names2 = { version = "0.6.0", git = "https://github.com/youknowone/unicode_names2.git", tag = "v0.6.0+character-alias" }
5859
widestring = "0.5.1"
5960

6061
[features]

compiler/parser/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ log = { workspace = true }
2727
num-bigint = { workspace = true }
2828
num-traits = { workspace = true }
2929
thiserror = { workspace = true }
30+
unicode_names2 = { workspace = true }
3031

3132
unic-emoji-char = "0.9.0"
3233
unic-ucd-ident = "0.9.0"
33-
unicode_names2 = "0.5.0"
3434
lalrpop-util = "0.19.8"
3535
phf = "0.11.1"
3636
rustc-hash = "1.1.0"

compiler/parser/src/snapshots/rustpython_parser__string__tests__backspace_alias.snap

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compiler/parser/src/snapshots/rustpython_parser__string__tests__bell_alias.snap

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compiler/parser/src/snapshots/rustpython_parser__string__tests__carriage_return_alias.snap

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compiler/parser/src/snapshots/rustpython_parser__string__tests__character_tabulation_with_justification_alias.snap

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compiler/parser/src/snapshots/rustpython_parser__string__tests__delete_alias.snap

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compiler/parser/src/snapshots/rustpython_parser__string__tests__escape_alias.snap

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compiler/parser/src/snapshots/rustpython_parser__string__tests__form_feed_alias.snap

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compiler/parser/src/snapshots/rustpython_parser__string__tests__hts_alias.snap

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compiler/parser/src/string.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,4 +1048,28 @@ mod tests {
10481048
let parse_ast = parse_program(source, "<test>").unwrap();
10491049
insta::assert_debug_snapshot!(parse_ast);
10501050
}
1051+
1052+
macro_rules! test_aliases_parse {
1053+
($($name:ident: $alias:expr,)*) => {
1054+
$(
1055+
#[test]
1056+
fn $name() {
1057+
let source = format!(r#""\N{{{0}}}""#, $alias);
1058+
let parse_ast = parse_program(&source, "<test>").unwrap();
1059+
insta::assert_debug_snapshot!(parse_ast);
1060+
}
1061+
)*
1062+
}
1063+
}
1064+
1065+
test_aliases_parse! {
1066+
test_backspace_alias: "BACKSPACE",
1067+
test_bell_alias: "BEL",
1068+
test_carriage_return_alias: "CARRIAGE RETURN",
1069+
test_delete_alias: "DELETE",
1070+
test_escape_alias: "ESCAPE",
1071+
test_form_feed_alias: "FORM FEED",
1072+
test_hts_alias: "HTS",
1073+
test_character_tabulation_with_justification_alias: "CHARACTER TABULATION WITH JUSTIFICATION",
1074+
}
10511075
}

0 commit comments

Comments
 (0)