mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 13:36:07 +02:00
Fix typos and capitalization of "Unicode" (#3234)
* Capitalize "Unicode" * Fix several typos * Fix mixed whitespace in nu-parser's tests
This commit is contained in:
@ -12,7 +12,7 @@ impl matchers::Matcher for Matcher {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
// TODO: check some unicode matches if this becomes relevant
|
||||
// TODO: check some Unicode matches if this becomes relevant
|
||||
|
||||
// FIXME: could work exhaustively through ['-', '--'. ''] in a loop for each test
|
||||
#[test]
|
||||
|
@ -285,7 +285,7 @@ fn get_shape_of_expr(expr: &SpannedExpression) -> Option<SyntaxShape> {
|
||||
nu_protocol::hir::Literal::Bare(_) => Some(SyntaxShape::String),
|
||||
}
|
||||
}
|
||||
//Synthetic are expressions that are generated by the parser and not inputed by the user
|
||||
//Synthetic are expressions that are generated by the parser and not inputted by the user
|
||||
//ExternalWord is anything sent to external commands (?)
|
||||
Expression::ExternalWord => Some(SyntaxShape::String),
|
||||
Expression::Synthetic(_) => Some(SyntaxShape::String),
|
||||
@ -387,7 +387,7 @@ impl VarSyntaxShapeDeductor {
|
||||
}
|
||||
|
||||
fn infer_shape(&mut self, block: &Block, scope: &Scope) -> Result<(), ShellError> {
|
||||
trace!("Infering vars in shape");
|
||||
trace!("Inferring vars in shape");
|
||||
for group in &block.block {
|
||||
for pipeline in &group.pipelines {
|
||||
self.infer_pipeline(pipeline, scope)?;
|
||||
@ -397,7 +397,7 @@ impl VarSyntaxShapeDeductor {
|
||||
}
|
||||
|
||||
pub fn infer_pipeline(&mut self, pipeline: &Pipeline, scope: &Scope) -> Result<(), ShellError> {
|
||||
trace!("Infering vars in pipeline");
|
||||
trace!("Inferring vars in pipeline");
|
||||
for (cmd_pipeline_idx, classified) in pipeline.list.iter().enumerate() {
|
||||
match &classified {
|
||||
ClassifiedCommand::Internal(internal) => {
|
||||
@ -429,7 +429,7 @@ impl VarSyntaxShapeDeductor {
|
||||
}
|
||||
}
|
||||
if let Some(named) = &internal.args.named {
|
||||
trace!("Infering vars in named exprs");
|
||||
trace!("Inferring vars in named exprs");
|
||||
for (_name, val) in named.iter() {
|
||||
if let NamedValue::Value(_, named_expr) = val {
|
||||
self.infer_shapes_in_expr(
|
||||
@ -443,7 +443,7 @@ impl VarSyntaxShapeDeductor {
|
||||
}
|
||||
ClassifiedCommand::Expr(spanned_expr) => {
|
||||
trace!(
|
||||
"Infering shapes in ClassifiedCommand::Expr: {:?}",
|
||||
"Inferring shapes in ClassifiedCommand::Expr: {:?}",
|
||||
spanned_expr
|
||||
);
|
||||
self.infer_shapes_in_expr((cmd_pipeline_idx, pipeline), spanned_expr, scope)?;
|
||||
@ -459,7 +459,7 @@ impl VarSyntaxShapeDeductor {
|
||||
positionals: &[SpannedExpression],
|
||||
signature: &Signature,
|
||||
) -> Result<(), ShellError> {
|
||||
trace!("Infering vars in positionals");
|
||||
trace!("Inferring vars in positionals");
|
||||
//TODO currently correct inference for optional positionals is not implemented.
|
||||
// See https://github.com/nushell/nushell/pull/2486 for a discussion about this
|
||||
// For now we assume every variable in an optional positional is used as this optional
|
||||
@ -500,7 +500,7 @@ impl VarSyntaxShapeDeductor {
|
||||
named: &NamedArguments,
|
||||
signature: &Signature,
|
||||
) -> Result<(), ShellError> {
|
||||
trace!("Infering vars in named");
|
||||
trace!("Inferring vars in named");
|
||||
for (name, val) in named.iter() {
|
||||
if let NamedValue::Value(span, spanned_expr) = &val {
|
||||
if let Expression::Variable(var_name, _) = &spanned_expr.expr {
|
||||
@ -534,15 +534,15 @@ impl VarSyntaxShapeDeductor {
|
||||
) -> Result<(), ShellError> {
|
||||
match &spanned_expr.expr {
|
||||
Expression::Binary(_) => {
|
||||
trace!("Infering vars in bin expr");
|
||||
trace!("Inferring vars in bin expr");
|
||||
self.infer_shapes_in_binary_expr((pipeline_idx, pipeline), spanned_expr, scope)?;
|
||||
}
|
||||
Expression::Block(b) => {
|
||||
trace!("Infering vars in block");
|
||||
trace!("Inferring vars in block");
|
||||
self.infer_shape(&b, scope)?;
|
||||
}
|
||||
Expression::Path(path) => {
|
||||
trace!("Infering vars in path");
|
||||
trace!("Inferring vars in path");
|
||||
match &path.head.expr {
|
||||
//PathMember can't be var yet (?)
|
||||
//TODO Iterate over path parts and find var when implemented
|
||||
@ -560,7 +560,7 @@ impl VarSyntaxShapeDeductor {
|
||||
}
|
||||
}
|
||||
Expression::Range(range) => {
|
||||
trace!("Infering vars in range");
|
||||
trace!("Inferring vars in range");
|
||||
if let Some(range_left) = &range.left {
|
||||
if let Expression::Variable(var_name, _) = &range_left.expr {
|
||||
self.checked_insert(
|
||||
@ -585,13 +585,13 @@ impl VarSyntaxShapeDeductor {
|
||||
}
|
||||
}
|
||||
Expression::List(inner_exprs) => {
|
||||
trace!("Infering vars in list");
|
||||
trace!("Inferring vars in list");
|
||||
for expr in inner_exprs {
|
||||
self.infer_shapes_in_expr((pipeline_idx, pipeline), expr, scope)?;
|
||||
}
|
||||
}
|
||||
Expression::Invocation(invoc) => {
|
||||
trace!("Infering vars in invocation: {:?}", invoc);
|
||||
trace!("Inferring vars in invocation: {:?}", invoc);
|
||||
self.infer_shape(invoc, scope)?;
|
||||
}
|
||||
Expression::Table(header, _rows) => {
|
||||
@ -738,7 +738,7 @@ impl VarSyntaxShapeDeductor {
|
||||
(pipeline_idx, pipeline): (usize, &Pipeline),
|
||||
scope: &Scope,
|
||||
) -> Result<(), ShellError> {
|
||||
trace!("Infering shapes between var {:?} and expr {:?}", var, expr);
|
||||
trace!("Inferring shapes between var {:?} and expr {:?}", var, expr);
|
||||
let bin = spanned_to_binary(bin_spanned);
|
||||
if let Expression::Literal(Literal::Operator(op)) = bin.op.expr {
|
||||
match &op {
|
||||
|
Reference in New Issue
Block a user