forked from rune-rs/rune
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The feature `non_ascii_idents` gives Rune feature parity with Rust in supporting Unicode identifiers. Refer to: rust-lang/rfcs#2457
- Loading branch information
Showing
3 changed files
with
49 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Test non-ASCII identifiers (feature `non_ascii_idents`). | ||
|
||
// Creating a variable. | ||
let 另一個世界 = "三體世界"; | ||
|
||
// Reference to a variable. | ||
let 世界 = 另一個世界; | ||
|
||
// In template interpolation. | ||
let 高論 = `你好,${另一個世界}。`; | ||
|
||
// In string formatting. | ||
println!("我對{另一個世界}說話:「{}」", 高論); | ||
|
||
// Compatibility check for alphanumeric characters and underscore. | ||
let _ = (); | ||
let aB_1 = (); | ||
let Ab_2 = (); | ||
let __甲_乙_丙_丁__ = (); | ||
|
||
// Naming functions and function arguments. | ||
fn 口號(蟲子, 主) { | ||
`消除${蟲子}暴政,世界屬於${主}!` | ||
} | ||
|
||
// Function call. | ||
println!("我們的口號是:「{}」", 口號("人類", "三體")); |