diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fa39f0ddc98faec5f8b39d077e8964b079331df..1f4ae4156a611b58911c78116e0d6e4f3ed8cb04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ * Added support for Java 17. * Updated ProB 2 to version 4.0.0-SNAPSHOT. * Added a `:language` command to allow changing the language used to parse user input. For example `:language event_b` can be used to switch to Event-B syntax when a non-Event-B machine is loaded (or no machine at all). -* Made `:let` syntax more flexible: both `:let name value` and `:let name=value` are now allowed. +* Made `:let` syntax more flexible: both `:let name value` and `:let name = value` are now allowed. * Improved the performance of loading machines by reusing the existing instance of ProB instead of starting a new one for each machine. * Improved error highlighting for machines loaded from files and not from the notebook. * Local variables (created using `:let`) are now discarded when a new machine is loaded. Previously local variables would be remembered even across machine loads, which could lead to confusing behavior and errors. diff --git a/notebooks/tests/let.ipynb b/notebooks/tests/let.ipynb index 9315c645d8901075b345d5842f7bbeeec654e2e9..7739a36fd1ac45f7bafc1d9698ae4f7efce2497f 100644 --- a/notebooks/tests/let.ipynb +++ b/notebooks/tests/let.ipynb @@ -408,7 +408,7 @@ } ], "source": [ - ":let y=2" + ":let y = 2" ] }, { diff --git a/src/main/java/de/prob2/jupyter/commands/LetCommand.java b/src/main/java/de/prob2/jupyter/commands/LetCommand.java index e591444456dbc714b17c929ec9d870b255ea0138..fb7c44ddbfb8375649f99566169854b75b49cf84 100644 --- a/src/main/java/de/prob2/jupyter/commands/LetCommand.java +++ b/src/main/java/de/prob2/jupyter/commands/LetCommand.java @@ -28,7 +28,7 @@ import org.jetbrains.annotations.NotNull; public final class LetCommand implements Command { private static final @NotNull Parameter.RequiredSingle NAME_AND_EXPRESSION = Parameter.requiredRemainder("nameAndExpression"); - private static final @NotNull Pattern NAME_AND_EXPRESSION_SPLIT_PATTERN = Pattern.compile("=|\\s+"); + private static final @NotNull Pattern NAME_AND_EXPRESSION_SPLIT_PATTERN = Pattern.compile("\\s*[\\s=]\\s*"); private final @NotNull Provider<@NotNull ProBKernel> kernelProvider; private final @NotNull AnimationSelector animationSelector;