aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/regexp.c
diff options
context:
space:
mode:
authordundargoc <gocdundar@gmail.com>2023-11-16 10:59:11 +0100
committerdundargoc <33953936+dundargoc@users.noreply.github.com>2023-11-20 19:57:09 +0100
commita6e3d93421ba13c407a96fac9cc01fa41ec7ad98 (patch)
treee84209969b11fe2f0dabcad00a271468b2199bc9 /src/nvim/regexp.c
parentec79ff893d5906e1f0d90953cffa535ffae47823 (diff)
downloadrneovim-a6e3d93421ba13c407a96fac9cc01fa41ec7ad98.tar.gz
rneovim-a6e3d93421ba13c407a96fac9cc01fa41ec7ad98.tar.bz2
rneovim-a6e3d93421ba13c407a96fac9cc01fa41ec7ad98.zip
refactor: enable formatting for ternaries
This requires removing the "Inner expression should be aligned" rule from clint as it prevents essentially any formatting regarding ternary operators.
Diffstat (limited to 'src/nvim/regexp.c')
-rw-r--r--src/nvim/regexp.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c
index db17cfc19b..433a008014 100644
--- a/src/nvim/regexp.c
+++ b/src/nvim/regexp.c
@@ -5109,9 +5109,9 @@ static uint8_t *reg(int paren, int *flagp)
}
// Make a closing node, and hook it on the end.
- ender = regnode(paren == REG_ZPAREN ? ZCLOSE + parno :
- paren == REG_PAREN ? MCLOSE + parno :
- paren == REG_NPAREN ? NCLOSE : END);
+ ender = regnode(paren == REG_ZPAREN ? ZCLOSE + parno
+ : paren == REG_PAREN ? MCLOSE + parno
+ : paren == REG_NPAREN ? NCLOSE : END);
regtail(ret, ender);
// Hook the tails of the branches to the closing node.
@@ -5985,8 +5985,8 @@ static bool regmatch(uint8_t *scan, proftime_T *tm, int *timed_out)
pos = &fm->mark;
const colnr_T pos_col = pos->lnum == rex.lnum + rex.reg_firstlnum
&& pos->col == MAXCOL
- ? (colnr_T)strlen(reg_getline(pos->lnum - rex.reg_firstlnum))
- : pos->col;
+ ? (colnr_T)strlen(reg_getline(pos->lnum - rex.reg_firstlnum))
+ : pos->col;
if (pos->lnum == rex.lnum + rex.reg_firstlnum
? (pos_col == (colnr_T)(rex.input - rex.line)
@@ -10064,8 +10064,8 @@ static int nfa_regatom(void)
n = curwin->w_cursor.lnum;
}
// \%{n}l \%{n}<l \%{n}>l
- EMIT(cmp == '<' ? NFA_LNUM_LT :
- cmp == '>' ? NFA_LNUM_GT : NFA_LNUM);
+ EMIT(cmp == '<' ? NFA_LNUM_LT
+ : cmp == '>' ? NFA_LNUM_GT : NFA_LNUM);
if (save_prev_at_start) {
at_start = true;
}
@@ -10075,8 +10075,8 @@ static int nfa_regatom(void)
n++;
}
// \%{n}c \%{n}<c \%{n}>c
- EMIT(cmp == '<' ? NFA_COL_LT :
- cmp == '>' ? NFA_COL_GT : NFA_COL);
+ EMIT(cmp == '<' ? NFA_COL_LT
+ : cmp == '>' ? NFA_COL_GT : NFA_COL);
} else {
if (cur) {
colnr_T vcol = 0;
@@ -10084,8 +10084,8 @@ static int nfa_regatom(void)
n = ++vcol;
}
// \%{n}v \%{n}<v \%{n}>v
- EMIT(cmp == '<' ? NFA_VCOL_LT :
- cmp == '>' ? NFA_VCOL_GT : NFA_VCOL);
+ EMIT(cmp == '<' ? NFA_VCOL_LT
+ : cmp == '>' ? NFA_VCOL_GT : NFA_VCOL);
limit = INT32_MAX / MB_MAXBYTES;
}
if (n >= limit) {
@@ -10096,8 +10096,8 @@ static int nfa_regatom(void)
break;
} else if (c == '\'' && n == 0) {
// \%'m \%<'m \%>'m
- EMIT(cmp == '<' ? NFA_MARK_LT :
- cmp == '>' ? NFA_MARK_GT : NFA_MARK);
+ EMIT(cmp == '<' ? NFA_MARK_LT
+ : cmp == '>' ? NFA_MARK_GT : NFA_MARK);
EMIT(getchr());
break;
}
@@ -10271,7 +10271,7 @@ collection:
if (*regparse == 'n') {
startc = (reg_string || emit_range || regparse[1] == '-')
- ? NL : NFA_NEWL;
+ ? NL : NFA_NEWL;
} else if (*regparse == 'd'
|| *regparse == 'o'
|| *regparse == 'x'
@@ -14435,9 +14435,9 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start, regsubs_T *subm
}
}
} else if (state->c < 0 ? check_char_class(state->c, curc)
- : (curc == state->c
- || (rex.reg_ic
- && utf_fold(curc) == utf_fold(state->c)))) {
+ : (curc == state->c
+ || (rex.reg_ic
+ && utf_fold(curc) == utf_fold(state->c)))) {
result = result_if_matched;
break;
}
@@ -14780,18 +14780,18 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start, regsubs_T *subm
pos_T *pos = &fm->mark;
const colnr_T pos_col = pos->lnum == rex.lnum + rex.reg_firstlnum
&& pos->col == MAXCOL
- ? (colnr_T)strlen(reg_getline(pos->lnum - rex.reg_firstlnum))
- : pos->col;
+ ? (colnr_T)strlen(reg_getline(pos->lnum - rex.reg_firstlnum))
+ : pos->col;
result = pos->lnum == rex.lnum + rex.reg_firstlnum
- ? (pos_col == (colnr_T)(rex.input - rex.line)
- ? t->state->c == NFA_MARK
- : (pos_col < (colnr_T)(rex.input - rex.line)
- ? t->state->c == NFA_MARK_GT
- : t->state->c == NFA_MARK_LT))
- : (pos->lnum < rex.lnum + rex.reg_firstlnum
- ? t->state->c == NFA_MARK_GT
- : t->state->c == NFA_MARK_LT);
+ ? (pos_col == (colnr_T)(rex.input - rex.line)
+ ? t->state->c == NFA_MARK
+ : (pos_col < (colnr_T)(rex.input - rex.line)
+ ? t->state->c == NFA_MARK_GT
+ : t->state->c == NFA_MARK_LT))
+ : (pos->lnum < rex.lnum + rex.reg_firstlnum
+ ? t->state->c == NFA_MARK_GT
+ : t->state->c == NFA_MARK_LT);
if (result) {
add_here = true;
add_state = t->state->out;