| 13 | } |
| 14 | |
| 15 | std::vector<cmGeneratorExpressionToken> cmGeneratorExpressionLexer::Tokenize( |
| 16 | std::string const& input) |
| 17 | { |
| 18 | std::vector<cmGeneratorExpressionToken> result; |
| 19 | |
| 20 | if (input.find('$') == std::string::npos) { |
| 21 | result.emplace_back(cmGeneratorExpressionToken::Text, input.c_str(), |
| 22 | input.size()); |
| 23 | return result; |
| 24 | } |
| 25 | |
| 26 | char const* c = input.c_str(); |
| 27 | char const* upto = c; |
| 28 | |
| 29 | for (; *c; ++c) { |
| 30 | switch (*c) { |
| 31 | case '$': |
| 32 | if (c[1] == '<') { |
| 33 | InsertText(upto, c, result); |
| 34 | result.emplace_back(cmGeneratorExpressionToken::BeginExpression, c, |
| 35 | 2); |
| 36 | upto = c + 2; |
| 37 | ++c; |
| 38 | this->SawBeginExpression = true; |
| 39 | } |
| 40 | break; |
| 41 | case '>': |
| 42 | InsertText(upto, c, result); |
| 43 | result.emplace_back(cmGeneratorExpressionToken::EndExpression, c, 1); |
| 44 | upto = c + 1; |
| 45 | this->SawGeneratorExpression = this->SawBeginExpression; |
| 46 | break; |
| 47 | case ':': |
| 48 | InsertText(upto, c, result); |
| 49 | result.emplace_back(cmGeneratorExpressionToken::ColonSeparator, c, 1); |
| 50 | upto = c + 1; |
| 51 | break; |
| 52 | case ',': |
| 53 | InsertText(upto, c, result); |
| 54 | result.emplace_back(cmGeneratorExpressionToken::CommaSeparator, c, 1); |
| 55 | upto = c + 1; |
| 56 | break; |
| 57 | default: |
| 58 | break; |
| 59 | } |
| 60 | } |
| 61 | InsertText(upto, c, result); |
| 62 | |
| 63 | return result; |
| 64 | } |
no test coverage detected