Strumenta / kolasu

Kotlin Language Support – AST Library
Apache License 2.0
109 stars 11 forks source link

Relax constraints for Kolasu parser instantiators #359

Closed loradd closed 1 month ago

loradd commented 1 month ago

When instantiating a parser, a corresponding instantiator is used at the moment. In order to implement a custom one, we can implement the KolasuParserInstantiator interface and bind it in our starlasu-conf.yaml file.

The current KolasuParserInstantiator can only be used with parsers extending KolasuParser and it would be nice to relax this constraint to ASTParser. For example, this would allow to use parser instantiators in the RPG parser project - where the main parser does not extend KolasuParser.

Using ASTParser instead of KolasuParser would still work as no methods or property specific of this last one is currently used. Indeed, we invoke the parse method on the instantiated parser and this method is inherited from ASTParser.

A possible solution to avoid breaking existing instantiators could consist in introducing an ASTParserInstantiator interface and make the KolasuParserInstantiator extend it.

Also see: https://github.com/Strumenta/starlasu-tools/issues/106

loradd commented 1 month ago

I am currently working from the branch maintenance/kolasu15. Is this correct? @ftomassetti

ftomassetti commented 1 month ago

I am currently working from the branch maintenance/kolasu15. Is this correct? @ftomassetti

Yes, it is, thank you. We will then merge maintenance/kolasu15 into main