summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-01-25 19:52:55 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-01-25 19:52:55 (GMT)
commit57a4353c8e082dfc0f536a1e642e4a8df0e5b9c9 (patch)
tree0adc68c6df9643f4b4d5de156cb2870b1cc65755 /qmake
parentac798c5d77c59ea8dfe29c9d1896fb6604e3a628 (diff)
parente881b19ba3f2f4bfda460e1a043f461fb0517d70 (diff)
downloadQt-57a4353c8e082dfc0f536a1e642e4a8df0e5b9c9.zip
Qt-57a4353c8e082dfc0f536a1e642e4a8df0e5b9c9.tar.gz
Qt-57a4353c8e082dfc0f536a1e642e4a8df0e5b9c9.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-1: Added scrollbars support to the Linguist form preview. interpret backslash escaping of quotes in split_arg_list() cleanup split_arg_list() some more slightly reorganize split_arg_list() remove the somewhat bizarre unquoting of the last argument in split_arg_list() remove the completely insane quote nesting from split_value_list()
Diffstat (limited to 'qmake')
-rw-r--r--qmake/project.cpp77
1 files changed, 37 insertions, 40 deletions
diff --git a/qmake/project.cpp b/qmake/project.cpp
index f314b8b..88d5962 100644
--- a/qmake/project.cpp
+++ b/qmake/project.cpp
@@ -237,57 +237,54 @@ static QStringList split_arg_list(QString params)
const ushort RPAREN = ')';
const ushort SINGLEQUOTE = '\'';
const ushort DOUBLEQUOTE = '"';
+ const ushort BACKSLASH = '\\';
const ushort COMMA = ',';
const ushort SPACE = ' ';
//const ushort TAB = '\t';
- ushort unicode;
const QChar *params_data = params.data();
const int params_len = params.length();
- int last = 0;
- while(last < params_len && (params_data[last].unicode() == SPACE
- /*|| params_data[last].unicode() == TAB*/))
- ++last;
- for(int x = last, parens = 0; x <= params_len; x++) {
- unicode = params_data[x].unicode();
- if(x == params_len) {
- while(x && params_data[x-1].unicode() == SPACE)
- --x;
- QString mid(params_data+last, x-last);
- if(quote) {
- if(mid[0] == quote && mid[(int)mid.length()-1] == quote)
- mid = mid.mid(1, mid.length()-2);
+ for(int last = 0; ;) {
+ while(last < params_len && (params_data[last].unicode() == SPACE
+ /*|| params_data[last].unicode() == TAB*/))
+ ++last;
+ for(int x = last, parens = 0; ; x++) {
+ if(x == params_len) {
+ while(x > last && params_data[x-1].unicode() == SPACE)
+ --x;
+ args << params.mid(last, x - last);
+ return args;
+ }
+ ushort unicode = params_data[x].unicode();
+ if(x != (int)params_len-1 && unicode == BACKSLASH &&
+ (params_data[x+1].unicode() == SINGLEQUOTE || params_data[x+1].unicode() == DOUBLEQUOTE)) {
+ x++; //get that 'escape'
+ } else if(quote && unicode == quote) {
quote = 0;
+ } else if(!quote && (unicode == SINGLEQUOTE || unicode == DOUBLEQUOTE)) {
+ quote = unicode;
+ } else if(unicode == RPAREN) {
+ --parens;
+ } else if(unicode == LPAREN) {
+ ++parens;
+ }
+ if(!parens && !quote && unicode == COMMA) {
+ int prev = last;
+ last = x+1;
+ while(x > prev && params_data[x-1].unicode() == SPACE)
+ --x;
+ args << params.mid(prev, x - prev);
+ break;
}
- args << mid;
- break;
- }
- if(unicode == LPAREN) {
- --parens;
- } else if(unicode == RPAREN) {
- ++parens;
- } else if(quote && unicode == quote) {
- quote = 0;
- } else if(!quote && (unicode == SINGLEQUOTE || unicode == DOUBLEQUOTE)) {
- quote = unicode;
- }
- if(!parens && !quote && unicode == COMMA) {
- QString mid = params.mid(last, x - last).trimmed();
- args << mid;
- last = x+1;
- while(last < params_len && (params_data[last].unicode() == SPACE
- /*|| params_data[last].unicode() == TAB*/))
- ++last;
}
}
- return args;
}
static QStringList split_value_list(const QString &vals)
{
QString build;
QStringList ret;
- QStack<char> quote;
+ ushort quote = 0;
const ushort LPAREN = '(';
const ushort RPAREN = ')';
@@ -303,17 +300,17 @@ static QStringList split_value_list(const QString &vals)
if(x != (int)vals_len-1 && unicode == BACKSLASH &&
(vals_data[x+1].unicode() == SINGLEQUOTE || vals_data[x+1].unicode() == DOUBLEQUOTE)) {
build += vals_data[x++]; //get that 'escape'
- } else if(!quote.isEmpty() && unicode == quote.top()) {
- quote.pop();
- } else if(unicode == SINGLEQUOTE || unicode == DOUBLEQUOTE) {
- quote.push(unicode);
+ } else if(quote && unicode == quote) {
+ quote = 0;
+ } else if(!quote && (unicode == SINGLEQUOTE || unicode == DOUBLEQUOTE)) {
+ quote = unicode;
} else if(unicode == RPAREN) {
--parens;
} else if(unicode == LPAREN) {
++parens;
}
- if(!parens && quote.isEmpty() && (vals_data[x] == Option::field_sep)) {
+ if(!parens && !quote && (vals_data[x] == Option::field_sep)) {
ret << build;
build.clear();
} else {