mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 12:55:40 +02:00
Bug 537632 - Meson Property Pages missing some fields after configure
- fix MesonPropertyPage logic concerning a configured meson project - for possible values, add "-" and "/" as valid characters - in state flow, don't just wait for blank lines, an option header can occur in the middle of a group or a new option group name can also occur Change-Id: I2c6c8f9fb15db0425f03e422b20b58ace5234fd4
This commit is contained in:
parent
0b2053dcb2
commit
ac81db720c
1 changed files with 136 additions and 104 deletions
|
@ -391,8 +391,8 @@ public class MesonPropertyPage extends PropertyPage {
|
|||
ParseState state = ParseState.INIT;
|
||||
Pattern optionPattern = Pattern.compile(Messages.MesonPropertyPage_option_pattern);
|
||||
Pattern optionWithValuesPattern = Pattern.compile(Messages.MesonPropertyPage_option_with_values_pattern);
|
||||
Pattern optionLine = Pattern.compile("(\\w+)\\s+(\\w+)\\s+(.*)$"); //$NON-NLS-1$
|
||||
Pattern optionWithValuesLine = Pattern.compile("(\\w+)\\s+(\\w+)\\s+\\[(\\w+)((,\\s+\\w+)*)\\]\\s+(.*)$");
|
||||
Pattern optionLine = Pattern.compile("(\\w+)\\s+([\\w,\\-,/]+)\\s+(.*)$"); //$NON-NLS-1$
|
||||
Pattern optionWithValuesLine = Pattern.compile("(\\w+)\\s+([\\w,\\-,/]+)\\s+\\[([\\w,\\-,/]+)((,\\s+[\\w,\\-]+)*)\\]\\s+(.*)$");
|
||||
Pattern compilerOrLinkerArgs = Pattern.compile(Messages.MesonPropertyPage_compiler_or_link_args);
|
||||
Pattern argLine = Pattern.compile("(\\w+)\\s+\\[([^\\]]*)\\]"); //$NON-NLS-1$
|
||||
Pattern groupPattern = Pattern.compile("(([^:]*)):"); //$NON-NLS-1$
|
||||
|
@ -400,6 +400,9 @@ public class MesonPropertyPage extends PropertyPage {
|
|||
Composite parent = composite;
|
||||
for (String line : lines) {
|
||||
line = line.trim();
|
||||
boolean unprocessed = true;
|
||||
while (unprocessed) {
|
||||
unprocessed = false;
|
||||
switch (state) {
|
||||
case INIT:
|
||||
Matcher argMatcher = compilerOrLinkerArgs.matcher(line);
|
||||
|
@ -423,23 +426,33 @@ public class MesonPropertyPage extends PropertyPage {
|
|||
Matcher m = optionPattern.matcher(line);
|
||||
if (m.matches()) {
|
||||
state = ParseState.OPTION;
|
||||
if (parent == composite) {
|
||||
Group group = new Group(composite, SWT.BORDER);
|
||||
group.setLayout(new GridLayout(2, true));
|
||||
group.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
group.setText(groupName);
|
||||
parent = group;
|
||||
}
|
||||
break;
|
||||
}
|
||||
m = optionWithValuesPattern.matcher(line);
|
||||
if (m.matches()) {
|
||||
state = ParseState.OPTION_WITH_VALUES;
|
||||
if (parent == composite) {
|
||||
Group group = new Group(composite, SWT.BORDER);
|
||||
group.setLayout(new GridLayout(2, true));
|
||||
group.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
group.setText(groupName);
|
||||
parent = group;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (line.contains(":")) { //$NON-NLS-1$
|
||||
state = ParseState.INIT;
|
||||
unprocessed = true;
|
||||
parent = composite;
|
||||
}
|
||||
break;
|
||||
case ARGS:
|
||||
Matcher m2 = argLine.matcher(line);
|
||||
|
@ -487,6 +500,15 @@ public class MesonPropertyPage extends PropertyPage {
|
|||
IMesonPropertyPageControl control = new MesonPropertyText(parent, name, value, description);
|
||||
controls.add(control);
|
||||
}
|
||||
} else {
|
||||
if (line.contains(":")) { //$NON-NLS-1$
|
||||
state = ParseState.INIT;
|
||||
parent = composite;
|
||||
unprocessed = true;
|
||||
} else {
|
||||
state = ParseState.GROUP;
|
||||
unprocessed = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case OPTION_WITH_VALUES:
|
||||
|
@ -512,10 +534,20 @@ public class MesonPropertyPage extends PropertyPage {
|
|||
}
|
||||
IMesonPropertyPageControl control = new MesonPropertyCombo(parent, name, values, value, description);
|
||||
controls.add(control);
|
||||
} else {
|
||||
if (line.contains(":")) { //$NON-NLS-1$
|
||||
state = ParseState.INIT;
|
||||
parent = composite;
|
||||
unprocessed = true;
|
||||
} else {
|
||||
state = ParseState.GROUP;
|
||||
unprocessed = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
return controls;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue