rust-analyzer/crates/ra_syntax/src/validation/field_expr.rs

14 lines
415 B
Rust
Raw Normal View History

use crate::{
ast::{self, FieldKind},
SyntaxError,
SyntaxErrorKind::*,
2019-04-05 20:34:45 +00:00
};
2019-07-18 16:23:05 +00:00
pub(crate) fn validate_field_expr_node(node: ast::FieldExpr, errors: &mut Vec<SyntaxError>) {
2019-04-05 20:34:45 +00:00
if let Some(FieldKind::Index(idx)) = node.field_access() {
if idx.text().chars().any(|c| c < '0' || c > '9') {
errors.push(SyntaxError::new(InvalidTupleIndexFormat, idx.range()));
}
}
}