Skip to content

Commit c553244

Browse files
committed
Fix grammar for infix function signature
fix #13
1 parent 3799b5f commit c553244

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

grammars/ocaml.cson

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -808,13 +808,13 @@
808808
'module-signature':
809809
'patterns': [
810810
{
811-
'begin': '(val)\\s+([a-z_][a-zA-Z0-9_\']*)\\s*(:)'
811+
'begin': '(val)\\s+(([a-z_][a-zA-Z0-9_\']*)|(\\(\\s*[=<>@^&+\\-*/$%|][|!$%&*+./:<=>?@^~-]*\\s*\\)))\\s*(:)'
812812
'beginCaptures':
813813
'1':
814814
'name': 'keyword.other.ocaml'
815815
'2':
816816
'name': 'entity.name.type.value-signature.ocaml'
817-
'3':
817+
'5':
818818
'name': 'punctuation.separator.type-constraint.ocaml'
819819
'end': '(?=\\b(type|val|external|class|module|end)\\b)|^\\s*$'
820820
'name': 'meta.module.signature.val.ocaml'

spec/ocaml.spec

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,17 @@ begin fun x -> y end
5050
// ^ keyword.operator.infix.integer.ocaml
5151
a|>b
5252
// ^^ entity.name.function.infix.ocaml
53+
val test: a -> b
54+
// <- keyword.other.ocaml
55+
// ^^^^ entity.name.type.value-signature.ocaml
56+
// ^ punctuation.separator.type-constraint.ocaml
57+
// ^ storage.type.ocaml
58+
// ^^ punctuation.separator.function-return.ocaml
59+
// ^ storage.type.ocaml
60+
val ( >> ): a -> b
61+
// <- keyword.other.ocaml
62+
// ^^^^^^ entity.name.type.value-signature.ocaml
63+
// ^ punctuation.separator.type-constraint.ocaml
64+
// ^ storage.type.ocaml
65+
// ^^ punctuation.separator.function-return.ocaml
66+
// ^ storage.type.ocaml

0 commit comments

Comments
 (0)