Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Commit f7af5c0

Browse files
Iwanchenglou
authored andcommitted
Remove "with" as internal token.
1 parent 3cd561a commit f7af5c0

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/res_core.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3782,7 +3782,7 @@ and parseAtomicTypExpr ~attrs p =
37823782
and parsePackageType ~startPos ~attrs p =
37833783
let modTypePath = parseModuleLongIdent ~lowercase:true p in
37843784
begin match p.Parser.token with
3785-
| With ->
3785+
| Lident "with" ->
37863786
Parser.next p;
37873787
let constraints = parsePackageConstraints p in
37883788
let loc = mkLoc startPos p.prevEndPos in
@@ -5769,7 +5769,7 @@ and parseFunctorModuleType p =
57695769

57705770
and parseWithConstraints moduleType p =
57715771
match p.Parser.token with
5772-
| With ->
5772+
| Lident "with" ->
57735773
Parser.next p;
57745774
let first = parseWithConstraint p in
57755775
let rec loop p acc =

src/res_token.ml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ type t =
5555
| Include
5656
| Module
5757
| Of
58-
| With
5958
| Land | Lor
6059
| Band (* Bitwise and: & *)
6160
| BangEqual | BangEqualEqual
@@ -143,7 +142,6 @@ let toString = function
143142
| Include -> "include"
144143
| Module -> "module"
145144
| Of -> "of"
146-
| With -> "with"
147145
| Lor -> "||"
148146
| Band -> "&" | Land -> "&&"
149147
| BangEqual -> "!=" | BangEqualEqual -> "!=="
@@ -191,15 +189,14 @@ let keywordTable = function
191189
| "type" -> Typ
192190
| "when" -> When
193191
| "while" -> While
194-
| "with" -> With
195192
| _ -> raise Not_found
196193
[@@raises Not_found]
197194

198195
let isKeyword = function
199196
| And | As | Assert | Constraint | Else | Exception | Export
200197
| External | False | For | If | Import | In | Include | Land | Lazy
201198
| Let | List | Lor | Module | Mutable | Of | Open | Private | Rec
202-
| Switch | True | Try | Typ | When | While | With -> true
199+
| Switch | True | Try | Typ | When | While -> true
203200
| _ -> false
204201

205202
let lookupKeyword str =

tests/parsing/grammar/expressions/__snapshots__/parse.spec.js.snap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,8 @@ let x = _ident_ident
531531
let x = _ident_ident_
532532
let x = __ident__
533533
let x = list
534-
let x = Foo.Bar.list"
534+
let x = Foo.Bar.list
535+
let with = with"
535536
`;
536537
537538
exports[`if.js 1`] = `

tests/parsing/grammar/expressions/ident.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ let x = __ident__
99

1010
let x = list
1111
let x = Foo.Bar.list
12+
13+
let with = with

0 commit comments

Comments
 (0)