From 75b3b3e09095247d02cd915f358c58d7ea8d85d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C5=BD=C3=A1dn=C3=ADk?= Date: Tue, 19 Oct 2021 23:41:59 +0300 Subject: [PATCH] Add comments --- crates/nu-parser/src/parser.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/nu-parser/src/parser.rs b/crates/nu-parser/src/parser.rs index 3c2c9a63aa..798a89ec6b 100644 --- a/crates/nu-parser/src/parser.rs +++ b/crates/nu-parser/src/parser.rs @@ -1711,6 +1711,7 @@ pub fn parse_import_pattern( ); } + // We can have either "head" or "head::tail" if (tokens.len() != 1) && (tokens.len() != 4) { return ( ImportPattern { @@ -1721,6 +1722,7 @@ pub fn parse_import_pattern( ); } + // Check if the second : of the :: is really a : let has_second_colon = if let Some(t) = tokens.get(2) { let potential_colon = working_set.get_span_contents(t.span); potential_colon == b":" @@ -1729,6 +1731,7 @@ pub fn parse_import_pattern( }; if (tokens.len() == 4) && !has_second_colon { + // Applies only to the "head::tail" structure; "head" only doesn't have : return ( ImportPattern { head: vec![],