mirror of
https://github.com/nushell/nushell.git
synced 2025-08-19 07:11:29 +02:00
Add wrap and get and cell_path parsing
This commit is contained in:
@@ -45,4 +45,8 @@ impl Call {
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
pub fn nth(&self, pos: usize) -> Option<Expression> {
|
||||
self.positional.get(pos).cloned()
|
||||
}
|
||||
}
|
||||
|
@@ -1,13 +1,14 @@
|
||||
use super::Expression;
|
||||
use crate::Span;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum PathMember {
|
||||
String { val: String, span: Span },
|
||||
Int { val: usize, span: Span },
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct CellPath {
|
||||
pub members: Vec<PathMember>,
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
use super::{Call, Expression, FullCellPath, Operator, RangeOperator};
|
||||
use super::{Call, CellPath, Expression, FullCellPath, Operator, RangeOperator};
|
||||
use crate::{BlockId, Signature, Span, VarId};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -24,6 +24,7 @@ pub enum Expr {
|
||||
Table(Vec<Expression>, Vec<Vec<Expression>>),
|
||||
Keyword(Vec<u8>, Span, Box<Expression>),
|
||||
String(String), // FIXME: improve this in the future?
|
||||
CellPath(CellPath),
|
||||
FullCellPath(Box<FullCellPath>),
|
||||
Signature(Box<Signature>),
|
||||
Garbage,
|
||||
|
Reference in New Issue
Block a user