diff options
author | robojumper <[email protected]> | 2019-04-05 21:34:45 +0100 |
---|---|---|
committer | robojumper <[email protected]> | 2019-04-06 00:07:35 +0100 |
commit | ca40ca93a55ffa08d3e699fc877e7e189b526c66 (patch) | |
tree | 8b56a9250db5c713da3fc14758c0583bbb029638 /crates/ra_syntax/src/validation | |
parent | 0372eca5b2e6dade5132a08db46992ca73a25188 (diff) |
Parse and infer tuple indices
Diffstat (limited to 'crates/ra_syntax/src/validation')
-rw-r--r-- | crates/ra_syntax/src/validation/field_expr.rs | 12 |
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 @@ | |||
1 | use crate::{ast::{self, FieldKind}, | ||
2 | SyntaxError, | ||
3 | SyntaxErrorKind::*, | ||
4 | }; | ||
5 | |||
6 | pub(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 | } | ||