diff --git a/src/compile_error.rs b/src/compile_error.rs index 21d856c..2f49923 100644 --- a/src/compile_error.rs +++ b/src/compile_error.rs @@ -80,16 +80,6 @@ impl Display for CompileError<'_> { write!(f, "at most {} {}", max, Count("argument", *max))?; } } - DeprecatedEquals => { - writeln!( - f, - "`=` in assignments, exports, and aliases has been phased out on favor of `:=`" - )?; - write!( - f, - "Please see this issue for more details: https://github.com/casey/just/issues/379" - )?; - } DuplicateAlias { alias, first } => { write!( f, diff --git a/src/compile_error_kind.rs b/src/compile_error_kind.rs index af47107..dfe33c1 100644 --- a/src/compile_error_kind.rs +++ b/src/compile_error_kind.rs @@ -21,7 +21,6 @@ pub(crate) enum CompileErrorKind<'src> { min: usize, max: usize, }, - DeprecatedEquals, DuplicateAlias { alias: &'src str, first: usize, diff --git a/src/parser.rs b/src/parser.rs index 90533d6..43118c6 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -112,14 +112,6 @@ impl<'tokens, 'src> Parser<'tokens, 'src> { true } - /// Get the `n`th next significant token - fn get(&self, n: usize) -> CompileResult<'src, Token<'src>> { - match self.rest().nth(n) { - Some(token) => Ok(token), - None => Err(self.internal_error("`Parser::get()` advanced past end of token stream")?), - } - } - /// Advance past one significant token, clearing the expected token set. fn advance(&mut self) -> CompileResult<'src, Token<'src>> { self.expected.clear(); @@ -323,15 +315,9 @@ impl<'tokens, 'src> Parser<'tokens, 'src> { break; } else if self.next_is(Identifier) { match Keyword::from_lexeme(next.lexeme()) { - Some(Keyword::Alias) if self.next_are(&[Identifier, Identifier, Equals]) => { - return Err(self.get(2)?.error(CompileErrorKind::DeprecatedEquals)) - } Some(Keyword::Alias) if self.next_are(&[Identifier, Identifier, ColonEquals]) => { items.push(Item::Alias(self.parse_alias()?)); } - Some(Keyword::Export) if self.next_are(&[Identifier, Identifier, Equals]) => { - return Err(self.get(2)?.error(CompileErrorKind::DeprecatedEquals)) - } Some(Keyword::Export) if self.next_are(&[Identifier, Identifier, ColonEquals]) => { self.presume_keyword(Keyword::Export)?; items.push(Item::Assignment(self.parse_assignment(true)?)); @@ -344,9 +330,7 @@ impl<'tokens, 'src> Parser<'tokens, 'src> { items.push(Item::Set(self.parse_set()?)); } _ => { - if self.next_are(&[Identifier, Equals]) { - return Err(self.get(1)?.error(CompileErrorKind::DeprecatedEquals)); - } else if self.next_are(&[Identifier, ColonEquals]) { + if self.next_are(&[Identifier, ColonEquals]) { items.push(Item::Assignment(self.parse_assignment(false)?)); } else { let doc = pop_doc_comment(&mut items, eol_since_last_comment); diff --git a/tests/equals.rs b/tests/equals.rs new file mode 100644 index 0000000..476cea6 --- /dev/null +++ b/tests/equals.rs @@ -0,0 +1,29 @@ +use crate::common::*; + +#[test] +fn export_recipe() { + Test::new() + .justfile( + " + export foo='bar': + echo {{foo}} + ", + ) + .stdout("bar\n") + .stderr("echo bar\n") + .run(); +} + +#[test] +fn alias_recipe() { + Test::new() + .justfile( + " + alias foo='bar': + echo {{foo}} + ", + ) + .stdout("bar\n") + .stderr("echo bar\n") + .run(); +} diff --git a/tests/lib.rs b/tests/lib.rs index f35d878..6f395d6 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -12,6 +12,7 @@ mod conditional; mod delimiters; mod dotenv; mod edit; +mod equals; mod error_messages; mod evaluate; mod examples; diff --git a/tests/misc.rs b/tests/misc.rs index 1a47880..a8c6fe2 100644 --- a/tests/misc.rs +++ b/tests/misc.rs @@ -1831,7 +1831,7 @@ default a=`read A && echo $A` b=`read B && echo $B`: } test! { - name: equals_deprecated_assignment, + name: old_equals_assignment_syntax_produces_error, justfile: " foo = 'bar' @@ -1839,49 +1839,11 @@ test! { echo {{foo}} ", stderr: " - error: `=` in assignments, exports, and aliases has been phased out on favor of `:=` - Please see this issue for more details: https://github.com/casey/just/issues/379 + error: Expected '*', ':', '$', identifier, or '+', but found '=' | 1 | foo = 'bar' | ^ - ", - status: EXIT_FAILURE, -} - -test! { - name: equals_deprecated_export, - justfile: " - export FOO = 'bar' - - default: - echo $FOO ", - stderr: " - error: `=` in assignments, exports, and aliases has been phased out on favor of `:=` - Please see this issue for more details: https://github.com/casey/just/issues/379 - | - 1 | export FOO = 'bar' - | ^ - ", - status: EXIT_FAILURE, -} - -test! { - name: equals_deprecated_alias, - justfile: " - alias foo = default - - default: - echo default - ", - args: ("foo"), - stderr: " - error: `=` in assignments, exports, and aliases has been phased out on favor of `:=` - Please see this issue for more details: https://github.com/casey/just/issues/379 - | - 1 | alias foo = default - | ^ - ", status: EXIT_FAILURE, }