| 61 | } |
| 62 | |
| 63 | bool SurveyTargetExpressionParser::parse(const QString &s) |
| 64 | { |
| 65 | delete m_expression; |
| 66 | m_expression = nullptr; |
| 67 | |
| 68 | #ifdef HAVE_SURVEY_TARGET_EXPRESSIONS |
| 69 | yyscan_t scanner; |
| 70 | YY_BUFFER_STATE state; |
| 71 | if (yylex_init(&scanner)) |
| 72 | return false; |
| 73 | |
| 74 | QByteArray b = s.toUtf8(); |
| 75 | state = yy_scan_string(b.constData(), scanner); |
| 76 | if (yyparse(&m_expression, scanner)) { |
| 77 | delete m_expression; |
| 78 | m_expression = nullptr; |
| 79 | } |
| 80 | |
| 81 | yy_delete_buffer(state, scanner); |
| 82 | yylex_destroy(scanner); |
| 83 | #endif |
| 84 | return m_expression; |
| 85 | } |
| 86 | |
| 87 | SurveyTargetExpression* SurveyTargetExpressionParser::expression() const |
| 88 | { |
no test coverage detected