Skip to content
Snippets Groups Projects
Commit 6438446b authored by Michael Aaron Murphy's avatar Michael Aaron Murphy
Browse files

Merge branch 'truly-fix-843' into 'master'

Check for non ascii alphanumeric variable names

Closes #843

See merge request redox-os/ion!943
parents fd237179 fad9e6f3
No related branches found
No related tags found
No related merge requests found
...@@ -27,11 +27,9 @@ where ...@@ -27,11 +27,9 @@ where
} }
pub fn is_valid_name(name: &str) -> bool { pub fn is_valid_name(name: &str) -> bool {
if !(name.as_bytes()[0] as char).is_numeric() { let mut bytes = name.bytes();
!name.chars().any(|c| !(c.is_alphanumeric() || c == '_')) bytes.next().map_or(false, |b| b.is_ascii_alphabetic())
} else { && bytes.all(|b| b.is_ascii_alphanumeric() || b == b'_')
false
}
} }
pub(crate) fn parse(code: &str) -> Statement { pub(crate) fn parse(code: &str) -> Statement {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment