Args.fromString constructor
Args.fromString(
- String arg
Implementation
factory Args.fromString(String arg) {
final List<String> args = [];
String state_data = "";
for (var i = 0; i < arg.length; i++) {
String loop_data = arg[i];
if (state_data.isNotEmpty) {
void addStateData(String end_data, int index) {
for (var index_state = index;
index_state < arg.length;
index_state++) {
if (index_state == arg.length - 1) {
state_data += arg[index_state];
i = index_state;
args.add(state_data);
state_data = "";
break;
} else if (RegExp(end_data, caseSensitive: false)
.hashData(arg[index_state])) {
if (end_data == " ") {
} else {
state_data += arg[index_state];
}
i = index_state;
args.add(state_data);
state_data = "";
break;
} else {
state_data += arg[index_state];
}
}
}
while (true) {
if (state_data.isEmpty) {
break;
}
String state_data_first = state_data[0];
if (RegExp("([-+=])", caseSensitive: false)
.hashData(state_data_first)) {
addStateData(" ", i);
break;
} else if (RegExp("([\"'`])", caseSensitive: false)
.hashData(state_data_first)) {
addStateData(state_data_first, i);
break;
} else {
addStateData(" ", i);
break;
}
}
} else {
if (loop_data != " ") {
state_data += loop_data;
}
}
}
return Args(args);
}