parse method

String? parse()

Implementation

String? parse() {
  if (!isTransform) {
    return null;
  }

  if (!_transformValidator.hasMatch(_transform!))
    return '/// illegal or unsupported transform: $_transform';
  final Iterable<Match> matches =
      _transformCommand.allMatches(_transform!).toList().reversed;
  StringBuffer result = StringBuffer();
  result.writeln('Matrix4.identity()');
  for (Match m in matches) {
    final String command = m.group(1)!.trim();
    final String? params = m.group(2);

    final _MatrixParser? transformer = _matrixParsers[command];
    if (transformer == null) {
      result.writeln('/// command not supported');
    }

    result.writeln('${transformer!(params)}');
  }
  result.write('.storage');
  return result.toString();
}