aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2016-04-25 17:36:12 -0400
committerbnewbold <bnewbold@robocracy.org>2016-04-25 17:36:12 -0400
commit6af779121c0124291b52102cf646ea4430c5226f (patch)
treec8d47ab4e512f57acc804ded19643a737043a672
parent48ead3f5edd2166de454be9e5da6891375b40f57 (diff)
downloadspectrum-6af779121c0124291b52102cf646ea4430c5226f.zip
spectrum-6af779121c0124291b52102cf646ea4430c5226f.tar.gz
rust: allow digits in identifiers (after 1st char)
-rw-r--r--rust/spectrum.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/rust/spectrum.rs b/rust/spectrum.rs
index c5ebad3..15c1f7b 100644
--- a/rust/spectrum.rs
+++ b/rust/spectrum.rs
@@ -63,8 +63,8 @@ fn is_valid_identifier(s: &str) -> bool {
if s.starts_with("-") || s.ends_with("-") {
return false;
}
- for c in s.chars() {
- if !(c.is_alphabetic() || c == '-') {
+ for (i, c) in s.chars().enumerate() {
+ if !(c.is_alphabetic() || c == '-' || (c.is_numeric() && i > 0)) {
return false;
}
}