mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-02 13:55:39 +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;
|
ParseState state = ParseState.INIT;
|
||||||
Pattern optionPattern = Pattern.compile(Messages.MesonPropertyPage_option_pattern);
|
Pattern optionPattern = Pattern.compile(Messages.MesonPropertyPage_option_pattern);
|
||||||
Pattern optionWithValuesPattern = Pattern.compile(Messages.MesonPropertyPage_option_with_values_pattern);
|
Pattern optionWithValuesPattern = Pattern.compile(Messages.MesonPropertyPage_option_with_values_pattern);
|
||||||
Pattern optionLine = Pattern.compile("(\\w+)\\s+(\\w+)\\s+(.*)$"); //$NON-NLS-1$
|
Pattern optionLine = Pattern.compile("(\\w+)\\s+([\\w,\\-,/]+)\\s+(.*)$"); //$NON-NLS-1$
|
||||||
Pattern optionWithValuesLine = Pattern.compile("(\\w+)\\s+(\\w+)\\s+\\[(\\w+)((,\\s+\\w+)*)\\]\\s+(.*)$");
|
Pattern optionWithValuesLine = Pattern.compile("(\\w+)\\s+([\\w,\\-,/]+)\\s+\\[([\\w,\\-,/]+)((,\\s+[\\w,\\-]+)*)\\]\\s+(.*)$");
|
||||||
Pattern compilerOrLinkerArgs = Pattern.compile(Messages.MesonPropertyPage_compiler_or_link_args);
|
Pattern compilerOrLinkerArgs = Pattern.compile(Messages.MesonPropertyPage_compiler_or_link_args);
|
||||||
Pattern argLine = Pattern.compile("(\\w+)\\s+\\[([^\\]]*)\\]"); //$NON-NLS-1$
|
Pattern argLine = Pattern.compile("(\\w+)\\s+\\[([^\\]]*)\\]"); //$NON-NLS-1$
|
||||||
Pattern groupPattern = Pattern.compile("(([^:]*)):"); //$NON-NLS-1$
|
Pattern groupPattern = Pattern.compile("(([^:]*)):"); //$NON-NLS-1$
|
||||||
|
@ -400,6 +400,9 @@ public class MesonPropertyPage extends PropertyPage {
|
||||||
Composite parent = composite;
|
Composite parent = composite;
|
||||||
for (String line : lines) {
|
for (String line : lines) {
|
||||||
line = line.trim();
|
line = line.trim();
|
||||||
|
boolean unprocessed = true;
|
||||||
|
while (unprocessed) {
|
||||||
|
unprocessed = false;
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case INIT:
|
case INIT:
|
||||||
Matcher argMatcher = compilerOrLinkerArgs.matcher(line);
|
Matcher argMatcher = compilerOrLinkerArgs.matcher(line);
|
||||||
|
@ -423,23 +426,33 @@ public class MesonPropertyPage extends PropertyPage {
|
||||||
Matcher m = optionPattern.matcher(line);
|
Matcher m = optionPattern.matcher(line);
|
||||||
if (m.matches()) {
|
if (m.matches()) {
|
||||||
state = ParseState.OPTION;
|
state = ParseState.OPTION;
|
||||||
|
if (parent == composite) {
|
||||||
Group group = new Group(composite, SWT.BORDER);
|
Group group = new Group(composite, SWT.BORDER);
|
||||||
group.setLayout(new GridLayout(2, true));
|
group.setLayout(new GridLayout(2, true));
|
||||||
group.setLayoutData(new GridData(GridData.FILL_BOTH));
|
group.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||||
group.setText(groupName);
|
group.setText(groupName);
|
||||||
parent = group;
|
parent = group;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
m = optionWithValuesPattern.matcher(line);
|
m = optionWithValuesPattern.matcher(line);
|
||||||
if (m.matches()) {
|
if (m.matches()) {
|
||||||
state = ParseState.OPTION_WITH_VALUES;
|
state = ParseState.OPTION_WITH_VALUES;
|
||||||
|
if (parent == composite) {
|
||||||
Group group = new Group(composite, SWT.BORDER);
|
Group group = new Group(composite, SWT.BORDER);
|
||||||
group.setLayout(new GridLayout(2, true));
|
group.setLayout(new GridLayout(2, true));
|
||||||
group.setLayoutData(new GridData(GridData.FILL_BOTH));
|
group.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||||
group.setText(groupName);
|
group.setText(groupName);
|
||||||
parent = group;
|
parent = group;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (line.contains(":")) { //$NON-NLS-1$
|
||||||
|
state = ParseState.INIT;
|
||||||
|
unprocessed = true;
|
||||||
|
parent = composite;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case ARGS:
|
case ARGS:
|
||||||
Matcher m2 = argLine.matcher(line);
|
Matcher m2 = argLine.matcher(line);
|
||||||
|
@ -487,6 +500,15 @@ public class MesonPropertyPage extends PropertyPage {
|
||||||
IMesonPropertyPageControl control = new MesonPropertyText(parent, name, value, description);
|
IMesonPropertyPageControl control = new MesonPropertyText(parent, name, value, description);
|
||||||
controls.add(control);
|
controls.add(control);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (line.contains(":")) { //$NON-NLS-1$
|
||||||
|
state = ParseState.INIT;
|
||||||
|
parent = composite;
|
||||||
|
unprocessed = true;
|
||||||
|
} else {
|
||||||
|
state = ParseState.GROUP;
|
||||||
|
unprocessed = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OPTION_WITH_VALUES:
|
case OPTION_WITH_VALUES:
|
||||||
|
@ -512,10 +534,20 @@ public class MesonPropertyPage extends PropertyPage {
|
||||||
}
|
}
|
||||||
IMesonPropertyPageControl control = new MesonPropertyCombo(parent, name, values, value, description);
|
IMesonPropertyPageControl control = new MesonPropertyCombo(parent, name, values, value, description);
|
||||||
controls.add(control);
|
controls.add(control);
|
||||||
|
} else {
|
||||||
|
if (line.contains(":")) { //$NON-NLS-1$
|
||||||
|
state = ParseState.INIT;
|
||||||
|
parent = composite;
|
||||||
|
unprocessed = true;
|
||||||
|
} else {
|
||||||
|
state = ParseState.GROUP;
|
||||||
|
unprocessed = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
return controls;
|
return controls;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue