diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-02-04 20:30:18 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-02-04 20:30:18 +0100 |
commit | 9c46efd7dc57c1a8eae5137d05c7e67c4f82c3d7 (patch) | |
tree | 3135c2a273f10e74caf862c59238572fc1cedd83 /src | |
parent | 970076468e37972d24c6ba6ef29f1957128aa161 (diff) |
patch 8.1.0874: using old style comments in new filev8.1.0874
Problem: Using old style comments in new file.
Solution: Convert to // comments in new file. (Yegappan Lakshmanan)
Diffstat (limited to 'src')
-rw-r--r-- | src/indent.c | 1809 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 795 insertions, 1016 deletions
diff --git a/src/indent.c b/src/indent.c index af401ee7ad..1ffa766954 100644 --- a/src/indent.c +++ b/src/indent.c @@ -59,13 +59,13 @@ static pos_T *find_start_rawstring(int ind_maxcomment); * Return NULL when not inside a comment. */ static pos_T * -ind_find_start_comment(void) /* XXX */ +ind_find_start_comment(void) // XXX { return find_start_comment(curbuf->b_ind_maxcomment); } pos_T * -find_start_comment(int ind_maxcomment) /* XXX */ +find_start_comment(int ind_maxcomment) // XXX { pos_T *pos; char_u *line; @@ -78,10 +78,8 @@ find_start_comment(int ind_maxcomment) /* XXX */ if (pos == NULL) break; - /* - * Check if the comment start we found is inside a string. - * If it is then restrict the search to below this line and try again. - */ + // Check if the comment start we found is inside a string. + // If it is then restrict the search to below this line and try again. line = ml_get(pos->lnum); for (p = line; *p && (colnr_T)(p - line) < pos->col; ++p) p = skip_string(p); @@ -106,7 +104,7 @@ find_start_comment(int ind_maxcomment) /* XXX */ * "CORS" -> Comment Or Raw String */ static pos_T * -ind_find_start_CORS(linenr_T *is_raw) /* XXX */ +ind_find_start_CORS(linenr_T *is_raw) // XXX { static pos_T comment_pos_copy; pos_T *comment_pos; @@ -115,15 +113,15 @@ ind_find_start_CORS(linenr_T *is_raw) /* XXX */ comment_pos = find_start_comment(curbuf->b_ind_maxcomment); if (comment_pos != NULL) { - /* Need to make a copy of the static pos in findmatchlimit(), - * calling find_start_rawstring() may change it. */ + // Need to make a copy of the static pos in findmatchlimit(), + // calling find_start_rawstring() may change it. comment_pos_copy = *comment_pos; comment_pos = &comment_pos_copy; } rs_pos = find_start_rawstring(curbuf->b_ind_maxcomment); - /* If comment_pos is before rs_pos the raw string is inside the comment. - * If rs_pos is before comment_pos the comment is inside the raw string. */ + // If comment_pos is before rs_pos the raw string is inside the comment. + // If rs_pos is before comment_pos the comment is inside the raw string. if (comment_pos == NULL || (rs_pos != NULL && LT_POS(*rs_pos, *comment_pos))) { @@ -140,7 +138,7 @@ ind_find_start_CORS(linenr_T *is_raw) /* XXX */ * Return NULL when not inside a raw string. */ static pos_T * -find_start_rawstring(int ind_maxcomment) /* XXX */ +find_start_rawstring(int ind_maxcomment) // XXX { pos_T *pos; char_u *line; @@ -153,10 +151,8 @@ find_start_rawstring(int ind_maxcomment) /* XXX */ if (pos == NULL) break; - /* - * Check if the raw string start we found is inside a string. - * If it is then restrict the search to below this line and try again. - */ + // Check if the raw string start we found is inside a string. + // If it is then restrict the search to below this line and try again. line = ml_get(pos->lnum); for (p = line; *p && (colnr_T)(p - line) < pos->col; ++p) p = skip_string(p); @@ -181,43 +177,41 @@ skip_string(char_u *p) { int i; - /* - * We loop, because strings may be concatenated: "date""time". - */ + // We loop, because strings may be concatenated: "date""time". for ( ; ; ++p) { - if (p[0] == '\'') /* 'c' or '\n' or '\000' */ + if (p[0] == '\'') // 'c' or '\n' or '\000' { - if (!p[1]) /* ' at end of line */ + if (!p[1]) // ' at end of line break; i = 2; - if (p[1] == '\\') /* '\n' or '\000' */ + if (p[1] == '\\') // '\n' or '\000' { ++i; - while (vim_isdigit(p[i - 1])) /* '\000' */ + while (vim_isdigit(p[i - 1])) // '\000' ++i; } - if (p[i] == '\'') /* check for trailing ' */ + if (p[i] == '\'') // check for trailing ' { p += i; continue; } } - else if (p[0] == '"') /* start of string */ + else if (p[0] == '"') // start of string { for (++p; p[0]; ++p) { if (p[0] == '\\' && p[1] != NUL) ++p; - else if (p[0] == '"') /* end of string */ + else if (p[0] == '"') // end of string break; } if (p[0] == '"') - continue; /* continue for another string */ + continue; // continue for another string } else if (p[0] == 'R' && p[1] == '"') { - /* Raw string: R"[delim](...)[delim]" */ + // Raw string: R"[delim](...)[delim]" char_u *delim = p + 2; char_u *paren = vim_strchr(delim, '('); @@ -233,16 +227,16 @@ skip_string(char_u *p) break; } if (p[0] == '"') - continue; /* continue for another string */ + continue; // continue for another string } } - break; /* no string found */ + break; // no string found } if (!*p) - --p; /* backup from NUL */ + --p; // backup from NUL return p; } -#endif /* FEAT_CINDENT || FEAT_SYN_HL */ +#endif // FEAT_CINDENT || FEAT_SYN_HL #if defined(FEAT_CINDENT) || defined(PROTO) @@ -259,7 +253,7 @@ cindent_on(void) )); } -/* Find result cache for cpp_baseclass */ +// Find result cache for cpp_baseclass typedef struct { int found; lpos_T lpos; @@ -299,8 +293,8 @@ cin_skipcomment(char_u *s) s = skipwhite(s); - /* Perl/shell # comment comment continues until eol. Require a space - * before # to avoid recognizing $#array. */ + // Perl/shell # comment comment continues until eol. Require a space + // before # to avoid recognizing $#array. if (curbuf->b_ind_hash_comment != 0 && s != prev_s && *s == '#') { s += STRLEN(s); @@ -309,14 +303,14 @@ cin_skipcomment(char_u *s) if (*s != '/') break; ++s; - if (*s == '/') /* slash-slash comment continues till eol */ + if (*s == '/') // slash-slash comment continues till eol { s += STRLEN(s); break; } if (*s != '*') break; - for (++s; *s; ++s) /* skip slash-star comment */ + for (++s; *s; ++s) // skip slash-star comment if (s[0] == '*' && s[1] == '/') { s += 2; @@ -340,7 +334,7 @@ cin_nocode(char_u *s) * Check previous lines for a "//" line comment, skipping over blank lines. */ static pos_T * -find_line_comment(void) /* XXX */ +find_line_comment(void) // XXX { static pos_T pos; char_u *line; @@ -373,11 +367,11 @@ cin_has_js_key(char_u *text) if (*s == '\'' || *s == '"') { - /* can be 'key': or "key": */ + // can be 'key': or "key": quote = *s; ++s; } - if (!vim_isIDc(*s)) /* need at least one ID character */ + if (!vim_isIDc(*s)) // need at least one ID character return FALSE; while (vim_isIDc(*s)) @@ -387,7 +381,7 @@ cin_has_js_key(char_u *text) s = cin_skipcomment(s); - /* "::" is not a label, it's C++ */ + // "::" is not a label, it's C++ return (*s == ':' && s[1] != ':'); } @@ -398,7 +392,7 @@ cin_has_js_key(char_u *text) static int cin_islabel_skip(char_u **s) { - if (!vim_isIDc(**s)) /* need at least one ID character */ + if (!vim_isIDc(**s)) // need at least one ID character return FALSE; while (vim_isIDc(**s)) @@ -406,7 +400,7 @@ cin_islabel_skip(char_u **s) *s = cin_skipcomment(*s); - /* "::" is not a label, it's C++ */ + // "::" is not a label, it's C++ return (**s == ':' && *++*s != ':'); } @@ -415,16 +409,14 @@ cin_islabel_skip(char_u **s) * Note: curwin->w_cursor must be where we are looking for the label. */ int -cin_islabel(void) /* XXX */ +cin_islabel(void) // XXX { char_u *s; s = cin_skipcomment(ml_get_curline()); - /* - * Exclude "default" from labels, since it should be indented - * like a switch label. Same for C++ scope declarations. - */ + // Exclude "default" from labels, since it should be indented + // like a switch label. Same for C++ scope declarations. if (cin_isdefault(s)) return FALSE; if (cin_isscopedecl(s)) @@ -432,10 +424,8 @@ cin_islabel(void) /* XXX */ if (cin_islabel_skip(&s)) { - /* - * Only accept a label if the previous line is terminated or is a case - * label. - */ + // Only accept a label if the previous line is terminated or is a case + // label. pos_T cursor_save; pos_T *trypos; char_u *line; @@ -445,16 +435,14 @@ cin_islabel(void) /* XXX */ { --curwin->w_cursor.lnum; - /* - * If we're in a comment or raw string now, skip to the start of - * it. - */ + // If we're in a comment or raw string now, skip to the start of + // it. curwin->w_cursor.col = 0; - if ((trypos = ind_find_start_CORS(NULL)) != NULL) /* XXX */ + if ((trypos = ind_find_start_CORS(NULL)) != NULL) // XXX curwin->w_cursor = *trypos; line = ml_get_curline(); - if (cin_ispreproc(line)) /* ignore #defines, #if, etc. */ + if (cin_ispreproc(line)) // ignore #defines, #if, etc. continue; if (*(line = cin_skipcomment(line)) == NUL) continue; @@ -468,7 +456,7 @@ cin_islabel(void) /* XXX */ return FALSE; } curwin->w_cursor = cursor_save; - return TRUE; /* label at start of file??? */ + return TRUE; // label at start of file??? } return FALSE; } @@ -522,7 +510,7 @@ cin_isinit(void) int cin_iscase( char_u *s, - int strict) /* Allow relaxed check of case statement for JS */ + int strict) // Allow relaxed check of case statement for JS { s = cin_skipcomment(s); if (cin_starts_with(s, "case")) @@ -532,20 +520,20 @@ cin_iscase( s = cin_skipcomment(s); if (*s == ':') { - if (s[1] == ':') /* skip over "::" for C++ */ + if (s[1] == ':') // skip over "::" for C++ ++s; else return TRUE; } if (*s == '\'' && s[1] && s[2] == '\'') - s += 2; /* skip over ':' */ + s += 2; // skip over ':' else if (*s == '/' && (s[1] == '*' || s[1] == '/')) - return FALSE; /* stop at comment */ + return FALSE; // stop at comment else if (*s == '"') { - /* JS etc. */ + // JS etc. if (strict) - return FALSE; /* stop at string */ + return FALSE; // stop at string else return TRUE; } @@ -589,7 +577,7 @@ cin_isscopedecl(char_u *s) return (*(s = cin_skipcomment(s + i)) == ':' && s[1] != ':'); } -/* Maximum number of lines to search back for a "namespace" line. */ +// Maximum number of lines to search back for a "namespace" line. #define FIND_NAMESPACE_LIM 20 /* @@ -610,7 +598,7 @@ cin_is_cpp_namespace(char_u *s) { if (VIM_ISWHITE(*p)) { - has_name = TRUE; /* found end of a name */ + has_name = TRUE; // found end of a name p = cin_skipcomment(skipwhite(p)); } else if (*p == '{') @@ -621,14 +609,14 @@ cin_is_cpp_namespace(char_u *s) { has_name_start = TRUE; if (has_name) - return FALSE; /* word character after skipping past name */ + return FALSE; // word character after skipping past name ++p; } else if (p[0] == ':' && p[1] == ':' && vim_iswordc(p[2])) { if (!has_name_start || has_name) return FALSE; - /* C++ 17 nested namespace */ + // C++ 17 nested namespace p += 3; } else @@ -702,13 +690,13 @@ after_label(char_u *l) { if (*l == ':') { - if (l[1] == ':') /* skip over "::" for C++ */ + if (l[1] == ':') // skip over "::" for C++ ++l; else if (!cin_iscase(l + 1, FALSE)) break; } else if (*l == '\'' && l[1] && l[2] == '\'') - l += 2; /* skip over 'x' */ + l += 2; // skip over 'x' } if (*l == NUL) return NULL; @@ -723,7 +711,7 @@ after_label(char_u *l) * Return 0 if there is nothing after the label. */ static int -get_indent_nolabel (linenr_T lnum) /* XXX */ +get_indent_nolabel (linenr_T lnum) // XXX { char_u *l; pos_T fp; @@ -757,12 +745,12 @@ skip_label(linenr_T lnum, char_u **pp) cursor_save = curwin->w_cursor; curwin->w_cursor.lnum = lnum; l = ml_get_curline(); - /* XXX */ + // XXX if (cin_iscase(l, FALSE) || cin_isscopedecl(l) || cin_islabel()) { amount = get_indent_nolabel(lnum); l = after_label(ml_get_curline()); - if (l == NULL) /* just in case */ + if (l == NULL) // just in case l = ml_get_curline(); } else @@ -852,7 +840,7 @@ cin_get_equal_amount(linenr_T lnum) line = s = ml_get(lnum); while (*s != NUL && vim_strchr((char_u *)"=;{}\"'", *s) == NULL) { - if (cin_iscomment(s)) /* ignore comments */ + if (cin_iscomment(s)) // ignore comments s = cin_skipcomment(s); else ++s; @@ -864,7 +852,7 @@ cin_get_equal_amount(linenr_T lnum) if (cin_nocode(s)) return 0; - if (*s == '"') /* nice alignment for continued strings */ + if (*s == '"') // nice alignment for continued strings ++s; fp.lnum = lnum; @@ -953,8 +941,8 @@ cin_islinecomment(char_u *p) static int cin_isterminated( char_u *s, - int incl_open, /* include '{' at the end as terminator */ - int incl_comma) /* recognize a trailing comma */ + int incl_open, // include '{' at the end as terminator + int incl_comma) // recognize a trailing comma { char_u found_start = 0; unsigned n_open = 0; @@ -970,7 +958,7 @@ cin_isterminated( while (*s) { - /* skip over comments, "" strings and 'c'haracters */ + // skip over comments, "" strings and 'c'haracters s = skip_string(cin_skipcomment(s)); if (*s == '}' && n_open > 0) --n_open; @@ -1035,38 +1023,38 @@ cin_isfuncdecl( } curwin->w_cursor.lnum = save_lnum; - /* Ignore line starting with #. */ + // Ignore line starting with #. if (cin_ispreproc(s)) return FALSE; while (*s && *s != '(' && *s != ';' && *s != '\'' && *s != '"') { - if (cin_iscomment(s)) /* ignore comments */ + if (cin_iscomment(s)) // ignore comments s = cin_skipcomment(s); else if (*s == ':') { if (*(s + 1) == ':') s += 2; else - /* To avoid a mistake in the following situation: - * A::A(int a, int b) - * : a(0) // <--not a function decl - * , b(0) - * {... - */ + // To avoid a mistake in the following situation: + // A::A(int a, int b) + // : a(0) // <--not a function decl + // , b(0) + // {... return FALSE; } else ++s; } if (*s != '(') - return FALSE; /* ';', ' or " before any () or no '(' */ + return FALSE; // ';', ' or " before any () or no '(' while (*s && *s != ';' && *s != '\'' && *s != '"') { if (*s == ')' && cin_nocode(s + 1)) { - /* ')' at the end: may have found a match + /* + * ')' at the end: may have found a match * Check for he previous line not to end in a backslash: * #if defined(x) && \ * defined(y) @@ -1081,10 +1069,10 @@ cin_isfuncdecl( { int comma = (*s == ','); - /* ',' at the end: continue looking in the next line. - * At the end: check for ',' in the next line, for this style: - * func(arg1 - * , arg2) */ + // ',' at the end: continue looking in the next line. + // At the end: check for ',' in the next line, for this style: + // func(arg1 + // , arg2) for (;;) { if (lnum >= curbuf->b_ml.ml_line_count) @@ -1095,14 +1083,14 @@ cin_isfuncdecl( } if (lnum >= curbuf->b_ml.ml_line_count) break; - /* Require a comma at end of the line or a comma or ')' at the - * start of next line. */ + // Require a comma at end of the line or a comma or ')' at the + // start of next line. s = skipwhite(s); if (!just_started && (!comma && *s != ',' && *s != ')')) break; just_started = FALSE; } - else if (cin_iscomment(s)) /* ignore comments */ + else if (cin_iscomment(s)) // ignore comments s = cin_skipcomment(s); else { @@ -1128,7 +1116,7 @@ cin_isif(char_u *p) cin_iselse( char_u *p) { - if (*p == '}') /* accept "} else" */ + if (*p == '}') // accept "} else" p = cin_skipcomment(p + 1); return (STRNCMP(p, "else", 4) == 0 && !vim_isIDc(p[4])); } @@ -1145,14 +1133,14 @@ cin_isdo(char_u *p) * ')' and ';'. The condition may be spread over several lines. */ static int -cin_iswhileofdo (char_u *p, linenr_T lnum) /* XXX */ +cin_iswhileofdo (char_u *p, linenr_T lnum) // XXX { pos_T cursor_save; pos_T *trypos; int retval = FALSE; p = cin_skipcomment(p); - if (*p == '}') /* accept "} while (cond);" */ + if (*p == '}') // accept "} while (cond);" p = cin_skipcomment(p + 1); if (cin_starts_with(p, "while")) { @@ -1160,7 +1148,7 @@ cin_iswhileofdo (char_u *p, linenr_T lnum) /* XXX */ curwin->w_cursor.lnum = lnum; curwin->w_cursor.col = 0; p = ml_get_curline(); - while (*p && *p != 'w') /* skip any '}', until the 'w' of the "while" */ + while (*p && *p != 'w') // skip any '}', until the 'w' of the "while" { ++p; ++curwin->w_cursor.col; @@ -1235,7 +1223,7 @@ cin_iswhileofdo_end(int terminated) pos_T *trypos; int i; - if (terminated != ';') /* there must be a ';' at the end */ + if (terminated != ';') // there must be a ';' at the end return FALSE; p = line = ml_get_curline(); @@ -1247,15 +1235,15 @@ cin_iswhileofdo_end(int terminated) s = skipwhite(p + 1); if (*s == ';' && cin_nocode(s + 1)) { - /* Found ");" at end of the line, now check there is "while" - * before the matching '('. XXX */ + // Found ");" at end of the line, now check there is "while" + // before the matching '('. XXX i = (int)(p - line); curwin->w_cursor.col = i; trypos = find_match_paren(curbuf->b_ind_maxparen); if (trypos != NULL) { s = cin_skipcomment(ml_get(trypos->lnum)); - if (*s == '}') /* accept "} while (cond);" */ + if (*s == '}') // accept "} while (cond);" s = cin_skipcomment(s + 1); if (cin_starts_with(s, "while")) { @@ -1264,7 +1252,7 @@ cin_iswhileofdo_end(int terminated) } } - /* Searching may have made "line" invalid, get it again. */ + // Searching may have made "line" invalid, get it again. line = ml_get_curline(); p = line + i; } @@ -1296,21 +1284,21 @@ cin_isbreak(char_u *p) */ static int cin_is_cpp_baseclass( - cpp_baseclass_cache_T *cached) /* input and output */ + cpp_baseclass_cache_T *cached) // input and output { - lpos_T *pos = &cached->lpos; /* find position */ + lpos_T *pos = &cached->lpos; // find position char_u *s; int class_or_struct, lookfor_ctor_init, cpp_base_class; linenr_T lnum = curwin->w_cursor.lnum; char_u *line = ml_get_curline(); if (pos->lnum <= lnum) - return cached->found; /* Use the cached result */ + return cached->found; // Use the cached result pos->col = 0; s = skipwhite(line); - if (*s == '#') /* skip #define FOO x ? (x) : x */ + if (*s == '#') // skip #define FOO x ? (x) : x return FALSE; s = cin_skipcomment(s); if (*s == NUL) @@ -1318,19 +1306,18 @@ cin_is_cpp_baseclass( cpp_base_class = lookfor_ctor_init = class_or_struct = FALSE; - /* Search for a line starting with '#', empty, ending in ';' or containing - * '{' or '}' and start below it. This handles the following situations: - * a = cond ? - * func() : - * asdf; - * func::foo() - * : something - * {} - * Foo::Foo (int one, int two) - * : something(4), - * somethingelse(3) - * {} - */ + // Search for a line starting with '#', empty, ending in ';' or containing + // '{' or '}' and start below it. This handles the following situations: + // a = cond ? + // func() : + // asdf; + // func::foo() + // : something + // {} + // Foo::Foo (int one, int two) + // : something(4), + // somethingelse(3) + // {} while (lnum > 1) { line = ml_get(lnum - 1); @@ -1360,13 +1347,13 @@ cin_is_cpp_baseclass( { if (lnum == curwin->w_cursor.lnum) break; - /* Continue in the cursor line. */ + // Continue in the cursor line. line = ml_get(++lnum); s = line; } if (s == line) { - /* don't recognize "case (foo):" as a baseclass */ + // don't recognize "case (foo):" as a baseclass if (cin_iscase(s, FALSE)) break; s = cin_skipcomment(line); @@ -1380,15 +1367,15 @@ cin_is_cpp_baseclass( { if (s[1] == ':') { - /* skip double colon. It can't be a constructor - * initialization any more */ + // skip double colon. It can't be a constructor + // initialization any more lookfor_ctor_init = FALSE; s = cin_skipcomment(s + 2); } else if (lookfor_ctor_init || class_or_struct) { - /* we have something found, that looks like the start of - * cpp-base-class-declaration or constructor-initialization */ + // we have something found, that looks like the start of + // cpp-base-class-declaration or constructor-initialization cpp_base_class = TRUE; lookfor_ctor_init = class_or_struct = FALSE; pos->col = 0; @@ -1416,33 +1403,33 @@ cin_is_cpp_baseclass( } else if (s[0] == ')') { - /* Constructor-initialization is assumed if we come across - * something like "):" */ + // Constructor-initialization is assumed if we come across + // something like "):" class_or_struct = FALSE; lookfor_ctor_init = TRUE; } else if (s[0] == '?') { - /* Avoid seeing '() :' after '?' as constructor init. */ + // Avoid seeing '() :' after '?' as constructor init. return FALSE; } else if (!vim_isIDc(s[0])) { - /* if it is not an identifier, we are wrong */ + // if it is not an identifier, we are wrong class_or_struct = FALSE; lookfor_ctor_init = FALSE; } else if (pos->col == 0) { - /* it can't be a constructor-initialization any more */ + // it can't be a constructor-initialization any more lookfor_ctor_init = FALSE; - /* the first statement starts here: lineup with this one... */ + // the first statement starts here: lineup with this one... if (cpp_base_class) pos->col = (colnr_T)(s - line); } - /* When the line ends in a comma don't align with it. */ + // When the line ends in a comma don't align with it. if (lnum == curwin->w_cursor.lnum && *s == ',' && cin_nocode(s + 1)) pos->col = 0; @@ -1468,7 +1455,7 @@ get_baseclass_amount(int col) amount = get_indent(); if (find_last_paren(ml_get_curline(), '(', ')') && (trypos = find_match_paren(curbuf->b_ind_maxparen)) != NULL) - amount = get_indent_lnum(trypos->lnum); /* XXX */ + amount = get_indent_lnum(trypos->lnum); // XXX if (!cin_ends_in(ml_get_curline(), (char_u *)",", NULL)) amount += curbuf->b_ind_cpp_baseclass; } @@ -1555,13 +1542,14 @@ cin_skip2pos(pos_T *trypos) * Find the '{' at the start of the block we are in. * Return NULL if no match found. * Ignore a '{' that is in a comment, makes indenting the next three lines - * work. */ + * work. + */ /* foo() */ /* { */ /* } */ static pos_T * -find_start_brace(void) /* XXX */ +find_start_brace(void) // XXX { pos_T cursor_save; pos_T *trypos; @@ -1571,13 +1559,13 @@ find_start_brace(void) /* XXX */ cursor_save = curwin->w_cursor; while ((trypos = findmatchlimit(NULL, '{', FM_BLOCKSTOP, 0)) != NULL) { - pos_copy = *trypos; /* copy pos_T, next findmatch will change it */ + pos_copy = *trypos; // copy pos_T, next findmatch will change it trypos = &pos_copy; curwin->w_cursor = *trypos; pos = NULL; - /* ignore the { if it's in a // or / * * / comment */ + // ignore the { if it's in a // or / * * / comment if ((colnr_T)cin_skip2pos(trypos) == trypos->col - && (pos = ind_find_start_CORS(NULL)) == NULL) /* XXX */ + && (pos = ind_find_start_CORS(NULL)) == NULL) // XXX break; if (pos != NULL) curwin->w_cursor.lnum = pos->lnum; @@ -1591,13 +1579,13 @@ find_start_brace(void) /* XXX */ * Return NULL if no match found. */ static pos_T * -find_match_paren(int ind_maxparen) /* XXX */ +find_match_paren(int ind_maxparen) // XXX { return find_match_char('(', ind_maxparen); } static pos_T * -find_match_char(int c, int ind_maxparen) /* XXX */ +find_match_char(int c, int ind_maxparen) // XXX { pos_T cursor_save; pos_T *trypos; @@ -1609,14 +1597,14 @@ find_match_char(int c, int ind_maxparen) /* XXX */ retry: if ((trypos = findmatchlimit(NULL, c, 0, ind_maxp_wk)) != NULL) { - /* check if the ( is in a // comment */ + // check if the ( is in a // comment if ((colnr_T)cin_skip2pos(trypos) > trypos->col) { ind_maxp_wk = ind_maxparen - (int)(cursor_save.lnum - trypos->lnum); if (ind_maxp_wk > 0) { curwin->w_cursor = *trypos; - curwin->w_cursor.col = 0; /* XXX */ + curwin->w_cursor.col = 0; // XXX goto retry; } trypos = NULL; @@ -1625,10 +1613,10 @@ retry: { pos_T *trypos_wk; - pos_copy = *trypos; /* copy trypos, findmatch will change it */ + pos_copy = *trypos; // copy trypos, findmatch will change it trypos = &pos_copy; curwin->w_cursor = *trypos; - if ((trypos_wk = ind_find_start_CORS(NULL)) != NULL) /* XXX */ + if ((trypos_wk = ind_find_start_CORS(NULL)) != NULL) // XXX { ind_maxp_wk = ind_maxparen - (int)(cursor_save.lnum - trypos_wk->lnum); @@ -1651,7 +1639,7 @@ retry: * Return NULL if no match found. */ static pos_T * -find_match_paren_after_brace (int ind_maxparen) /* XXX */ +find_match_paren_after_brace (int ind_maxparen) // XXX { pos_T *trypos = find_match_paren(ind_maxparen); @@ -1659,8 +1647,8 @@ find_match_paren_after_brace (int ind_maxparen) /* XXX */ { pos_T *tryposBrace = find_start_brace(); - /* If both an unmatched '(' and '{' is found. Ignore the '(' - * position if the '{' is further down. */ + // If both an unmatched '(' and '{' is found. Ignore the '(' + // position if the '{' is further down. if (tryposBrace != NULL && (trypos->lnum != tryposBrace->lnum ? trypos->lnum < tryposBrace->lnum @@ -1697,12 +1685,12 @@ find_last_paren(char_u *l, int start, int end) int retval = FALSE; int open_count = 0; - curwin->w_cursor.col = 0; /* default is start of line */ + curwin->w_cursor.col = 0; // default is start of line for (i = 0; l[i] != NUL; i++) { - i = (int)(cin_skipcomment(l + i) - l); /* ignore parens in comments */ - i = (int)(skip_string(l + i) - l); /* ignore parens in quotes */ + i = (int)(cin_skipcomment(l + i) - l); // ignore parens in comments + i = (int)(skip_string(l + i) - l); // ignore parens in quotes if (l[i] == start) ++open_count; else if (l[i] == end) @@ -1734,134 +1722,133 @@ parse_cino(buf_T *buf) int fraction = 0; int sw = (int)get_sw_value(buf); - /* - * Set the default values. - */ - /* Spaces from a block's opening brace the prevailing indent for that - * block should be. */ + // Set the default values. + + // Spaces from a block's opening brace the prevailing indent for that + // block should be. buf->b_ind_level = sw; - /* Spaces from the edge of the line an open brace that's at the end of a - * line is imagined to be. */ + // Spaces from the edge of the line an open brace that's at the end of a + // line is imagined to be. buf->b_ind_open_imag = 0; - /* Spaces from the prevailing indent for a line that is not preceded by - * an opening brace. */ + // Spaces from the prevailing indent for a line that is not preceded by + // an opening brace. buf->b_ind_no_brace = 0; - /* Column where the first { of a function should be located }. */ + // Column where the first { of a function should be located }. buf->b_ind_first_open = 0; - /* Spaces from the prevailing indent a leftmost open brace should be - * located. */ + // Spaces from the prevailing indent a leftmost open brace should be + // located. buf->b_ind_open_extra = 0; - /* Spaces from the matching open brace (real location for one at the left - * edge; imaginary location from one that ends a line) the matching close - * brace should be located. */ + // Spaces from the matching open brace (real location for one at the left + // edge; imaginary location from one that ends a line) the matching close + // brace should be located. buf->b_ind_close_extra = 0; - /* Spaces from the edge of the line an open brace sitting in the leftmost - * column is imagined to be. */ + // Spaces from the edge of the line an open brace sitting in the leftmost + // column is imagined to be. buf->b_ind_open_left_imag = 0; - /* Spaces jump labels should be shifted to the left if N is non-negative, - * otherwise the jump label will be put to column 1. */ + // Spaces jump labels should be shifted to the left if N is non-negative, + // otherwise the jump label will be put to column 1. buf->b_ind_jump_label = -1; - /* Spaces from the switch() indent a "case xx" label should be located. */ + // Spaces from the switch() indent a "case xx" label should be located. buf->b_ind_case = sw; - /* Spaces from the "case xx:" code after a switch() should be located. */ + // Spaces from the "case xx:" code after a switch() should be located. buf->b_ind_case_code = sw; - /* Lineup break at end of case in switch() with case label. */ + // Lineup break at end of case in switch() with case label. buf->b_ind_case_break = 0; - /* Spaces from the class declaration indent a scope declaration label - * should be located. */ + // Spaces from the class declaration indent a scope declaration label + // should be located. buf->b_ind_scopedecl = sw; - /* Spaces from the scope declaration label code should be located. */ + // Spaces from the scope declaration label code should be located. buf->b_ind_scopedecl_code = sw; - /* Amount K&R-style parameters should be indented. */ + // Amount K&R-style parameters should be indented. buf->b_ind_param = sw; - /* Amount a function type spec should be indented. */ + // Amount a function type spec should be indented. buf->b_ind_func_type = sw; - /* Amount a cpp base class declaration or constructor initialization - * should be indented. */ + // Amount a cpp base class declaration or constructor initialization + // should be indented. buf->b_ind_cpp_baseclass = sw; - /* additional spaces beyond the prevailing indent a continuation line - * should be located. */ + // additional spaces beyond the prevailing indent a continuation line + // should be located. buf->b_ind_continuation = sw; - /* Spaces from the indent of the line with an unclosed parentheses. */ + // Spaces from the indent of the line with an unclosed parentheses. buf->b_ind_unclosed = sw * 2; - /* Spaces from the indent of the line with an unclosed parentheses, which - * itself is also unclosed. */ + // Spaces from the indent of the line with an unclosed parentheses, which + // itself is also unclosed. buf->b_ind_unclosed2 = sw; - /* Suppress ignoring spaces from the indent of a line starting with an - * unclosed parentheses. */ + // Suppress ignoring spaces from the indent of a line starting with an + // unclosed parentheses. buf->b_ind_unclosed_noignore = 0; - /* If the opening paren is the last nonwhite character on the line, and - * b_ind_unclosed_wrapped is nonzero, use this indent relative to the outer - * context (for very long lines). */ + // If the opening paren is the last nonwhite character on the line, and + // b_ind_unclosed_wrapped is nonzero, use this indent relative to the outer + // context (for very long lines). buf->b_ind_unclosed_wrapped = 0; - /* Suppress ignoring white space when lining up with the character after - * an unclosed parentheses. */ + // Suppress ignoring white space when lining up with the character after + // an unclosed parentheses. buf->b_ind_unclosed_whiteok = 0; - /* Indent a closing parentheses under the line start of the matching - * opening parentheses. */ + // Indent a closing parentheses under the line start of the matching + // opening parentheses. buf->b_ind_matching_paren = 0; - /* Indent a closing parentheses under the previous line. */ + // Indent a closing parentheses under the previous line. buf->b_ind_paren_prev = 0; - /* Extra indent for comments. */ + // Extra indent for comments. buf->b_ind_comment = 0; - /* Spaces from the comment opener when there is nothing after it. */ + // Spaces from the comment opener when there is nothing after it. buf->b_ind_in_comment = 3; - /* Boolean: if non-zero, use b_ind_in_comment even if there is something - * after the comment opener. */ + // Boolean: if non-zero, use b_ind_in_comment even if there is something + // after the comment opener. buf->b_ind_in_comment2 = 0; - /* Max lines to search for an open paren. */ + // Max lines to search for an open paren. buf->b_ind_maxparen = 20; - /* Max lines to search for an open comment. */ + // Max lines to search for an open comment. buf->b_ind_maxcomment = 70; - /* Handle braces for java code. */ + // Handle braces for java code. buf->b_ind_java = 0; - /* Not to confuse JS object properties with labels. */ + // Not to confuse JS object properties with labels. buf->b_ind_js = 0; - /* Handle blocked cases correctly. */ + // Handle blocked cases correctly. buf->b_ind_keep_case_label = 0; - /* Handle C++ namespace. */ + // Handle C++ namespace. buf->b_ind_cpp_namespace = 0; - /* Handle continuation lines containing conditions of if(), for() and - * while(). */ + // Handle continuation lines containing conditions of if(), for() and + // while(). buf->b_ind_if_for_while = 0; - /* indentation for # comments */ + // indentation for # comments buf->b_ind_hash_comment = 0; - |