pub fn identifier(s: &str) -> IResult<&str, Identifier>
Expand description
Parser for identifiers
Ensures the first character is not a digit and the identifier is not a keyword.
Example:
assert!(identifier("x").is_ok()); // succeeds
assert!(identifier("foo_bar3").is_ok()); // succeeds
assert!(identifier("_unused_var").is_ok()); // succeeds
assert!(identifier("while").is_err()); // fails (while is a keyword)
assert!(identifier("7hello").is_err()); // fails (treated as integer literal)