Lines Matching refs:first

1007 template <typename InputIt> InputIt skip_lws(InputIt first, InputIt last) {
1008 for (; first != last; ++first) {
1009 switch (*first) {
1014 return first;
1017 return first;
1023 InputIt skip_to_next_field(InputIt first, InputIt last) {
1024 for (; first != last; ++first) {
1025 switch (*first) {
1031 return first;
1034 return first;
1042 InputIt skip_to_right_dquote(InputIt first, InputIt last) {
1043 for (; first != last;) {
1044 switch (*first) {
1046 return first;
1049 ++first;
1050 if (first == last) {
1051 return first;
1054 switch (*first) {
1059 if ((0x21 <= *first && *first <= 0x7e) /* VCHAR */ ||
1060 (0x80 <= *first && *first <= 0xff) /* obs-text */) {
1074 if ((0x23 <= *first && *first <= 0x5b) ||
1075 (0x5d <= *first && *first <= 0x7e)) {
1081 ++first;
1083 return first;
1091 bool check_link_param_empty(const char *first, const char *last,
1093 if (first + patlen <= last) {
1094 if (std::equal(pat, pat + patlen, first, util::CaseCmp())) {
1097 if (first + patlen + 2 <= last) {
1098 if (*(first + patlen) != '"' || *(first + patlen + 1) != '"') {
1114 bool check_link_param_without_value(const char *first, const char *last,
1116 if (first + patlen > last) {
1120 if (first + patlen == last) {
1121 return std::equal(pat, pat + patlen, first, util::CaseCmp());
1124 switch (*(first + patlen)) {
1127 return std::equal(pat, pat + patlen, first, util::CaseCmp());
1136 parse_next_link_header_once(const char *first, const char *last) {
1137 first = skip_to_next_field(first, last);
1138 if (first == last || *first != '<') {
1141 auto url_first = ++first;
1142 first = std::find(first, last, '>');
1143 if (first == last) {
1144 return {{StringRef{}}, first};
1146 auto url_last = first++;
1147 if (first == last) {
1148 return {{StringRef{}}, first};
1151 switch (*first) {
1153 return {{StringRef{}}, ++first};
1155 ++first;
1164 first = skip_lws(first, last);
1165 if (first == last) {
1166 return {{StringRef{}}, first};
1178 if (first + PLPLEN < last && *(first + PLPLEN - 1) == '"' &&
1179 std::equal(PLP, PLP + PLPLEN, first, util::CaseCmp())) {
1182 first += PLPLEN;
1183 auto start = first;
1184 for (; first != last;) {
1185 if (*first != ' ' && *first != '"') {
1186 ++first;
1190 if (start == first) {
1194 if (!ok && start + PLTLEN == first &&
1199 if (*first == '"') {
1202 first = skip_lws(first, last);
1203 start = first;
1205 if (first == last) {
1208 assert(*first == '"');
1209 ++first;
1210 if (first == last || *first == ',') {
1213 if (*first == ';') {
1214 ++first;
1225 if (first + PLLEN == last) {
1226 if (std::equal(PL, PL + PLLEN, first, util::CaseCmp())) {
1231 } else if (first + PLLEN + 1 <= last) {
1232 switch (*(first + PLLEN)) {
1234 if (!std::equal(PL, PL + PLLEN, first, util::CaseCmp())) {
1239 first += PLLEN + 1;
1240 return {{{url_first, url_last}}, first};
1242 if (!std::equal(PL, PL + PLLEN, first, util::CaseCmp())) {
1247 first += PLLEN + 1;
1255 if (!ign && !check_link_param_empty(first, last, ANCHOR, ANCHORLEN)) {
1264 !check_link_param_empty(first, last, LOADPOLICY, LOADPOLICYLEN)) {
1272 check_link_param_without_value(first, last, NOPUSH, NOPUSHLEN)) {
1277 auto param_first = first;
1278 for (; first != last;) {
1279 if (util::in_attr_char(*first)) {
1280 ++first;
1285 if (last - first >= 2 && first != param_first) {
1286 if (*first == '*' && *(first + 1) == '=') {
1287 ++first;
1291 if (*first == '=' || *first == ';' || *first == ',') {
1296 if (param_first == first) {
1302 if (first == last || *first == ',') {
1305 if (*first == ';') {
1306 ++first;
1311 assert(*first == '=');
1312 ++first;
1313 if (first == last) {
1315 return {{StringRef{}}, first};
1317 if (*first == '"') {
1319 first = skip_to_right_dquote(first + 1, last);
1320 if (first == last) {
1321 return {{StringRef{}}, first};
1323 ++first;
1324 if (first == last || *first == ',') {
1327 if (*first == ';') {
1328 ++first;
1335 if (*first == ',' || *first == ';') {
1339 for (; first != last; ++first) {
1340 if (*first == ',' || *first == ';') {
1344 if (first == last || *first == ',') {
1347 assert(*first == ';');
1348 ++first;
1353 assert(first == last || *first == ',');
1355 if (first != last) {
1356 ++first;
1359 return {{{url_first, url_last}}, first};
1361 return {{StringRef{}}, first};
1367 for (auto first = std::begin(src); first != std::end(src);) {
1368 auto rv = parse_next_link_header_once(first, std::end(src));
1369 first = rv.second;
1370 auto &link = rv.first;
1692 template <typename InputIt> InputIt eat_file(InputIt first, InputIt last) {
1693 if (first == last) {
1694 *first++ = '/';
1695 return first;
1703 for (; p != first && *(p - 1) != '/'; --p)
1705 if (p == first) {
1708 *first++ = '/';
1709 return first;
1717 template <typename InputIt> InputIt eat_dir(InputIt first, InputIt last) {
1718 auto p = eat_file(first, last);
1724 return eat_file(first, p);
1757 auto first = std::begin(rel_path);
1762 ++first;
1763 for (; first != last && *first == '/'; ++first)
1771 for (; first != last;) {
1772 if (*first == '.') {
1773 if (first + 1 == last) {
1779 if (*(first + 1) == '/') {
1783 first += 2;
1786 if (*(first + 1) == '.') {
1787 if (first + 2 == last) {
1791 if (*(first + 2) == '/') {
1793 first += 3;
1801 auto slash = std::find(first, last, '/');
1803 p = std::copy(first, last, p);
1806 p = std::copy(first, slash + 1, p);
1807 first = slash + 1;
1808 for (; first != last && *first == '/'; ++first)