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

Weird error with "\s" #722

Open
lionel- opened this issue Feb 25, 2025 · 3 comments
Open

Weird error with "\s" #722

lionel- opened this issue Feb 25, 2025 · 3 comments

Comments

@lionel-
Copy link
Contributor

lionel- commented Feb 25, 2025

Reported by @hadley

Evaluating "\s" in the console gives a weird error:

Image

I traced it down to R_ParseVector() throwing an error instead of returning a syntax error code. This causes the control flow to end up in this safeguard path:

let status = unwrap!(harp::parse_status(&harp::ParseInput::Text(input)), Err(err) => {
.

@lionel-
Copy link
Contributor Author

lionel- commented Feb 25, 2025

You'll see the same thing with 1 |> {}.

In general see https://github.com/r-devel/r-svn/blob/7da17dcbb20d1dfc901efd7dfee1623c21c925cf/src/main/gram.y#L4439 and https://github.com/r-devel/r-svn/blob/7da17dcbb20d1dfc901efd7dfee1623c21c925cf/src/main/gram.y#L4532 for the class of errors that can be thrown by the parser.

We should catch these classed R errors and convert them to proper syntax errors on the Rust side.

@DavisVaughan
Copy link
Contributor

Why doesn't R_ParseVector() return an error code? Should we report that?

@lionel-
Copy link
Contributor Author

lionel- commented Feb 25, 2025

I don't know but this seems intentional.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants