aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/validation/field_expr.rs
blob: 0e18bd9ca016bdc62db6c4e8552ca1e153e84d11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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.range()));
        }
    }
}