rust-analyzer/crates/ra_syntax/src/validation/field_expr.rs
2019-07-20 12:58:27 +03:00

13 lines
420 B
Rust

use crate::{
ast::{self, FieldKind},
SyntaxError,
SyntaxErrorKind::*,
};
pub(crate) fn validate_field_expr_node(node: ast::FieldExpr, errors: &mut Vec<SyntaxError>) {
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.text_range()));
}
}
}