eclipse-langium / langium

Next-gen language engineering / DSL framework
https://langium.org/
MIT License
663 stars 61 forks source link

The `langium@3.1.0` changes broke existing grammars #1558

Closed Yokozuna59 closed 1 week ago

Yokozuna59 commented 1 week ago

Langium version: 3.1.0 Package name: langium

Steps To Reproduce

  1. Create a Hello World example using the generator.
  2. Modify the grammar to has a rule with multiplicity without assigning to any value:

    grammar HelloWorld
    
    entry Model:
    +   ID*
        (persons+=Person | greetings+=Greeting)*;

Link to code example:

The current behavior

The changes after #1401 broke the existing working grammars.

image

image

The expected behavior

No errors.

spoenemann commented 1 week ago

The change is as expected. What is your use case for a multiplicity without an assignment?

I your second example, I'd recommend to create a data type rule:

Newlines returns string: NEWLINE+;

and then use Newlines? instead of NEWLINE*.

We could consider making an exception for terminal rules, though.

msujew commented 1 week ago

@spoenemann I'd argue that we should make an exception for terminal and data type rules.

msujew commented 1 week ago

The latest release (3.1.1) includes a fix for this.

spoenemann commented 1 week ago

What should we do with the milestone assignment in such a case? Assign to v3.1.0 or v3.2.0? No milestone?

I think assigning to v3.1.0 would be most helpful.

msujew commented 1 week ago

I agree, I've added it to the v3.1.0 milestone.