aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/validation/field_expr.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src/validation/field_expr.rs')
-rw-r--r--crates/ra_syntax/src/validation/field_expr.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/validation/field_expr.rs b/crates/ra_syntax/src/validation/field_expr.rs
new file mode 100644
index 000000000..2b405062e
--- /dev/null
+++ b/crates/ra_syntax/src/validation/field_expr.rs
@@ -0,0 +1,12 @@
1use crate::{ast::{self, FieldKind},
2 SyntaxError,
3 SyntaxErrorKind::*,
4};
5
6pub(crate) fn validate_field_expr_node(node: &ast::FieldExpr, errors: &mut Vec<SyntaxError>) {
7 if let Some(FieldKind::Index(idx)) = node.field_access() {
8 if idx.text().chars().any(|c| c < '0' || c > '9') {
9 errors.push(SyntaxError::new(InvalidTupleIndexFormat, idx.range()));
10 }
11 }
12}