Update rive-cpp to 2.0 version
[platform/core/uifw/rive-tizen.git] / submodule / rive-cpp / dev / core_generator / lib / src / comment.dart
1 RegExp _makeWrappingRegExp(int width) {
2   //return RegExp('(?![^\n]{1,$width}\$)([^\n]{1,$width})\s');
3   return RegExp('(.{1,$width})( +|\$\n?)|(.{1,$width})');
4 }
5
6 Map<int, RegExp> _indentRegexp = {};
7 String comment(String s, {int indent = 0}) {
8   var reg = _indentRegexp[indent];
9   if (reg == null) {
10     _indentRegexp[indent] = reg = _makeWrappingRegExp(80 - 4 - 2 * indent);
11   }
12
13   return "/// " +
14       s
15           .replaceAllMapped(reg, (Match m) => "${m[1]}${m[2]}\n")
16           .trim()
17           .split("\n")
18           .join("\n  /// ") +
19       "\n";
20 }
21
22 String capitalize(String s) => s[0].toUpperCase() + s.substring(1);