MCPcopy Create free account
hub / github.com/GothenburgBitFactory/taskwarrior / isPath

Method isPath

src/Lexer.cpp:741–768  ·  view source on GitHub ↗

/////////////////////////////////////////////////////////////////////////// Lexer::Type::path ( / )+

Source from the content-addressed store, hash-verified

739// Lexer::Type::path
740// ( / <non-slash, non-whitespace> )+
741bool Lexer::isPath(std::string& token, Lexer::Type& type) {
742 std::size_t marker = _cursor;
743 int slashCount = 0;
744
745 while (true) {
746 if (_text[marker] == '/') {
747 ++marker;
748 ++slashCount;
749 } else
750 break;
751
752 if (_text[marker] && !unicodeWhitespace(_text[marker]) && _text[marker] != '/') {
753 utf8_next_char(_text, marker);
754 while (_text[marker] && !unicodeWhitespace(_text[marker]) && _text[marker] != '/')
755 utf8_next_char(_text, marker);
756 } else
757 break;
758 }
759
760 if (marker > _cursor && slashCount > 3) {
761 type = Lexer::Type::path;
762 token = _text.substr(_cursor, marker - _cursor);
763 _cursor = marker;
764 return true;
765 }
766
767 return false;
768}
769
770////////////////////////////////////////////////////////////////////////////////
771// Lexer::Type::substitution

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected