parse static method

List<PathKey> parse(
  1. String path
)

path split into keys: names, [n] indices, *. Empty when it isn't a path.

Implementation

static List<PathKey> parse(String path) {
  final out = <PathKey>[];
  for (final part in path.split('.')) {
    final m = _segment.firstMatch(part);
    if (m == null) return const [];
    if (m[1]!.isNotEmpty) out.add(m[1]!);
    for (final i in _index.allMatches(m[2] ?? '')) {
      out.add(int.parse(i[1]!));
    }
    if (m[1]!.isEmpty && (m[2] ?? '').isEmpty) return const [];
  }
  return out;
}