Open rkrzewski opened 11 years ago
I have built a lexical analyzer using JFlex and right now it's able to distinguish well formed and malformed filter expressions. Now I need to augment it with AST building.
Filter parsing is needed in osg.osgi.service.respository implementations. Maybe it would good idea to expose it in Bindex API somehow? OTOH I don't want to make it a kitchen sink...
I've encountered an unwelcome complication with implementation of osgi.ee and osgi.wiring.host requirements. I had to parse and filter directives and rewrite them into other forms. You can see the unwieldy and brittle solution here
It would be much better if the analyzers stored the filters in an object form, and writers converted them to just before writing them out. Unfortunately filters are directives and Capability/Requirement store directives as Map<String,String>, so I don't see a way of fixing it from this end without introducing additional internal API beyond org.osgi.resource
An alternative would be writing a proper parser for filters with AST and Visitor pattern. The grammar is very simple so this should be easy.