silver
silver copied to clipboard
Have a way to access declarations (types, productions, ...) not imported in current grammar
There's a need in a number of places to access information about things that aren't visible in the environment they are used in. For example: what are all the productions of a nonterminal (in all packages)? is a nonterminal only visible via a production (import ... only ...
) closed? what's the source location of a nonterminal type referenced in a doc comment?
There's some duplication of effort in Dawn's work on #317 and the existing docs work/my work on #252 where we're bubbling up info from multiple grammars and then passing it back down. But both of these are done in extensions and are domain specific (Dawn's collects only production names and arity, docs collects only name and location.) A general implementation collecting all relevant implementation in core could be used to replace both of these. It might also let us make the mwda stuff more useful by not having to import all grammars you want to test, move the trackedness of nonterminals out of their type and back into their decl, allow users to request nonterminals in other grammars to be tracked, etc.
Note that import ... only ...
doesn't affect whether or not things get imported, it only controls whether their short name gets put in the env. In your example, the nonterminal would still be imported, but only as its fully-qualified name.
I ended up being able to use the flow environment for #317, so that isn't doing any collecting of information.