| 264 | } |
| 265 | |
| 266 | std::optional<std::string_view> TextParser::parseIdentifier() { |
| 267 | auto currentPosition = position(); |
| 268 | tryParseWhitespaces(); |
| 269 | |
| 270 | auto str = readWhile(isIdentifierChar); |
| 271 | if (str.empty()) { |
| 272 | _position = currentPosition; |
| 273 | setErrorAtCurrentPosition("Expecting identifier"); |
| 274 | return std::nullopt; |
| 275 | } |
| 276 | return str; |
| 277 | } |
| 278 | |
| 279 | std::string_view TextParser::readUntilCharacter(char c) { |
| 280 | return readWhile([c](char currentC) { return currentC != c; }); |