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

Inserting nothing in Pyret gives a parse error #248

Closed
2 tasks
justinpombrio opened this issue May 30, 2019 · 2 comments
Closed
2 tasks

Inserting nothing in Pyret gives a parse error #248

justinpombrio opened this issue May 30, 2019 · 2 comments

Comments

@justinpombrio
Copy link
Collaborator

Start with the code

f(x)

Now double-click on the drop target to one side of the x, and insert "" or " ".

This should be a no-op: you haven't inserted anything. Instead, it's a parse error. What happens is:

  1. A copy of the node f(x) is made.
  2. A new child is inserted into this node. This child is a fake node that prints itself out as " ", since that's what you inserted.
  3. The copied node is pretty-printed, producing f(x, ).
  4. The edit is thus taken to be: f(x) => f(x, ).
  5. Hence, parse error.

To fix this, I think we should add a check to see if text is purely whitespace in src/edits/performEdits/edit_insert(). If it is, skip the insert because nothing is being inserted.

TODO:

  • Fix this.
  • Think: will a similar problem plague any other kind of edit? If so, fix that too.
@prestontw
Copy link
Collaborator

They way that I inserted nothing was to just click away. It was pretty surprising that not entering anything resulted in a parse errror!

@schanzer
Copy link
Member

Moved over to bootstrapworld/pyret-blocks#3

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

No branches or pull requests

3 participants