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

fleche: fix terminator tokens #136

Closed
wants to merge 1 commit into from
Closed

fleche: fix terminator tokens #136

wants to merge 1 commit into from

Conversation

artagnon
Copy link
Collaborator

@artagnon artagnon commented Jan 2, 2023

Add "end", and remove "..." and BULLET.

@Alizter
Copy link
Collaborator

Alizter commented Jan 2, 2023

Why remove ... and bullet?

@artagnon
Copy link
Collaborator Author

artagnon commented Jan 2, 2023

Try T2048.v on master and this branch. The error recovery codepath is broken with ... and bullet.

@artagnon artagnon changed the title doc: fix terminator tokens fleche: fix terminator tokens, improve debug Jan 2, 2023
@ejgallego ejgallego self-assigned this Jan 2, 2023
@Alizter
Copy link
Collaborator

Alizter commented Jan 3, 2023

@ejgallego I would like to understand the role of terminator tokens. As it stands, my assumptions are anything we can consider terminating a Coq "sentence". This is why the removal of such tokens doesn't make sense to me. However, if the role of these tokens is otherwise, we should make that clear in the code.

@artagnon
Copy link
Collaborator Author

artagnon commented Jan 3, 2023

The code is clear: we're just matching against the next token on Gramlib.Stream: BULLET isn't a terminator token because of |-, and I assume ... isn't different from three consecutive . s; I've never seen a ..., so I can't be sure.

@ejgallego
Copy link
Owner

First, I see 3 quite different kind of changes in this PR, that makes review pretty hard, please submit one PR for each change.

The parsing recovery heuristic is just a heuristic, however I'm unsure I understand the problem here, in particular why to remove ..., can we have a self-contained test-case?

@ejgallego
Copy link
Owner

Actually seeing your comment about |- , I think you have been bitten by a different bug, which is Coq parser getting broken due to coq/coq#12575

If you have coq-lsp loading in a file ssreflect, and then trying to parse a different file, you'll get plenty of errors.

Can you confirm the weird stuff happens after you restart the server with just one file open?

ejgallego added a commit that referenced this pull request Jan 3, 2023
…ocument changes

This should help with #124.

Note that this will make the changes in #136 to use `find_opt` easier.
Add "end", and remove BULLET.
@artagnon
Copy link
Collaborator Author

artagnon commented Jan 3, 2023

I've re-added ..., but BULLET is problematic on T2048.v: I get syntax errors near |-.

@artagnon artagnon changed the title fleche: fix terminator tokens, improve debug fleche: fix terminator tokens Jan 3, 2023
@ejgallego
Copy link
Owner

I've re-added ..., but BULLET is problematic on T2048.v: I get syntax errors near |-.

The file should check without errors, are you sure it is not the problem I mentioned above?

ejgallego added a commit that referenced this pull request Jan 3, 2023
…ocument changes

This should help with #124.

Note that this will make the changes in #136 to use `find_opt` easier.
ejgallego added a commit that referenced this pull request Jan 3, 2023
Extracted from #141 as not to block other works.

This will make the changes in #136 to use `find_opt` much easier.
ejgallego added a commit that referenced this pull request Jan 3, 2023
…ocument changes

This should help with #124.

Note that this will make the changes in #136 to use `find_opt` easier.
ejgallego added a commit that referenced this pull request Jan 3, 2023
…ocument changes

This should help with #124.

Note that this will make the changes in #136 to use `find_opt` easier.
@artagnon
Copy link
Collaborator Author

artagnon commented Jan 3, 2023

Yeah, it seems flaky; seemed to work better with my patch at the time of writing.

Copy link
Owner

@ejgallego ejgallego left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid the issue that @artagnon has seen is orthogonal to this patch.

Files failing to parse properly is due to some yet unsolved bug with coq-lsp or Coq management of the parsing state.

Tok.BULLET is a valid (and worthwhile) parsing recovery point and should not be removed from the heuristic.

@ejgallego
Copy link
Owner

In particular @artagnon parsing will go mad when coq-lsp loads the ssreflect plugin in some other buffer, but the bug is general.

@artagnon artagnon closed this Jan 3, 2023
@artagnon artagnon deleted the fix-terminators branch January 3, 2023 18:53
@ejgallego
Copy link
Owner

Yeah, it seems flaky; seemed to work better with my patch at the time of writing.

Restarting coq-lsp usually solves this if you don't load the ssreflect plugin (or any other syntax heavy plugin) first. So it seems that the problem is solved with the patch, but that codepath is never reached in the first place.

@ejgallego
Copy link
Owner

That bug is actually driving me crazy, I can reproduce reliably by loading ex0.v and then RTrigo.

Maybe Print Grammar will show what the problem is?

@artagnon
Copy link
Collaborator Author

artagnon commented Jan 3, 2023

Does this patch help?

@artagnon
Copy link
Collaborator Author

artagnon commented Jan 3, 2023

Nack, it doesn't. I just checked.

@ejgallego
Copy link
Owner

See coq/coq#12575 (comment) , somehow sometimes keywords disappear and that's what causes the problem, in particular you say that |- not being a keyword, the mess was giant.

ejgallego added a commit that referenced this pull request Jan 11, 2023
…ocument changes

This should help with #124.

Note that this will make the changes in #136 to use `find_opt` easier.
ejgallego added a commit that referenced this pull request Jan 11, 2023
…ocument changes

This should help with #124.

Note that this will make the changes in #136 to use `find_opt` easier.
ejgallego added a commit that referenced this pull request Jan 11, 2023
…ocument changes

This should help with #124.

Note that this will make the changes in #136 to use `find_opt` easier.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants