Lines Matching refs:p
76 skip_string(char_u *p) in skip_string() argument
81 for ( ; ; ++p) in skip_string()
83 if (p[0] == '\'') // 'c' or '\n' or '\000' in skip_string()
85 if (p[1] == NUL) // ' at end of line in skip_string()
88 if (p[1] == '\\' && p[2] != NUL) // '\n' or '\000' in skip_string()
91 while (vim_isdigit(p[i - 1])) // '\000' in skip_string()
94 if (p[i] == '\'') // check for trailing ' in skip_string()
96 p += i; in skip_string()
100 else if (p[0] == '"') // start of string in skip_string()
102 for (++p; p[0]; ++p) in skip_string()
104 if (p[0] == '\\' && p[1] != NUL) in skip_string()
105 ++p; in skip_string()
106 else if (p[0] == '"') // end of string in skip_string()
109 if (p[0] == '"') in skip_string()
112 else if (p[0] == 'R' && p[1] == '"') in skip_string()
115 char_u *delim = p + 2; in skip_string()
122 for (p += 3; *p; ++p) in skip_string()
123 if (p[0] == ')' && STRNCMP(p + 1, delim, delim_len) == 0 in skip_string()
124 && p[delim_len + 1] == '"') in skip_string()
126 p += delim_len + 1; in skip_string()
129 if (p[0] == '"') in skip_string()
135 if (!*p) in skip_string()
136 --p; // backup from NUL in skip_string()
137 return p; in skip_string()
156 char_u *p; in find_start_comment() local
168 for (p = line; *p && (colnr_T)(p - line) < pos->col; ++p) in find_start_comment()
169 p = skip_string(p); in find_start_comment()
170 if ((colnr_T)(p - line) <= pos->col) in find_start_comment()
192 char_u *p; in find_start_rawstring() local
204 for (p = line; *p && (colnr_T)(p - line) < pos->col; ++p) in find_start_rawstring()
205 p = skip_string(p); in find_start_rawstring()
206 if ((colnr_T)(p - line) <= pos->col) in find_start_rawstring()
331 cin_iscomment(char_u *p) in cin_iscomment() argument
333 return (p[0] == '/' && (p[1] == '*' || p[1] == '/')); in cin_iscomment()
340 cin_islinecomment(char_u *p) in cin_islinecomment() argument
342 return (p[0] == '/' && p[1] == '/'); in cin_islinecomment()
353 char_u *p; in find_line_comment() local
359 p = skipwhite(line); in find_line_comment()
360 if (cin_islinecomment(p)) in find_line_comment()
362 pos.col = (int)(p - line); in find_line_comment()
365 if (*p != NUL) in find_line_comment()
491 char_u *p) in cin_iselse() argument
493 if (*p == '}') // accept "} else" in cin_iselse()
494 p = cin_skipcomment(p + 1); in cin_iselse()
495 return (STRNCMP(p, "else", 4) == 0 && !vim_isIDc(p[4])); in cin_iselse()
680 char_u *p = s; in cin_ends_in() local
684 while (*p != NUL) in cin_ends_in()
686 p = cin_skipcomment(p); in cin_ends_in()
687 if (STRNCMP(p, find, len) == 0) in cin_ends_in()
689 r = skipwhite(p + len); in cin_ends_in()
695 if (*p != NUL) in cin_ends_in()
696 ++p; in cin_ends_in()
753 char_u *p; in cin_is_cpp_namespace() local
760 p = cin_skipcomment(skipwhite(s + 9)); in cin_is_cpp_namespace()
761 while (*p != NUL) in cin_is_cpp_namespace()
763 if (VIM_ISWHITE(*p)) in cin_is_cpp_namespace()
766 p = cin_skipcomment(skipwhite(p)); in cin_is_cpp_namespace()
768 else if (*p == '{') in cin_is_cpp_namespace()
772 else if (vim_iswordc(*p)) in cin_is_cpp_namespace()
777 ++p; in cin_is_cpp_namespace()
779 else if (p[0] == ':' && p[1] == ':' && vim_iswordc(p[2])) in cin_is_cpp_namespace()
784 p += 3; in cin_is_cpp_namespace()
802 char_u *p; in cin_is_cpp_extern_c() local
808 p = cin_skipcomment(skipwhite(s + 6)); in cin_is_cpp_extern_c()
809 while (*p != NUL) in cin_is_cpp_extern_c()
811 if (VIM_ISWHITE(*p)) in cin_is_cpp_extern_c()
813 p = cin_skipcomment(skipwhite(p)); in cin_is_cpp_extern_c()
815 else if (*p == '{') in cin_is_cpp_extern_c()
819 else if (p[0] == '"' && p[1] == 'C' && p[2] == '"') in cin_is_cpp_extern_c()
824 p += 3; in cin_is_cpp_extern_c()
826 else if (p[0] == '"' && p[1] == 'C' && p[2] == '+' && p[3] == '+' in cin_is_cpp_extern_c()
827 && p[4] == '"') in cin_is_cpp_extern_c()
832 p += 5; in cin_is_cpp_extern_c()
883 char_u *p; in get_indent_nolabel() local
886 p = after_label(l); in get_indent_nolabel()
887 if (p == NULL) in get_indent_nolabel()
890 fp.col = (colnr_T)(p - l); in get_indent_nolabel()
941 char_u *line, *p, *s; in cin_first_id_amount() local
947 p = skipwhite(line); in cin_first_id_amount()
948 len = (int)(skiptowhite(p) - p); in cin_first_id_amount()
949 if (len == 6 && STRNCMP(p, "static", 6) == 0) in cin_first_id_amount()
951 p = skipwhite(p + 6); in cin_first_id_amount()
952 len = (int)(skiptowhite(p) - p); in cin_first_id_amount()
954 if (len == 6 && STRNCMP(p, "struct", 6) == 0) in cin_first_id_amount()
955 p = skipwhite(p + 6); in cin_first_id_amount()
956 else if (len == 4 && STRNCMP(p, "enum", 4) == 0) in cin_first_id_amount()
957 p = skipwhite(p + 4); in cin_first_id_amount()
958 else if ((len == 8 && STRNCMP(p, "unsigned", 8) == 0) in cin_first_id_amount()
959 || (len == 6 && STRNCMP(p, "signed", 6) == 0)) in cin_first_id_amount()
961 s = skipwhite(p + len); in cin_first_id_amount()
966 p = s; in cin_first_id_amount()
968 for (len = 0; vim_isIDc(p[len]); ++len) in cin_first_id_amount()
970 if (len == 0 || !VIM_ISWHITE(p[len]) || cin_nocode(p)) in cin_first_id_amount()
973 p = skipwhite(p + len); in cin_first_id_amount()
975 fp.col = (colnr_T)(p - line); in cin_first_id_amount()
1036 char_u *p; in cin_skip2pos() local
1039 p = line = ml_get(trypos->lnum); in cin_skip2pos()
1040 while (*p && (colnr_T)(p - line) < trypos->col) in cin_skip2pos()
1042 if (cin_iscomment(p)) in cin_skip2pos()
1043 p = cin_skipcomment(p); in cin_skip2pos()
1046 new_p = skip_string(p); in cin_skip2pos()
1047 if (new_p == p) in cin_skip2pos()
1048 ++p; in cin_skip2pos()
1050 p = new_p; in cin_skip2pos()
1053 return (int)(p - line); in cin_skip2pos()
1273 cin_isif(char_u *p) in cin_isif() argument
1275 return (STRNCMP(p, "if", 2) == 0 && !vim_isIDc(p[2])); in cin_isif()
1279 cin_isdo(char_u *p) in cin_isdo() argument
1281 return (STRNCMP(p, "do", 2) == 0 && !vim_isIDc(p[2])); in cin_isdo()
1290 cin_iswhileofdo (char_u *p, linenr_T lnum) // XXX in cin_iswhileofdo() argument
1296 p = cin_skipcomment(p); in cin_iswhileofdo()
1297 if (*p == '}') // accept "} while (cond);" in cin_iswhileofdo()
1298 p = cin_skipcomment(p + 1); in cin_iswhileofdo()
1299 if (cin_starts_with(p, "while")) in cin_iswhileofdo()
1304 p = ml_get_curline(); in cin_iswhileofdo()
1305 while (*p && *p != 'w') // skip any '}', until the 'w' of the "while" in cin_iswhileofdo()
1307 ++p; in cin_iswhileofdo()
1375 char_u *p; in cin_iswhileofdo_end() local
1383 p = line = ml_get_curline(); in cin_iswhileofdo_end()
1384 while (*p != NUL) in cin_iswhileofdo_end()
1386 p = cin_skipcomment(p); in cin_iswhileofdo_end()
1387 if (*p == ')') in cin_iswhileofdo_end()
1389 s = skipwhite(p + 1); in cin_iswhileofdo_end()
1394 i = (int)(p - line); in cin_iswhileofdo_end()
1411 p = line + i; in cin_iswhileofdo_end()
1414 if (*p != NUL) in cin_iswhileofdo_end()
1415 ++p; in cin_iswhileofdo_end()
1421 cin_isbreak(char_u *p) in cin_isbreak() argument
1423 return (STRNCMP(p, "break", 5) == 0 && !vim_isIDc(p[5])); in cin_isbreak()
1711 char_u *p; in parse_cino() local
1851 for (p = buf->b_p_cino; *p; ) in parse_cino()
1853 l = p++; in parse_cino()
1854 if (*p == '-') in parse_cino()
1855 ++p; in parse_cino()
1856 digits = p; // remember where the digits start in parse_cino()
1857 n = getdigits(&p); in parse_cino()
1859 if (*p == '.') // ".5s" means a fraction in parse_cino()
1861 fraction = atol((char *)++p); in parse_cino()
1862 while (VIM_ISDIGIT(*p)) in parse_cino()
1864 ++p; in parse_cino()
1871 if (*p == 's') // "2s" means two times 'shiftwidth' in parse_cino()
1873 if (p == digits) in parse_cino()
1881 ++p; in parse_cino()
1928 if (*p == ',') in parse_cino()
1929 ++p; in parse_cino()
2165 char_u *p; in get_c_indent() local
2176 p = curbuf->b_p_com; in get_c_indent()
2177 while (*p != NUL) in get_c_indent()
2183 while (*p != NUL && *p != ':') in get_c_indent()
2185 if (*p == COM_START || *p == COM_END || *p == COM_MIDDLE) in get_c_indent()
2186 what = *p++; in get_c_indent()
2187 else if (*p == COM_LEFT || *p == COM_RIGHT) in get_c_indent()
2188 align = *p++; in get_c_indent()
2189 else if (VIM_ISDIGIT(*p) || *p == '-') in get_c_indent()
2190 off = getdigits(&p); in get_c_indent()
2192 ++p; in get_c_indent()
2195 if (*p == ':') in get_c_indent()
2196 ++p; in get_c_indent()
2197 (void)copy_option_part(&p, lead_end, COM_MAX_LEN, ","); in get_c_indent()
3884 char_u *p; in in_cinkeys() local
3958 p = ml_get_curline(); in in_cinkeys()
3959 if (skipwhite(p) == p + curwin->w_cursor.col - 4 && in in_cinkeys()
3960 STRNCMP(p + curwin->w_cursor.col - 4, "else", 4) == 0) in in_cinkeys()
3973 p = ml_get_curline(); in in_cinkeys()
3974 if (cin_iscase(p, FALSE) || cin_isscopedecl(p) || cin_islabel()) in in_cinkeys()
3977 p = ml_get_curline(); in in_cinkeys()
3979 && p[curwin->w_cursor.col - 1] == ':' in in_cinkeys()
3980 && p[curwin->w_cursor.col - 2] == ':') in in_cinkeys()
3982 p[curwin->w_cursor.col - 1] = ' '; in in_cinkeys()
3983 i = (cin_iscase(p, FALSE) || cin_isscopedecl(p) in in_cinkeys()
3985 p = ml_get_curline(); in in_cinkeys()
3986 p[curwin->w_cursor.col - 1] = ':'; in in_cinkeys()
4027 p = vim_strchr(look, ','); in in_cinkeys()
4028 if (p == NULL) in in_cinkeys()
4029 p = look + STRLEN(look); in in_cinkeys()
4031 && curwin->w_cursor.col >= (colnr_T)(p - look)) in in_cinkeys()
4057 if (s + (p - look) <= line + curwin->w_cursor.col in in_cinkeys()
4059 ? MB_STRNICMP(s, look, p - look) in in_cinkeys()
4060 : STRNCMP(s, look, p - look)) == 0) in in_cinkeys()
4065 if (keytyped == (int)p[-1] || (icase && keytyped < 256 in in_cinkeys()
4066 && TOLOWER_LOC(keytyped) == TOLOWER_LOC((int)p[-1]))) in in_cinkeys()
4069 if ((curwin->w_cursor.col == (colnr_T)(p - look) in in_cinkeys()
4070 || !vim_iswordc(line[-(p - look) - 1])) in in_cinkeys()
4072 ? MB_STRNICMP(line - (p - look), look, p - look) in in_cinkeys()
4073 : STRNCMP(line - (p - look), look, p - look)) in in_cinkeys()
4082 (int)(curwin->w_cursor.col - (p - look))) in in_cinkeys()
4088 look = p; in in_cinkeys()