templateVariableNames function

Set<String> templateVariableNames(
  1. String template
)

The names of the var.<name> references inside the sequences of template, in order of first appearance. $${ / %%{ escapes are literal text and the contents of quoted strings inside a sequence are ignored, except for sequences nested in them ("${lower("${var.x}")}").

Implementation

Set<String> templateVariableNames(String template) {
  final out = <String>{};
  for (final body in templateSequenceBodies(template)) {
    for (final m in _variableReference.allMatches(body)) {
      out.add(m.group(1)!);
    }
  }
  return out;
}