summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKornel Lesiński <kornel@geekhood.net>2017-02-15 19:12:22 +0000
committerKornel Lesiński <kornel@geekhood.net>2017-02-15 19:12:22 +0000
commit70c61e1ebd1b0270953b8e33b74bfff578ccc82f (patch)
tree34f7ead85aab0d297382fb050583504a1b9e0623 /src
parent4a14681bf8f224e0eb19d09bf75bebfa2b40d8ef (diff)
Docs
Diffstat (limited to 'src')
-rw-r--r--src/ir/ty.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/ir/ty.rs b/src/ir/ty.rs
index 470d9536..332ad236 100644
--- a/src/ir/ty.rs
+++ b/src/ir/ty.rs
@@ -316,6 +316,9 @@ impl Type {
_ => false,
}
}
+
+ /// Checks whether the name looks like an identifier,
+ /// i.e. is alphanumeric (including '_') and does not start with a digit.
pub fn is_valid_identifier(name: &str) -> bool {
let mut chars = name.chars();
let first_valid = chars.next().map(|c| c.is_alphabetic() || c == '_').unwrap_or(false);