Skip to content

Commit 6e352b4

Browse files
committed
Clean up parser recovery.
Use symbol "_" like in other places in the parser.
1 parent f166769 commit 6e352b4

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

analysis/src/Commands.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ let completionWithParser ~debug ~path ~posCursor ~currentFile ~text =
534534
let contextPath =
535535
PartialParser.CPField
536536
( CPId (Utils.flattenLongIdent id, Module),
537-
if name = "$" then "" else name )
537+
if name = "_" then "" else name )
538538
in
539539
setResult (PartialParser.Cpath contextPath)
540540
| Lapply _ -> ()

analysis/src/Utils.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ let flattenLongIdent ?(jsx = false) lid =
6060
| Ldot (lid, txt) ->
6161
let acc =
6262
if jsx && txt = "createElement" then acc
63-
else if txt = "$" then "" :: acc
63+
else if txt = "_" then "" :: acc
6464
else txt :: acc
6565
in
6666
loop acc lid

analysis/src/vendor/res_outcome_printer/res_core.ml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ let parseValuePath p =
660660
)
661661
| token ->
662662
Parser.err p (Diagnostics.unexpected token p.breadcrumbs);
663-
Longident.Ldot (path, "$")
663+
Longident.Ldot (path, "_")
664664
in
665665
let ident = match p.Parser.token with
666666
| Lident ident -> Longident.Lident ident
@@ -692,7 +692,7 @@ let parseValuePathTail p startPos ident =
692692
loop p (Longident.Ldot (path, ident))
693693
| token ->
694694
Parser.err p (Diagnostics.unexpected token p.breadcrumbs);
695-
Location.mkloc (Longident.Ldot (path, "$")) (mkLoc startPos p.prevEndPos)
695+
Location.mkloc (Longident.Ldot (path, "_")) (mkLoc startPos p.prevEndPos)
696696
in
697697
loop p ident
698698

@@ -715,7 +715,7 @@ let parseModuleLongIdentTail ~lowercase p startPos ident =
715715
end
716716
| t ->
717717
Parser.err p (Diagnostics.uident t);
718-
Location.mkloc (Longident.Ldot (acc, "$")) (mkLoc startPos p.prevEndPos)
718+
Location.mkloc (Longident.Ldot (acc, "_")) (mkLoc startPos p.prevEndPos)
719719
in
720720
loop p ident
721721

@@ -3539,9 +3539,8 @@ and parseValueOrConstructor p =
35393539
Parser.next p;
35403540
let loc = mkLoc startPos p.prevEndPos in
35413541
Parser.err p (Diagnostics.unexpected token p.breadcrumbs);
3542-
let lident = buildLongident ("$"::acc) in
3542+
let lident = buildLongident ("_"::acc) in
35433543
Ast_helper.Exp.ident ~loc (Location.mkloc lident loc)
3544-
(* Recover.defaultExpr() *)
35453544
in
35463545
aux p []
35473546

0 commit comments

Comments
 (0)