mirror of
https://github.com/nushell/nushell.git
synced 2025-08-19 07:11:29 +02:00
Add cell paths
This commit is contained in:
19
crates/nu-protocol/src/ast/cell_path.rs
Normal file
19
crates/nu-protocol/src/ast/cell_path.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
use super::Expression;
|
||||
use crate::Span;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum PathMember {
|
||||
String { val: String, span: Span },
|
||||
Int { val: usize, span: Span },
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct CellPath {
|
||||
pub members: Vec<PathMember>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct FullCellPath {
|
||||
pub head: Expression,
|
||||
pub tail: Vec<PathMember>,
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
use super::{Call, Expression, Operator, RangeOperator};
|
||||
use super::{Call, Expression, FullCellPath, Operator, RangeOperator};
|
||||
use crate::{BlockId, Signature, Span, VarId};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -22,6 +22,7 @@ pub enum Expr {
|
||||
Table(Vec<Expression>, Vec<Vec<Expression>>),
|
||||
Keyword(Vec<u8>, Span, Box<Expression>),
|
||||
String(String), // FIXME: improve this in the future?
|
||||
FullCellPath(Box<FullCellPath>),
|
||||
Signature(Box<Signature>),
|
||||
Garbage,
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
mod block;
|
||||
mod call;
|
||||
mod cell_path;
|
||||
mod expr;
|
||||
mod expression;
|
||||
mod operator;
|
||||
@@ -8,6 +9,7 @@ mod statement;
|
||||
|
||||
pub use block::*;
|
||||
pub use call::*;
|
||||
pub use cell_path::*;
|
||||
pub use expr::*;
|
||||
pub use expression::*;
|
||||
pub use operator::*;
|
||||
|
Reference in New Issue
Block a user