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

A collection of specs which produce generic "could not parse module" errors #145

Closed
ahelwer opened this issue Feb 19, 2018 · 14 comments
Closed
Labels
enhancement Lets change things for the better help wanted We need your help Tools The command line tools - TLC, SANY, ...
Milestone

Comments

@ahelwer
Copy link
Contributor

ahelwer commented Feb 19, 2018

This code gives a generic "Could not parse module" error:

----------------------------- MODULE ParseError -----------------------------
VARIABLE x

Init ==
    /\ x = IF "foo" == "foo" THEN "bar" ELSE "foo"

=============================================================================

The error is the use of == instead of =, an easy mistake for a new user (or long-time user, in this case!) to make. Ideally the parser would identify the error in a user-friendly way.

@ahelwer
Copy link
Contributor Author

ahelwer commented Feb 19, 2018

I have found another generic parse error, with this code:

----------------------------- MODULE ParseError -----------------------------
VARIABLE x

Init ==
    /\ x = [n \in {1,2,3,4,5} : n]

=============================================================================

The : should of course be |->, but this is a real typo I made which resulted in a generic parse error. Recording this because these real-world experience issues aren't very valuable until someone wants to go through and fix all the generic parse errors, then they become super valuable.

@ahelwer
Copy link
Contributor Author

ahelwer commented Feb 19, 2018

Another. Here, I stubbed out a function with a constant value then forgot to remove the constant value after implementing it.

----------------------------- MODULE ParseError -----------------------------

F(x) == 0   \* Stub value I forgot to remove after writing function
    IF x == 0 THEN 1 ELSE 0

=============================================================================

@lemmy lemmy added enhancement Lets change things for the better Tools The command line tools - TLC, SANY, ... labels Feb 19, 2018
@ahelwer
Copy link
Contributor Author

ahelwer commented Feb 19, 2018

This generic parse error occurs when forgetting a comma while defining a new record value:

----------------------------- MODULE ParseError -----------------------------

Def == [foo |-> "foo" bar |-> "bar"]

=============================================================================

@ahelwer
Copy link
Contributor Author

ahelwer commented Feb 20, 2018

Here there's a generic parse error when leaving a dangling comma after the list of variables (encountered when deleting/reordering variables):

----------------------------- MODULE ParseError -----------------------------

VARIABLES
    Foo,
    Bar,

=============================================================================

@ahelwer
Copy link
Contributor Author

ahelwer commented Feb 20, 2018

A generic parse error occurs if the terminating line of ==...== is somehow deleted (recalling this one from my TA experiences in a TLA+ course - it actually took me a while to debug!)

----------------------------- MODULE ParseError -----------------------------

VARIABLES
    Foo,
    Bar

@ahelwer ahelwer changed the title Generic parse error when using == instead of = inside IF-THEN-ELSE block A collection of specs which produce generic "could not parse module" errors Feb 20, 2018
@lemmy lemmy added the help wanted We need your help label Feb 20, 2018
@lemmy
Copy link
Member

lemmy commented Feb 22, 2018

Missing parenthesis at "Cardinality(ProcSet" leads to generic parser error.

--------------- MODULE ParseError -------------

Inv == Cardinality(waitset) < Cardinality(ProcSet /\ waitset \subseteq ProcSet

===================================================

@ahelwer
Copy link
Contributor Author

ahelwer commented Mar 8, 2018

Using only one = in a LET causes a generic parser error

----------------------------- MODULE ParseError -----------------------------

Def ==
    LET x = 5 IN
    TRUE

=============================================================================

@ahelwer
Copy link
Contributor Author

ahelwer commented Mar 8, 2018

Using only one = in any definition causes a generic parser error

----------------------------- MODULE ParseError -----------------------------

Def = TRUE

=============================================================================

@ahelwer
Copy link
Contributor Author

ahelwer commented Mar 8, 2018

Forgetting to delete the multi-line comment closing symbols causes a generic parser error

----------------------------- MODULE ParseError -----------------------------

Def == TRUE *)

=============================================================================

@ahelwer
Copy link
Contributor Author

ahelwer commented Mar 8, 2018

Forgetting an ELSE in and IF-THEN-ELSE statement causes a generic parser error

----------------------------- MODULE ParseError -----------------------------

Def == IF "foo" = "foo" THEN "bar"

=============================================================================

@lestarcdog
Copy link

lestarcdog commented Apr 1, 2018

@ahelwer I have the same issue with the 1.5.6 version.
The previous version 1.5.4 displays correctly the specific parse error messages. So I think it is a regression issue.

@lemmy
Copy link
Member

lemmy commented Apr 1, 2018

@lestarcdog Can you check if the current nightly still show the regression?

@lestarcdog
Copy link

@lemmy The regression issue is gone in the 1.5.7 version. The Parsing Errors panel shows the specific error message and also the error is highlighted in the editor.

Thanks.

@lemmy lemmy added this to the 1.5.7 milestone May 16, 2018
@lemmy
Copy link
Member

lemmy commented May 16, 2018

Fixed with commit 77f1c69

@lemmy lemmy closed this as completed May 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Lets change things for the better help wanted We need your help Tools The command line tools - TLC, SANY, ...
Projects
None yet
Development

No branches or pull requests

3 participants