Skip to content

Commit

Permalink
feat(syntaxes): linguist compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
huwaireb committed Dec 2, 2024
1 parent 50bda9f commit 675eae7
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 50 deletions.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,11 @@
"scopeName": "source.dune-workspace",
"path": "./syntaxes/dune-workspace.json"
},
{
"language": "dune-all",
"scopeName": "source.dune-all",
"path": "./syntaxes/dune-all.json"
},
{
"language": "ocaml.merlin",
"scopeName": "source.ocaml.merlin",
Expand Down
4 changes: 3 additions & 1 deletion syntaxes/atd.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
"1": { "name": "keyword.other.atd" },
"2": { "name": "keyword.other.atd" }
},
"endCaptures": [{ "name": "keyword.other.atd" }],
"endCaptures": {
"1": { "name": "keyword.other.atd" }
},
"patterns": [{ "include": "$self" }]
}
]
Expand Down
22 changes: 16 additions & 6 deletions syntaxes/cram.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,24 +135,34 @@
{
"begin": "\\[\\^?",
"end": "\\]",
"beginCaptures": [{ "name": "keyword.other.regex" }],
"endCaptures": [{ "name": "keyword.other.regex" }],
"beginCaptures": {
"1": { "name": "keyword.other.regex" }
},
"endCaptures": {
"1": { "name": "keyword.other.regex" }
},
"contentName": "source.regex",
"patterns": [{ "name": "keyword.other.regex", "match": "-" }]
},
{
"begin": "\\((\\?[:=!])?",
"end": "\\)",
"beginCaptures": [{ "name": "keyword.other.regex" }],
"endCaptures": [{ "name": "keyword.other.regex" }],
"beginCaptures": {
"1": { "name": "keyword.other.regex" }
},
"endCaptures": {
"1": { "name": "keyword.other.regex" }
},
"contentName": "source.regex",
"patterns": [{ "include": "#regex" }]
},
{
"begin": "{",
"end": "}",
"beginCaptures": [{ "name": "keyword.other.regex" }],
"endCaptures": [{ "name": "keyword.other.regex" }],
"beginCaptures": {
"1": { "name": "keyword.other.regex" }
},
"endCaptures": { "1": { "name": "keyword.other.regex" } },
"contentName": "source.regex",
"patterns": [
{
Expand Down
11 changes: 11 additions & 0 deletions syntaxes/dune-all.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "dune-all",
"scopeName": "source.dune-all",
"fileTypes": ["dune", "dune-project", "dune-workspace"],
"patterns": [
{ "include": "source.dune#general" },
{ "include": "source.dune#stanzas" },
{ "include": "source.dune-project#stanzas" },
{ "include": "source.dune-workspace#stanzas" }
]
}
24 changes: 12 additions & 12 deletions syntaxes/dune.json
Original file line number Diff line number Diff line change
Expand Up @@ -2788,16 +2788,16 @@
"comment": "variable",
"begin": "%\\{",
"end": "\\}",
"beginCaptures": [
{
"beginCaptures": {
"1": {
"name": "keyword.operator.dune"
}
],
"endCaptures": [
{
},
"endCaptures": {
"1": {
"name": "keyword.operator.dune"
}
],
},
"patterns": [
{
"include": "#variables"
Expand Down Expand Up @@ -2876,16 +2876,16 @@
"comment": "escaped variable",
"begin": "(\\%\\{)",
"end": "(\\})",
"beginCaptures": [
{
"beginCaptures": {
"1": {
"name": "constant.character.escape.dune"
}
],
"endCaptures": [
{
},
"endCaptures": {
"1": {
"name": "constant.character.escape.dune"
}
],
},
"patterns": [
{
"include": "#variables"
Expand Down
34 changes: 17 additions & 17 deletions syntaxes/menhir.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
{
"comment": "sequence of rules",
"begin": "%%",
"beginCaptures": [{ "name": "keyword.other.menhir" }],
"beginCaptures": { "1": { "name": "keyword.other.menhir" } },
"end": "%%",
"endCaptures": [{ "name": "keyword.other.menhir" }],
"endCaptures": { "1": { "name": "keyword.other.menhir" } },
"patterns": [{ "include": "#comments" }, { "include": "#rules" }]
},
{ "include": "source.ocaml" }
Expand Down Expand Up @@ -44,15 +44,15 @@
{
"comment": "ocaml header",
"begin": "%{",
"beginCaptures": [{ "name": "keyword.other.menhir" }],
"beginCaptures": { "1": { "name": "keyword.other.menhir" } },
"end": "%}",
"endCaptures": [{ "name": "keyword.other.menhir" }],
"endCaptures": { "1": { "name": "keyword.other.menhir" } },
"patterns": [{ "include": "source.ocaml" }]
},
{
"comment": "token declaration",
"begin": "%token\\b",
"beginCaptures": [{ "name": "keyword.other.menhir" }],
"beginCaptures": { "1": { "name": "keyword.other.menhir" } },
"end": "(?=%)",
"patterns": [
{ "include": "#type-annotation" },
Expand All @@ -65,7 +65,7 @@
{
"comment": "associativity declaration",
"begin": "%(?:nonassoc|left|right)\\b",
"beginCaptures": [{ "name": "keyword.other.menhir" }],
"beginCaptures": { "1": { "name": "keyword.other.menhir" } },
"end": "(?=%)",
"patterns": [
{ "include": "#token-name" },
Expand All @@ -78,7 +78,7 @@
{
"comment": "type/start/on_error_reduce declaration",
"begin": "%(?:type|start|on_error_reduce)\\b",
"beginCaptures": [{ "name": "keyword.other.menhir" }],
"beginCaptures": { "1": { "name": "keyword.other.menhir" } },
"end": "(?=%)",
"patterns": [
{ "include": "#type-annotation" },
Expand All @@ -96,7 +96,7 @@
{
"comment": "attribute declaration",
"begin": "%(?:attribute\\b|(?=\\[))",
"beginCaptures": [{ "name": "keyword.other.menhir" }],
"beginCaptures": { "1": { "name": "keyword.other.menhir" } },
"end": "(?=%)",
"patterns": [
{ "include": "source.ocaml#attributes" },
Expand All @@ -113,8 +113,8 @@
"comment": "ocaml type annotation for token",
"begin": "<",
"end": ">",
"beginCaptures": [{ "name": "keyword.other.menhir" }],
"endCaptures": [{ "name": "keyword.other.menhir" }],
"beginCaptures": { "1": { "name": "keyword.other.menhir" } },
"endCaptures": { "1": { "name": "keyword.other.menhir" } },
"patterns": [{ "include": "source.ocaml" }]
}
}
Expand Down Expand Up @@ -167,7 +167,7 @@
{
"comment": "production",
"begin": "[:|]",
"beginCaptures": [{ "name": "keyword.other.menhir" }],
"beginCaptures": { "1": { "name": "keyword.other.menhir" } },
"end": "(?=[{<|]|let\\b|[[:lower:]_][[:word:]]*[[:space:]]*(?:\\([^)]+\\)[[:space:]]*)?:|%(?!prec\\b))",
"patterns": [
{ "include": "#comments" },
Expand Down Expand Up @@ -214,7 +214,7 @@
{
"comment": "production",
"begin": "[:|]",
"beginCaptures": [{ "name": "keyword.other.menhir" }],
"beginCaptures": { "1": { "name": "keyword.other.menhir" } },
"end": "(?=[{<|]|let\\b|[[:lower:]_][[:word:]]*[[:space:]]*(?:\\([^)]+\\)[[:space:]]*)?:|%(?!prec\\b))",
"patterns": [
{ "include": "#comments" },
Expand All @@ -238,9 +238,9 @@
"comment": "ocaml semantic action",
"contentName": "source.embedded-action.menhir",
"begin": "{",
"beginCaptures": [{ "name": "keyword.other.menhir" }],
"beginCaptures": { "1": { "name": "keyword.other.menhir" } },
"end": "}",
"endCaptures": [{ "name": "keyword.other.menhir" }],
"endCaptures": { "1": { "name": "keyword.other.menhir" } },
"patterns": [{ "include": "source.ocaml" }]
},
"new-actions": {
Expand All @@ -249,9 +249,9 @@
{
"comment": "point-free ocaml semantic action",
"begin": "<",
"beginCaptures": [{ "name": "keyword.other.menhir" }],
"beginCaptures": { "1": { "name": "keyword.other.menhir" } },
"end": ">",
"endCaptures": [{ "name": "keyword.other.menhir" }],
"endCaptures": { "1": { "name": "keyword.other.menhir" } },
"patterns": [{ "include": "source.ocaml" }]
}
]
Expand Down Expand Up @@ -279,7 +279,7 @@
},
{
"comment": "destructured semantic value capture",
"begin": "(?<![[:word:]][[:space:]]*)\\(",
"begin": "(?<!w)(",
"end": "\\)[[:space:]]*(=)",
"endCaptures": {
"1": { "name": "keyword.other.menhir" }
Expand Down
12 changes: 6 additions & 6 deletions syntaxes/ocaml.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@
"comment": "Cinaps comment",
"begin": "\\(\\*\\$",
"end": "\\*\\)",
"beginCaptures": [{ "name": "comment.cinaps.ocaml" }],
"endCaptures": [{ "name": "comment.cinaps.ocaml" }],
"beginCaptures": { "1": { "name": "comment.cinaps.ocaml" } },
"endCaptures": { "1": { "name": "comment.cinaps.ocaml" } },
"patterns": [{ "include": "$self" }]
},
{
Expand Down Expand Up @@ -333,15 +333,15 @@
{
"begin": "\\b(sig)\\b",
"end": "\\b(end)\\b",
"beginCaptures": [{ "name": "keyword.other.ocaml" }],
"endCaptures": [{ "name": "keyword.other.ocaml" }],
"beginCaptures": { "1": { "name": "keyword.other.ocaml" } },
"endCaptures": { "1": { "name": "keyword.other.ocaml" } },
"patterns": [{ "include": "source.ocaml.interface" }]
},
{
"begin": "\\b(struct)\\b",
"end": "\\b(end)\\b",
"beginCaptures": [{ "name": "keyword.other.ocaml" }],
"endCaptures": [{ "name": "keyword.other.ocaml" }],
"beginCaptures": { "1": { "name": "keyword.other.ocaml" } },
"endCaptures": { "1": { "name": "keyword.other.ocaml" } },
"patterns": [{ "include": "$self" }]
}
]
Expand Down
12 changes: 6 additions & 6 deletions syntaxes/ocamlbuild.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
{
"begin": "<",
"end": ">",
"beginCaptures": [{ "name": "keyword.operator.ocamlbuild" }],
"endCaptures": [{ "name": "keyword.operator.ocamlbuild" }],
"beginCaptures": { "1": { "name": "keyword.operator.ocamlbuild" } },
"endCaptures": { "1": { "name": "keyword.operator.ocamlbuild" } },
"name": "string.quoted.double.ocamlbuild",
"patterns": [{ "include": "#patterns" }]
},
Expand Down Expand Up @@ -65,8 +65,8 @@
{
"begin": "{",
"end": "}",
"beginCaptures": [{ "name": "keyword.operator.ocamlbuild" }],
"endCaptures": [{ "name": "keyword.operator.ocamlbuild" }],
"beginCaptures": { "1": { "name": "keyword.operator.ocamlbuild" } },
"endCaptures": { "1": { "name": "keyword.operator.ocamlbuild" } },
"patterns": [
{ "name": "keyword.operator.ocamlbuild", "match": "," },
{ "include": "#patterns" }
Expand All @@ -75,8 +75,8 @@
{
"begin": "\\[\\^?",
"end": "\\]",
"beginCaptures": [{ "name": "keyword.operator.ocamlbuild" }],
"endCaptures": [{ "name": "keyword.operator.ocamlbuild" }]
"beginCaptures": { "1": { "name": "keyword.operator.ocamlbuild" } },
"endCaptures": { "1": { "name": "keyword.operator.ocamlbuild" } }
}
]
},
Expand Down
8 changes: 6 additions & 2 deletions syntaxes/ocamllex.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,13 @@
{
"comment": "embedded ocaml source",
"begin": "{",
"beginCaptures": [{ "name": "keyword.other.ocamllex" }],
"beginCaptures": {
"1": { "name": "keyword.other.ocamllex" }
},
"end": "}",
"endCaptures": [{ "name": "keyword.other.ocamllex" }],
"endCaptures": {
"1": { "name": "keyword.other.ocamllex" }
},
"patterns": [{ "include": "source.ocaml" }]
}
]
Expand Down

0 comments on commit 675eae7

Please sign in to comment.