| 26 | } |
| 27 | |
| 28 | bool VariableReferenceParser::parse() |
| 29 | { |
| 30 | int size = m_content.size(); |
| 31 | int curpos = 0; |
| 32 | if (size == 0 || size < 3) { |
| 33 | return true; |
| 34 | } |
| 35 | QChar* it = m_content.data(); |
| 36 | do { |
| 37 | if (it->unicode() == '$' && size > curpos + 2) { |
| 38 | it++; |
| 39 | curpos++; |
| 40 | if (it->unicode() == '$') { |
| 41 | int begin = curpos - 1; |
| 42 | it++; |
| 43 | curpos++; |
| 44 | QString variable; |
| 45 | VariableInfo::VariableType type = VariableInfo::QMakeVariable; |
| 46 | if (it->unicode() == '(') { |
| 47 | do { |
| 48 | it++; |
| 49 | curpos++; |
| 50 | } while (curpos < size && it->unicode() != ')'); |
| 51 | type = VariableInfo::ShellVariableResolveQMake; |
| 52 | variable = m_content.mid(begin + 3, curpos - begin - 3); |
| 53 | ++curpos; |
| 54 | } else if (it->unicode() == '{') { |
| 55 | do { |
| 56 | it++; |
| 57 | curpos++; |
| 58 | if (it->unicode() == '(') { |
| 59 | type = VariableInfo::FunctionCall; |
| 60 | } |
| 61 | } while (curpos < size && it->unicode() != '}'); |
| 62 | variable = m_content.mid(begin + 3, curpos - begin - 3); |
| 63 | ++curpos; |
| 64 | } else if (it->unicode() == '[') { |
| 65 | do { |
| 66 | it++; |
| 67 | curpos++; |
| 68 | } while (curpos < size && it->unicode() != ']'); |
| 69 | type = VariableInfo::QtConfigVariable; |
| 70 | variable = m_content.mid(begin + 3, curpos - begin - 3); |
| 71 | ++curpos; |
| 72 | } else { |
| 73 | do { |
| 74 | it++; |
| 75 | curpos++; |
| 76 | } while (curpos < size && isVarNameChar(it)); |
| 77 | variable = m_content.mid(begin + 2, curpos - begin - 2); |
| 78 | |
| 79 | if (it->unicode() == '(') { |
| 80 | type = VariableInfo::FunctionCall; |
| 81 | int braceCount = 0; |
| 82 | do { |
| 83 | it++; |
| 84 | curpos++; |
| 85 | if (it->unicode() == ')') { |
nothing calls this directly
no test coverage detected