eclipse-langium / langium

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

Error: Composite node contains only hidden nodes #451

Closed spoenemann closed 2 years ago

spoenemann commented 2 years ago
Error:  Error: Composite node contains only hidden nodes
    at RootCstNodeImpl.get lastNonHiddenNode [as lastNonHiddenNode] (node_modules/langium/lib/parser/cst-node-builder.js:157:15)
    at RootCstNodeImpl.get end [as end] (node_modules/langium/lib/parser/cst-node-builder.js:126:25)
    at LangiumParser.addHiddenToken (node_modules/langium/lib/parser/langium-parser.js:60:25)
    at LangiumParser.addHiddenTokens (node_modules/langium/lib/parser/langium-parser.js:55:22)
    at LangiumParser.parse (node_modules/langium/lib/parser/langium-parser.js:43:14)
    at DefaultLangiumDocumentFactory.create (node_modules/langium/lib/workspace/documents.js:75:57)
    at DefaultLangiumDocumentFactory.fromTextDocument (node_modules/langium/lib/workspace/documents.js:57:21)
    at DefaultLangiumDocuments.getOrCreateDocument (node_modules/langium/lib/workspace/documents.js:124:50)
    at node_modules/langium/lib/workspace/document-builder.js:49:77
    at Array.map (<anonymous>) {stack: 'Error: Composite node contains only hidden no…ilder.js:49:77
    at Array.map (<anonymous>)', message: 'Composite node contains only hidden nodes'}

Langium version: 0.3.0 Package name: langium

Steps To Reproduce

Occurred in a closed source project, DM me for reproduction steps.

ballcoach12 commented 2 years ago

@spoenemann, is there a workaround for this issue? I am getting it too, based on the following grammar rule:

entry TemplateLibraryModel:
     (library=TemplateLibrary)    
     (behaviorPackages+=BehaviorPackage)*
 ;
spoenemann commented 2 years ago

No, not yet. We should look into this for the next release.

ballcoach12 commented 2 years ago

OK. For the record, I worked around it using the technique described here