File tree Expand file tree Collapse file tree 1 file changed +4
-13
lines changed Expand file tree Collapse file tree 1 file changed +4
-13
lines changed Original file line number Diff line number Diff line change @@ -1812,18 +1812,9 @@ and parse_constrained_expr_region p =
18121812 | _ -> Some expr)
18131813 | _ -> None
18141814
1815- and parse_regex p pattern flags =
1816- let start_pos = p.Parser. start_pos in
1815+ and parse_regex ~start_pos p pattern flags =
18171816 Parser. next p;
1818- let loc =
1819- mk_loc
1820- {
1821- start_pos with
1822- (* Account for the inserted leading `/` *)
1823- pos_cnum = start_pos.pos_cnum - 1 ;
1824- }
1825- p.prev_end_pos
1826- in
1817+ let loc = mk_loc start_pos p.prev_end_pos in
18271818 let payload =
18281819 Parsetree. PStr
18291820 [
@@ -1911,13 +1902,13 @@ and parse_atomic_expr p =
19111902 | Forwardslash -> (
19121903 Parser. next_regex_token p;
19131904 match p.token with
1914- | Regex (pattern , flags ) -> parse_regex p pattern flags
1905+ | Regex (pattern , flags ) -> parse_regex ~start_pos p pattern flags
19151906 | _ -> Ast_helper.Exp. extension (Location. mknoloc " re" , Parsetree. PStr [] )
19161907 )
19171908 | ForwardslashDot -> (
19181909 Parser. next_regex_token p;
19191910 match p.token with
1920- | Regex (pattern , flags ) -> parse_regex p (" ." ^ pattern) flags
1911+ | Regex (pattern , flags ) -> parse_regex ~start_pos p (" ." ^ pattern) flags
19211912 | _ -> Ast_helper.Exp. extension (Location. mknoloc " re" , Parsetree. PStr [] )
19221913 )
19231914 | token -> (
You can’t perform that action at this time.
0 commit comments