Skip to content

Commit 4c4056d

Browse files
committed
add package manifest, lark grammar, and configuration
1 parent baee505 commit 4c4056d

File tree

3 files changed

+145
-0
lines changed

3 files changed

+145
-0
lines changed

language-configuration.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"comments": {
3+
"lineComment": "//"
4+
},
5+
"brackets": [
6+
["(", ")"],
7+
["[", "]"]
8+
],
9+
"autoClosingPairs": [
10+
{ "open": "(", "close": ")" },
11+
{ "open": "[", "close": "]" },
12+
{ "open": "/", "close": "/" },
13+
{ "open": "\"", "close": "\"" }
14+
],
15+
"surroundingPairs": [
16+
["(", ")"],
17+
["[", "]"],
18+
["/", "/"],
19+
["\"", "\""]
20+
]
21+
}

package.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"name": "vscode-lark",
3+
"version": "0.0.0",
4+
"publisher": "dirk-thomas",
5+
"engines": {
6+
"vscode": "^1.2.0"
7+
},
8+
"license": "Apache-2.0",
9+
"displayName": "Lark grammar syntax support",
10+
"description": "Language support for Lark grammar files",
11+
"categories": [
12+
"Languages"
13+
],
14+
"homepage": "https://marketplace.visualstudio.com/items?itemName=dirk-thomas.vscode-lark",
15+
"repository": {
16+
"type": "git",
17+
"url": "https://github.com/dirk-thomas/vscode-lark"
18+
},
19+
"bugs": {
20+
"url": "https://github.com/dirk-thomas/vscode-lark/issues"
21+
},
22+
"contributes": {
23+
"languages": [
24+
{
25+
"id": "lark",
26+
"aliases": [
27+
"Lark"
28+
],
29+
"extensions": [
30+
".lark"
31+
],
32+
"configuration": "./language-configuration.json"
33+
}
34+
],
35+
"grammars": [
36+
{
37+
"language": "lark",
38+
"scopeName": "source.lark",
39+
"path": "./syntaxes/lark.json"
40+
}
41+
]
42+
}
43+
}

syntaxes/lark.json

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{
2+
"patterns": [
3+
{
4+
"comment": "Lark comment line",
5+
"match": "//.*",
6+
"name": "comment.line.double-slash"
7+
},
8+
{
9+
"comment": "Lark ignore directive",
10+
"match": "%ignore",
11+
"name": "keyword.other"
12+
},
13+
{
14+
"comment": "Lark import directive",
15+
"match": "(%import) [a-z0-9]+.",
16+
"captures": {
17+
"1": {
18+
"name": "keyword.control"
19+
}
20+
}
21+
},
22+
{
23+
"comment": "Lark (case-insensitive) string",
24+
"match": "(\"(([^\"\\\\]|\\\\.)*)\")(i)?",
25+
"captures": {
26+
"1": {
27+
"name": "string.quoted.double"
28+
},
29+
"4": {
30+
"name": "storage.modifier"
31+
}
32+
}
33+
},
34+
{
35+
"comment": "Lark *case-insensitive) regular expression",
36+
"match": "(/([^/\\\\]|\\\\.)*/)(i)?",
37+
"captures": {
38+
"1": {
39+
"name": "string.regexp"
40+
},
41+
"3": {
42+
"name": "storage.modifier"
43+
}
44+
}
45+
},
46+
{
47+
"comment": "Lark rule definition",
48+
"match": "([a-z0-9_]+)",
49+
"captures": {
50+
"1": {
51+
"name": "support.variable"
52+
}
53+
}
54+
},
55+
{
56+
"comment": "Lark terminal definition",
57+
"match": "([A-Z0-9_]+)",
58+
"captures": {
59+
"1": {
60+
"name": "support.type"
61+
}
62+
}
63+
},
64+
{
65+
"comment": "Lark optional alias",
66+
"match": "->",
67+
"name": "storage.modifier"
68+
},
69+
{
70+
"comment": "Lark quantifier",
71+
"match": "[\\?\\*\\+]",
72+
"name": "storage.modifier"
73+
},
74+
{
75+
"comment": "Lark or operator",
76+
"match": "\\|",
77+
"name": "keyword.operator"
78+
}
79+
],
80+
"scopeName": "source.lark"
81+
}

0 commit comments

Comments
 (0)