@Retention(value=RUNTIME) @Target(value=METHOD) public @interface Refine
Syntax
objects in order to provide or trigger refinement on them.
You can only subscribe to units that are Refinable
, such as RawFunction
and Declaration
.
There are three required parameters. The first parameter is the Refinable
syntax type. The second is of type Grammar
. The third is of type Broadcaster
.
Use the Grammar
instance to obtain sub-parsers and certain grammar tokens as necessary to assist with parsing. Using
Source
may prove of benefit as well. Use the Broadcaster
to broadcast all units that should be auto-associated.
For example, when refining a function you would broadcast one or more Term
s. When refining a selector you would
broadcast one or more SelectorPart
s. Note that when using a built-in parser broadcasting will happen automatically. If
you would like to refine a unit using the standard procedures then you can use one of the delegate methods on the appropriate
plugin, for example DeclarationPlugin#delegateRefinement(Declaration, Grammar, Broadcaster)
. See the main readme file
for more information on custom refinement.
You can optionally add a name to this annotation to scope refinement to units with that name. For example,
@Refine("myFunction")
public void refine(RawFunction function, Grammar grammar, Broadcaster broadcaster}
will only deliver RawFunction
s with the name myFunction. Any Refinable
that is an instance of Named
can be scoped in this manner. This matching is case-insensitive.
All Refine
subscriptions will be delivered before Rework
and Validate
. Only perform refinement inside
of these methods, and prefer to broadcast units instead of directly attaching them to the subscribed unit. Once the subscribed
unit is refined (Refinable#isRefined()
) then subsequent refiners will be skipped.
public abstract String value
Named
units with this name will be delivered.Copyright (c) 2019, Salesforce.com, Inc. All rights reserved. Licensed under the BSD 3-Clause license. For full license text, see the LICENSE file in the repository.