Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REPL parsing fails sometimes #618

Closed
EagleoutIce opened this issue Jan 26, 2024 · 1 comment · Fixed by #657
Closed

REPL parsing fails sometimes #618

EagleoutIce opened this issue Jan 26, 2024 · 1 comment · Fixed by #657
Labels
bug Something isn't working cli Refers to a Command Line Interface good first issue Good for newcomers

Comments

@EagleoutIce
Copy link
Member

When issue a command like:

R> :slicer -c "2@x" -r "x <- 3 * 4\n y <- x * 2"

The argument parser seems to get tripped up by the <-. We should make it work with ; and <-!

@EagleoutIce EagleoutIce added bug Something isn't working good first issue Good for newcomers cli Refers to a Command Line Interface labels Jan 26, 2024
@bjthehun
Copy link
Contributor

Actually, the problems seems to come from how flowR currently splits user input with splitAtEscapeSensitive.

Split 1, in replProcessAnswer within src/cli/repl/core.ts, produces the statement:

[
	":slicer -c 2@x -r x <- 3 * 4\n y <- x * 2"
]

Here, the quotation marks surrounding the statement have been removed. From the current test cases, this seems to be the intended result.
Split 2, in lines 71-87 of src/cli/repl/commands/commands.ts, then produces the following arguments from -c 2@x -r x <- 3 * 4\n y <- x * 2:

[
  "-c",
  "2@x",
  "-r",
  "x",
  "<-",
  "3",
  "*",
  "4\n",
  "y",
  "<-",
  "x",
  "*",
  "2",
]

Because of the missing quotation marks, splitAtEscapeSensitive sees x, <-, 3 etc. as arguments, too. When I manually added back the quotation marks to the result of Split 1, the slicer command succeeded.
So, for splitting statements, flowR should probably leave in quotation marks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cli Refers to a Command Line Interface good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants