mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Parse and infer tuple indices
This commit is contained in:
parent
0372eca5b2
commit
ca40ca93a5
13 changed files with 210 additions and 14 deletions
12
crates/ra_syntax/src/validation/field_expr.rs
Normal file
12
crates/ra_syntax/src/validation/field_expr.rs
Normal file
|
@ -0,0 +1,12 @@
|
|||
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()));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue