public final class MacroFinder extends Object
Examples: $(exe //foo:bar) $(location :bar) $(platform)
Modifier and Type | Method and Description |
---|---|
static com.google.common.collect.ImmutableList<MacroMatchResult> |
findAll(com.google.common.collect.ImmutableSet<String> macros,
String blob) |
static Optional<MacroMatchResult> |
match(com.google.common.collect.ImmutableSet<String> macros,
String blob) |
static <T> T |
replace(com.google.common.collect.ImmutableMap<String,MacroReplacer<T>> replacers,
String blob,
boolean resolveEscaping,
MacroCombiner<T> combiner)
Expand macros embedded in a string.
|
public static Optional<MacroMatchResult> match(com.google.common.collect.ImmutableSet<String> macros, String blob) throws MacroException
MacroException
public static <T> T replace(com.google.common.collect.ImmutableMap<String,MacroReplacer<T>> replacers, String blob, boolean resolveEscaping, MacroCombiner<T> combiner) throws MacroException
replacers
- a map of macro names to MacroReplacer
objects used to expand them.blob
- the input string containing macros to be expandedresolveEscaping
- whether to drop characters used to escape literal uses of `$(...)`MacroException
public static com.google.common.collect.ImmutableList<MacroMatchResult> findAll(com.google.common.collect.ImmutableSet<String> macros, String blob) throws MacroException
MacroException