tree-sitter-muttrc 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CMakeLists.txt +13 -8
- package/Cargo.toml +1 -1
- package/{bindings/python/tree_sitter_muttrc/__init__.py → __init__.py.in} +3 -12
- package/grammar.js +9 -13
- package/package.json +1 -1
- package/pyproject.toml +2 -3
- package/src/grammar.json +143 -55
- package/src/node-types.json +1 -1
- package/src/parser.c +5891 -5514
- package/tests/neomuttrc +1 -3
package/CMakeLists.txt
CHANGED
|
@@ -5,27 +5,32 @@ if(NOT VERSION)
|
|
|
5
5
|
endif()
|
|
6
6
|
if(ENV{GITHUB_REPOSITORY})
|
|
7
7
|
set(HOMEPAGE_URL "https://github.com/$ENV{GITHUB_REPOSITORY}")
|
|
8
|
-
string(REGEX REPLACE ".*/tree-sitter-([^/]*)$" "\\1"
|
|
8
|
+
string(REGEX REPLACE ".*/tree-sitter-([^/]*)$" "\\1" NAME $ENV{GITHUB_REPOSITORY})
|
|
9
9
|
else()
|
|
10
10
|
set(HOMEPAGE_URL "")
|
|
11
|
-
file(GLOB
|
|
12
|
-
string(REGEX REPLACE ".*/tree_sitter_([^/]*)$" "\\1"
|
|
11
|
+
file(GLOB NAME "${CMAKE_CURRENT_SOURCE_DIR}/bindings/python/*")
|
|
12
|
+
string(REGEX REPLACE ".*/tree_sitter_([^/]*)$" "\\1" NAME ${NAME})
|
|
13
13
|
endif()
|
|
14
14
|
project(
|
|
15
|
-
tree-sitter-${
|
|
15
|
+
tree-sitter-${NAME}
|
|
16
16
|
VERSION ${VERSION}
|
|
17
|
-
DESCRIPTION tree-sitter-${
|
|
17
|
+
DESCRIPTION tree-sitter-${NAME}
|
|
18
18
|
HOMEPAGE_URL "${HOMEPAGE_URL}")
|
|
19
19
|
include_directories(src)
|
|
20
|
-
add_library(${
|
|
21
|
-
set_target_properties(${
|
|
20
|
+
add_library(${NAME} SHARED src/parser.c)
|
|
21
|
+
set_target_properties(${NAME} PROPERTIES PREFIX "")
|
|
22
22
|
if(DEFINED SKBUILD_DATA_DIR)
|
|
23
23
|
set(CMAKE_INSTALL_FULL_LIBDIR ${SKBUILD_DATA_DIR}/lib)
|
|
24
24
|
endif()
|
|
25
|
+
# https://docs.python.org/3/library/ctypes.html#finding-shared-libraries
|
|
26
|
+
if(DEFINED SKBUILD_PLATLIB_DIR)
|
|
27
|
+
# it may be better to determine the shared library name at development time, and hardcode that into the wrapper module
|
|
28
|
+
configure_file(__init__.py.in ${SKBUILD_PLATLIB_DIR}/tree_sitter_${NAME}/__init__.py)
|
|
29
|
+
endif()
|
|
25
30
|
if(NOT DEFINED CMAKE_INSTALL_FULL_LIBDIR)
|
|
26
31
|
include(GNUInstallDirs)
|
|
27
32
|
endif()
|
|
28
|
-
install(TARGETS ${
|
|
33
|
+
install(TARGETS ${NAME} DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/parser)
|
|
29
34
|
|
|
30
35
|
set(CPACK_PACKAGE_CONTACT ${HOMEPAGE_URL}/issues)
|
|
31
36
|
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Wu Zhenyu <wuzhenyu@ustc.edu>")
|
package/Cargo.toml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "tree-sitter-muttrc"
|
|
3
3
|
description = "muttrc grammar for the tree-sitter parsing library"
|
|
4
|
-
version = "0.0.
|
|
4
|
+
version = "0.0.3"
|
|
5
5
|
keywords = ["incremental", "parsing", "muttrc"]
|
|
6
6
|
categories = ["parsing", "text-editors"]
|
|
7
7
|
repository = "https://github.com/Freed-Wu/tree-sitter-muttrc"
|
|
@@ -7,18 +7,9 @@ import sysconfig
|
|
|
7
7
|
|
|
8
8
|
from tree_sitter import Language, Parser
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
DLL = sysconfig.get_config_var("SHLIB_SUFFIX")
|
|
14
|
-
if DLL is None:
|
|
15
|
-
DLL = ".dll"
|
|
16
|
-
|
|
17
|
-
try:
|
|
18
|
-
from ._version import __version__, __version_tuple__ # type: ignore
|
|
19
|
-
except ImportError: # for setuptools-generate
|
|
20
|
-
__version__ = "rolling"
|
|
21
|
-
__version_tuple__ = (0, 0, 0, __version__, "")
|
|
10
|
+
__version__ = "@VERSION@"
|
|
11
|
+
NAME = "@NAME@"
|
|
12
|
+
DLL = "@CMAKE_SHARED_LIBRARY_SUFFIX@"
|
|
22
13
|
|
|
23
14
|
paths = [
|
|
24
15
|
os.path.join(
|
package/grammar.js
CHANGED
|
@@ -427,19 +427,15 @@ module.exports = grammar({
|
|
|
427
427
|
),
|
|
428
428
|
unhook_directive: ($) => command($, "unhook", choice("*", $.hook_type)),
|
|
429
429
|
|
|
430
|
-
set_directive: ($) =>
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
optional(" "),
|
|
440
|
-
choice($.int, $.quadoption, $._string)
|
|
441
|
-
),
|
|
442
|
-
$._options2
|
|
430
|
+
set_directive: ($) => command($, "set", choice($._options2, $._options3)),
|
|
431
|
+
_options3: ($) =>
|
|
432
|
+
spaceSep1(
|
|
433
|
+
seq(
|
|
434
|
+
$.option,
|
|
435
|
+
optional(" "),
|
|
436
|
+
choice("+=", "-=", "="),
|
|
437
|
+
optional(" "),
|
|
438
|
+
choice($.int, $.quadoption, $._string)
|
|
443
439
|
)
|
|
444
440
|
),
|
|
445
441
|
_options2: ($) => spaceSep1(seq(optional(choice("&", "?")), $.option)),
|
package/package.json
CHANGED
package/pyproject.toml
CHANGED
|
@@ -58,7 +58,7 @@ experimental = true
|
|
|
58
58
|
provider = "scikit_build_core.metadata.setuptools_scm"
|
|
59
59
|
|
|
60
60
|
[tool.scikit-build.sdist]
|
|
61
|
-
include = ["
|
|
61
|
+
include = ["py.typed"]
|
|
62
62
|
|
|
63
63
|
[tool.scikit-build.wheel]
|
|
64
64
|
packages = ["bindings/python/tree_sitter_muttrc"]
|
|
@@ -72,7 +72,6 @@ file = "requirements/dev.txt"
|
|
|
72
72
|
# end: scripts/update-pyproject.toml.pl
|
|
73
73
|
|
|
74
74
|
[tool.setuptools_scm]
|
|
75
|
-
write_to = "bindings/python/tree_sitter_muttrc/_version.py"
|
|
76
75
|
|
|
77
76
|
[tool.mdformat]
|
|
78
77
|
number = true
|
|
@@ -119,6 +118,6 @@ exclude_lines = [
|
|
|
119
118
|
archs = ["all"]
|
|
120
119
|
skip = "*37-* *38-* *39-*"
|
|
121
120
|
# https://github.com/pypa/cibuildwheel/issues/287#issuecomment-1937451870
|
|
122
|
-
test-skip = "*-win32
|
|
121
|
+
test-skip = "*-win32"
|
|
123
122
|
before-test = "pip install -rrequirements.txt -rrequirements/dev.txt"
|
|
124
123
|
test-command = "pytest {project}"
|
package/src/grammar.json
CHANGED
|
@@ -3193,77 +3193,165 @@
|
|
|
3193
3193
|
"type": "CHOICE",
|
|
3194
3194
|
"members": [
|
|
3195
3195
|
{
|
|
3196
|
-
"type": "
|
|
3196
|
+
"type": "SYMBOL",
|
|
3197
|
+
"name": "_options2"
|
|
3198
|
+
},
|
|
3199
|
+
{
|
|
3200
|
+
"type": "SYMBOL",
|
|
3201
|
+
"name": "_options3"
|
|
3202
|
+
}
|
|
3203
|
+
]
|
|
3204
|
+
}
|
|
3205
|
+
]
|
|
3206
|
+
},
|
|
3207
|
+
"_options3": {
|
|
3208
|
+
"type": "SEQ",
|
|
3209
|
+
"members": [
|
|
3210
|
+
{
|
|
3211
|
+
"type": "SEQ",
|
|
3212
|
+
"members": [
|
|
3213
|
+
{
|
|
3214
|
+
"type": "SYMBOL",
|
|
3215
|
+
"name": "option"
|
|
3216
|
+
},
|
|
3217
|
+
{
|
|
3218
|
+
"type": "CHOICE",
|
|
3197
3219
|
"members": [
|
|
3198
3220
|
{
|
|
3199
|
-
"type": "
|
|
3200
|
-
"
|
|
3221
|
+
"type": "STRING",
|
|
3222
|
+
"value": " "
|
|
3201
3223
|
},
|
|
3202
3224
|
{
|
|
3203
|
-
"type": "
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3225
|
+
"type": "BLANK"
|
|
3226
|
+
}
|
|
3227
|
+
]
|
|
3228
|
+
},
|
|
3229
|
+
{
|
|
3230
|
+
"type": "CHOICE",
|
|
3231
|
+
"members": [
|
|
3232
|
+
{
|
|
3233
|
+
"type": "STRING",
|
|
3234
|
+
"value": "+="
|
|
3213
3235
|
},
|
|
3214
3236
|
{
|
|
3215
|
-
"type": "
|
|
3216
|
-
"
|
|
3217
|
-
{
|
|
3218
|
-
"type": "STRING",
|
|
3219
|
-
"value": "+="
|
|
3220
|
-
},
|
|
3221
|
-
{
|
|
3222
|
-
"type": "STRING",
|
|
3223
|
-
"value": "-="
|
|
3224
|
-
},
|
|
3225
|
-
{
|
|
3226
|
-
"type": "STRING",
|
|
3227
|
-
"value": "="
|
|
3228
|
-
}
|
|
3229
|
-
]
|
|
3237
|
+
"type": "STRING",
|
|
3238
|
+
"value": "-="
|
|
3230
3239
|
},
|
|
3231
3240
|
{
|
|
3232
|
-
"type": "
|
|
3233
|
-
"
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3241
|
+
"type": "STRING",
|
|
3242
|
+
"value": "="
|
|
3243
|
+
}
|
|
3244
|
+
]
|
|
3245
|
+
},
|
|
3246
|
+
{
|
|
3247
|
+
"type": "CHOICE",
|
|
3248
|
+
"members": [
|
|
3249
|
+
{
|
|
3250
|
+
"type": "STRING",
|
|
3251
|
+
"value": " "
|
|
3242
3252
|
},
|
|
3243
3253
|
{
|
|
3244
|
-
"type": "
|
|
3245
|
-
"members": [
|
|
3246
|
-
{
|
|
3247
|
-
"type": "SYMBOL",
|
|
3248
|
-
"name": "int"
|
|
3249
|
-
},
|
|
3250
|
-
{
|
|
3251
|
-
"type": "SYMBOL",
|
|
3252
|
-
"name": "quadoption"
|
|
3253
|
-
},
|
|
3254
|
-
{
|
|
3255
|
-
"type": "SYMBOL",
|
|
3256
|
-
"name": "_string"
|
|
3257
|
-
}
|
|
3258
|
-
]
|
|
3254
|
+
"type": "BLANK"
|
|
3259
3255
|
}
|
|
3260
3256
|
]
|
|
3261
3257
|
},
|
|
3262
3258
|
{
|
|
3263
|
-
"type": "
|
|
3264
|
-
"
|
|
3259
|
+
"type": "CHOICE",
|
|
3260
|
+
"members": [
|
|
3261
|
+
{
|
|
3262
|
+
"type": "SYMBOL",
|
|
3263
|
+
"name": "int"
|
|
3264
|
+
},
|
|
3265
|
+
{
|
|
3266
|
+
"type": "SYMBOL",
|
|
3267
|
+
"name": "quadoption"
|
|
3268
|
+
},
|
|
3269
|
+
{
|
|
3270
|
+
"type": "SYMBOL",
|
|
3271
|
+
"name": "_string"
|
|
3272
|
+
}
|
|
3273
|
+
]
|
|
3265
3274
|
}
|
|
3266
3275
|
]
|
|
3276
|
+
},
|
|
3277
|
+
{
|
|
3278
|
+
"type": "REPEAT",
|
|
3279
|
+
"content": {
|
|
3280
|
+
"type": "SEQ",
|
|
3281
|
+
"members": [
|
|
3282
|
+
{
|
|
3283
|
+
"type": "STRING",
|
|
3284
|
+
"value": " "
|
|
3285
|
+
},
|
|
3286
|
+
{
|
|
3287
|
+
"type": "SEQ",
|
|
3288
|
+
"members": [
|
|
3289
|
+
{
|
|
3290
|
+
"type": "SYMBOL",
|
|
3291
|
+
"name": "option"
|
|
3292
|
+
},
|
|
3293
|
+
{
|
|
3294
|
+
"type": "CHOICE",
|
|
3295
|
+
"members": [
|
|
3296
|
+
{
|
|
3297
|
+
"type": "STRING",
|
|
3298
|
+
"value": " "
|
|
3299
|
+
},
|
|
3300
|
+
{
|
|
3301
|
+
"type": "BLANK"
|
|
3302
|
+
}
|
|
3303
|
+
]
|
|
3304
|
+
},
|
|
3305
|
+
{
|
|
3306
|
+
"type": "CHOICE",
|
|
3307
|
+
"members": [
|
|
3308
|
+
{
|
|
3309
|
+
"type": "STRING",
|
|
3310
|
+
"value": "+="
|
|
3311
|
+
},
|
|
3312
|
+
{
|
|
3313
|
+
"type": "STRING",
|
|
3314
|
+
"value": "-="
|
|
3315
|
+
},
|
|
3316
|
+
{
|
|
3317
|
+
"type": "STRING",
|
|
3318
|
+
"value": "="
|
|
3319
|
+
}
|
|
3320
|
+
]
|
|
3321
|
+
},
|
|
3322
|
+
{
|
|
3323
|
+
"type": "CHOICE",
|
|
3324
|
+
"members": [
|
|
3325
|
+
{
|
|
3326
|
+
"type": "STRING",
|
|
3327
|
+
"value": " "
|
|
3328
|
+
},
|
|
3329
|
+
{
|
|
3330
|
+
"type": "BLANK"
|
|
3331
|
+
}
|
|
3332
|
+
]
|
|
3333
|
+
},
|
|
3334
|
+
{
|
|
3335
|
+
"type": "CHOICE",
|
|
3336
|
+
"members": [
|
|
3337
|
+
{
|
|
3338
|
+
"type": "SYMBOL",
|
|
3339
|
+
"name": "int"
|
|
3340
|
+
},
|
|
3341
|
+
{
|
|
3342
|
+
"type": "SYMBOL",
|
|
3343
|
+
"name": "quadoption"
|
|
3344
|
+
},
|
|
3345
|
+
{
|
|
3346
|
+
"type": "SYMBOL",
|
|
3347
|
+
"name": "_string"
|
|
3348
|
+
}
|
|
3349
|
+
]
|
|
3350
|
+
}
|
|
3351
|
+
]
|
|
3352
|
+
}
|
|
3353
|
+
]
|
|
3354
|
+
}
|
|
3267
3355
|
}
|
|
3268
3356
|
]
|
|
3269
3357
|
},
|