getMatches function
Returns a list of all the matched tokens from a "Bakefile".
Implementation
List<String> getMatches(String arguments) {
List<String> result = [];
for (int i = 0; i < patterns().length; i++) {
String key = patterns().keys.elementAt(i);
RegExp pattern = patterns()[key] as RegExp;
assert(pattern is RegExp);
if (pattern.hasMatch(arguments) == true) {
if (key == 'COMMENT') {
} else if (arguments == '\n') {
} else {
Iterable<Match> matches = pattern.allMatches(arguments);
assert(matches is Iterable<Match>);
Match myMatch = matches.elementAt(0);
String firstArg = myMatch.group(1) as String;
assert(firstArg is String);
String secondArg = myMatch.group(2) as String;
assert(secondArg is String);
result.add(firstArg);
result.add(secondArg);
}
} else {}
}
return result;
}