mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 18:26:01 +02:00
[280607] - Extracted patterns into static variables.
This commit is contained in:
parent
444ae7cb4c
commit
88a1ce45c2
1 changed files with 7 additions and 4 deletions
|
@ -28,6 +28,11 @@ import java.util.regex.Pattern;
|
||||||
*/
|
*/
|
||||||
public class CLIInfoThreadsInfo extends MIInfo {
|
public class CLIInfoThreadsInfo extends MIInfo {
|
||||||
|
|
||||||
|
private static final Pattern RESULT_PATTERN_LWP = Pattern.compile(
|
||||||
|
"(^\\*?\\s*\\d+)(\\s*[Tt][Hh][Rr][Ee][Aa][Dd]\\s*)(0x[0-9a-fA-F]+|-?\\d+)(\\s*\\([Ll][Ww][Pp]\\s*)(\\d*)", Pattern.MULTILINE); //$NON-NLS-1$
|
||||||
|
|
||||||
|
private static final Pattern RESULT_PATTERN = Pattern.compile(
|
||||||
|
"(^\\*?\\s*\\d+)(\\s*[Tt][Hh][Rr][Ee][Aa][Dd]\\s*)(\\S+(\\s*\\(.*?\\))?)", Pattern.MULTILINE); //$NON-NLS-1$
|
||||||
protected List<ThreadInfo> info;
|
protected List<ThreadInfo> info;
|
||||||
|
|
||||||
public CLIInfoThreadsInfo(MIOutput out) {
|
public CLIInfoThreadsInfo(MIOutput out) {
|
||||||
|
@ -103,8 +108,7 @@ public class CLIInfoThreadsInfo extends MIInfo {
|
||||||
// default to the more general algorithm.
|
// default to the more general algorithm.
|
||||||
|
|
||||||
if(str.length() > 0 ){
|
if(str.length() > 0 ){
|
||||||
Pattern pattern = Pattern.compile("(^\\*?\\s*\\d+)(\\s*[Tt][Hh][Rr][Ee][Aa][Dd]\\s*)(0x[0-9a-fA-F]+|-?\\d+)(\\s*\\([Ll][Ww][Pp]\\s*)(\\d*)", Pattern.MULTILINE); //$NON-NLS-1$
|
Matcher matcher = RESULT_PATTERN_LWP.matcher(str);
|
||||||
Matcher matcher = pattern.matcher(str);
|
|
||||||
boolean isCurrentThread = false;
|
boolean isCurrentThread = false;
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
String id = matcher.group(1).trim();
|
String id = matcher.group(1).trim();
|
||||||
|
@ -115,8 +119,7 @@ public class CLIInfoThreadsInfo extends MIInfo {
|
||||||
info.add(new ThreadInfo(id, matcher.group(5), "", isCurrentThread)); //$NON-NLS-1$
|
info.add(new ThreadInfo(id, matcher.group(5), "", isCurrentThread)); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pattern = Pattern.compile("(^\\*?\\s*\\d+)(\\s*[Tt][Hh][Rr][Ee][Aa][Dd]\\s*)(\\S+(\\s*\\(.*?\\))?)", Pattern.MULTILINE); //$NON-NLS-1$
|
matcher = RESULT_PATTERN_LWP.matcher(str);
|
||||||
matcher = pattern.matcher(str);
|
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
String id = matcher.group(1).trim();
|
String id = matcher.group(1).trim();
|
||||||
if (id.charAt(0) == '*') {
|
if (id.charAt(0) == '*') {
|
||||||
|
|
Loading…
Add table
Reference in a new issue