| 130 | } |
| 131 | |
| 132 | void GuiScript::parseResetTimeStatement(parser::DefTokeniser& tokeniser) |
| 133 | { |
| 134 | // Prototype: resetTime [<window>] [<time>] |
| 135 | StatementPtr st(new Statement(Statement::ST_RESET_TIME)); |
| 136 | |
| 137 | std::string token = tokeniser.peek(); |
| 138 | |
| 139 | if (token != ";") |
| 140 | { |
| 141 | // Check if this is a numeric token |
| 142 | try |
| 143 | { |
| 144 | // Remove quotes from string before checking numerics |
| 145 | std::string trimmed = string::trim_copy(token, "\""); |
| 146 | |
| 147 | // Try to cast the string to a number, throws |
| 148 | std::stoul(trimmed); |
| 149 | |
| 150 | // Cast succeeded this is just the time for the current window |
| 151 | st->args.push_back(_owner.parseString(tokeniser)); |
| 152 | } |
| 153 | catch (std::logic_error&) |
| 154 | { |
| 155 | // Not a number, must be window plus time |
| 156 | st->args.push_back(_owner.parseString(tokeniser)); // window |
| 157 | st->args.push_back(_owner.parseString(tokeniser)); // time |
| 158 | } |
| 159 | |
| 160 | // Reset statement complete, check the next token, as some |
| 161 | // GUI scripts don't bother writing an ending semicolon before the closing brace |
| 162 | std::string next = tokeniser.peek(); |
| 163 | |
| 164 | if (next == ";" || next == "}") |
| 165 | { |
| 166 | tokeniser.nextToken(); // exhaust |
| 167 | } |
| 168 | else |
| 169 | { |
| 170 | tokeniser.assertNextToken(";"); |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | pushStatement(st); |
| 175 | } |
| 176 | |
| 177 | void GuiScript::parseShowCursorStatement(parser::DefTokeniser& tokeniser) |
| 178 | { |
nothing calls this directly
no test coverage detected