Skip to content

Commit 67f2990

Browse files
authored
regex improvements (#607)
small regex improvements
1 parent ba6dce3 commit 67f2990

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

indent/javascript.vim

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ else
3737
endfunction
3838
endif
3939

40-
let s:line_pre = '^\s*\%(\/\*.\{-}\*\/\s*\)*'
40+
let s:line_pre = '^\s*\%(\%(\/\*.\{-}\)\=\*\+\/\s*\)\='
4141
let s:expr_case = s:line_pre . '\%(\%(case\>.\+\)\|default\)\s*:'
4242
" Regex of syntax group names that are or delimit string or are comments.
4343
let s:syng_strcom = '\%(s\%(tring\|pecial\)\|comment\|regex\|doc\|template\)'
@@ -58,14 +58,14 @@ else
5858
endfunction
5959
endif
6060

61-
let s:line_term = '\%(\s*\%(\/\*.\{-}\*\/\s*\)\=\)\@>$'
61+
let s:line_term = '\s*\%(\%(\/\%(\%(\*.\{-}\*\/\)\|\%(\*\+\)\)\)\s*\)\=$'
6262

6363
" configurable regexes that define continuation lines, not including (, {, or [.
6464
if !exists('g:javascript_opfirst')
65-
let g:javascript_opfirst = '\%([<>,:?^%|&]\|\([-/.+]\)\%(\1\|\*\|\/\)\@!\|\*\/\@!\|=>\@!\|in\%(stanceof\)\=\>\)'
65+
let g:javascript_opfirst = '\%([<>,:?^%|*&]\|\([-/.+]\)\1\@!\|=>\@!\|in\%(stanceof\)\=\>\)'
6666
endif
6767
if !exists('g:javascript_continuation')
68-
let g:javascript_continuation = '\%([<=*,.?:^%|&]\|+\@<!+\|-\@<!-\|=\@<!>\|\*\@<!\/\|\<in\%(stanceof\)\=\)'
68+
let g:javascript_continuation = '\%([<=,.?/*:^%|&]\|+\@<!+\|-\@<!-\|=\@<!>\|\<in\%(stanceof\)\=\)'
6969
endif
7070

7171
let g:javascript_opfirst = s:line_pre . g:javascript_opfirst

0 commit comments

Comments
 (0)