getLineNumberOfMain method
Implementation
int? getLineNumberOfMain(String input) {
// printInfo(input);
// Regex Explanation:
// #\d+ -> Matches the frame number (e.g., #5)
// \s+ -> Matches one or more spaces
// main -> Matches the function name "main"
// \s*\( -> Matches optional space and the opening parenthesis
// .*? -> Non-greedy match for the file path (up to the colon)
// :(\d+) -> Matches the colon and CAPTURES the digits (the line number)
// :\d+ -> Matches the colon and column number (which we ignore)
final regExp = RegExp(r'#(\d+)\s+main\s+\(');
final match = regExp.firstMatch(input);
if (match != null) {
// group(1) contains the captured digits from :(\d+)
// return match.start;
return int.parse(match.group(1)!);
}
return null;
}