tree-sitter-pgn 1.0.14__tar.gz → 1.1.0__tar.gz
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.
Potentially problematic release.
This version of tree-sitter-pgn might be problematic. Click here for more details.
- {tree_sitter_pgn-1.0.14 → tree_sitter_pgn-1.1.0}/PKG-INFO +10 -7
- {tree_sitter_pgn-1.0.14 → tree_sitter_pgn-1.1.0}/README.md +9 -6
- {tree_sitter_pgn-1.0.14 → tree_sitter_pgn-1.1.0}/bindings/python/tree_sitter_pgn.egg-info/PKG-INFO +10 -7
- {tree_sitter_pgn-1.0.14 → tree_sitter_pgn-1.1.0}/pyproject.toml +1 -1
- {tree_sitter_pgn-1.0.14 → tree_sitter_pgn-1.1.0}/setup.py +1 -1
- tree_sitter_pgn-1.1.0/src/parser.c +28056 -0
- tree_sitter_pgn-1.0.14/src/parser.c +0 -22583
- {tree_sitter_pgn-1.0.14 → tree_sitter_pgn-1.1.0}/LICENSE +0 -0
- {tree_sitter_pgn-1.0.14 → tree_sitter_pgn-1.1.0}/bindings/python/tree_sitter_pgn/__init__.py +0 -0
- {tree_sitter_pgn-1.0.14 → tree_sitter_pgn-1.1.0}/bindings/python/tree_sitter_pgn/__init__.pyi +0 -0
- {tree_sitter_pgn-1.0.14 → tree_sitter_pgn-1.1.0}/bindings/python/tree_sitter_pgn/binding.c +0 -0
- {tree_sitter_pgn-1.0.14 → tree_sitter_pgn-1.1.0}/bindings/python/tree_sitter_pgn/py.typed +0 -0
- {tree_sitter_pgn-1.0.14 → tree_sitter_pgn-1.1.0}/bindings/python/tree_sitter_pgn.egg-info/SOURCES.txt +0 -0
- {tree_sitter_pgn-1.0.14 → tree_sitter_pgn-1.1.0}/bindings/python/tree_sitter_pgn.egg-info/dependency_links.txt +0 -0
- {tree_sitter_pgn-1.0.14 → tree_sitter_pgn-1.1.0}/bindings/python/tree_sitter_pgn.egg-info/not-zip-safe +0 -0
- {tree_sitter_pgn-1.0.14 → tree_sitter_pgn-1.1.0}/bindings/python/tree_sitter_pgn.egg-info/requires.txt +0 -0
- {tree_sitter_pgn-1.0.14 → tree_sitter_pgn-1.1.0}/bindings/python/tree_sitter_pgn.egg-info/top_level.txt +0 -0
- {tree_sitter_pgn-1.0.14 → tree_sitter_pgn-1.1.0}/setup.cfg +0 -0
- {tree_sitter_pgn-1.0.14 → tree_sitter_pgn-1.1.0}/src/scanner.c +0 -0
- {tree_sitter_pgn-1.0.14 → tree_sitter_pgn-1.1.0}/src/tree_sitter/alloc.h +0 -0
- {tree_sitter_pgn-1.0.14 → tree_sitter_pgn-1.1.0}/src/tree_sitter/array.h +0 -0
- {tree_sitter_pgn-1.0.14 → tree_sitter_pgn-1.1.0}/src/tree_sitter/parser.h +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: tree-sitter-pgn
|
|
3
|
-
Version: 1.0
|
|
3
|
+
Version: 1.1.0
|
|
4
4
|
Summary: PGN grammar for tree-sitter
|
|
5
5
|
License: BSD
|
|
6
6
|
Project-URL: Homepage, https://github.com/rolandwalker/tree-sitter-pgn
|
|
@@ -49,27 +49,30 @@ query = PGN_LANGUAGE.query(
|
|
|
49
49
|
|
|
50
50
|
(movetext
|
|
51
51
|
san_move: (san_move) @san_move)
|
|
52
|
+
|
|
53
|
+
(movetext
|
|
54
|
+
lan_move: (lan_move) @lan_move)
|
|
52
55
|
''')
|
|
53
56
|
|
|
54
57
|
with open('input_file.pgn', 'rb') as file:
|
|
55
|
-
|
|
56
|
-
tree = parser.parse(content)
|
|
58
|
+
tree = parser.parse(file.read())
|
|
57
59
|
|
|
58
60
|
matches = query.captures(tree.root_node)
|
|
59
61
|
|
|
60
62
|
merged_nodes = [
|
|
61
63
|
*matches.get('game', []),
|
|
62
64
|
*matches.get('san_move', []),
|
|
65
|
+
*matches.get('lan_move', []),
|
|
63
66
|
]
|
|
64
67
|
merged_nodes = sorted(merged_nodes, key=lambda elt: elt.start_byte)
|
|
65
68
|
|
|
66
69
|
for game in more_itertools.split_before(merged_nodes, lambda node: node.type == 'game'):
|
|
67
|
-
|
|
70
|
+
main_line = []
|
|
68
71
|
for node in game:
|
|
69
|
-
if node.type
|
|
70
|
-
|
|
72
|
+
if node.type in ['san_move', 'lan_move'] and node.text is not None:
|
|
73
|
+
main_line.append(node.text.decode().strip())
|
|
71
74
|
continue
|
|
72
|
-
print(' '.join(
|
|
75
|
+
print(' '.join(main_line))
|
|
73
76
|
```
|
|
74
77
|
|
|
75
78
|
## References
|
|
@@ -31,27 +31,30 @@ query = PGN_LANGUAGE.query(
|
|
|
31
31
|
|
|
32
32
|
(movetext
|
|
33
33
|
san_move: (san_move) @san_move)
|
|
34
|
+
|
|
35
|
+
(movetext
|
|
36
|
+
lan_move: (lan_move) @lan_move)
|
|
34
37
|
''')
|
|
35
38
|
|
|
36
39
|
with open('input_file.pgn', 'rb') as file:
|
|
37
|
-
|
|
38
|
-
tree = parser.parse(content)
|
|
40
|
+
tree = parser.parse(file.read())
|
|
39
41
|
|
|
40
42
|
matches = query.captures(tree.root_node)
|
|
41
43
|
|
|
42
44
|
merged_nodes = [
|
|
43
45
|
*matches.get('game', []),
|
|
44
46
|
*matches.get('san_move', []),
|
|
47
|
+
*matches.get('lan_move', []),
|
|
45
48
|
]
|
|
46
49
|
merged_nodes = sorted(merged_nodes, key=lambda elt: elt.start_byte)
|
|
47
50
|
|
|
48
51
|
for game in more_itertools.split_before(merged_nodes, lambda node: node.type == 'game'):
|
|
49
|
-
|
|
52
|
+
main_line = []
|
|
50
53
|
for node in game:
|
|
51
|
-
if node.type
|
|
52
|
-
|
|
54
|
+
if node.type in ['san_move', 'lan_move'] and node.text is not None:
|
|
55
|
+
main_line.append(node.text.decode().strip())
|
|
53
56
|
continue
|
|
54
|
-
print(' '.join(
|
|
57
|
+
print(' '.join(main_line))
|
|
55
58
|
```
|
|
56
59
|
|
|
57
60
|
## References
|
{tree_sitter_pgn-1.0.14 → tree_sitter_pgn-1.1.0}/bindings/python/tree_sitter_pgn.egg-info/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: tree-sitter-pgn
|
|
3
|
-
Version: 1.0
|
|
3
|
+
Version: 1.1.0
|
|
4
4
|
Summary: PGN grammar for tree-sitter
|
|
5
5
|
License: BSD
|
|
6
6
|
Project-URL: Homepage, https://github.com/rolandwalker/tree-sitter-pgn
|
|
@@ -49,27 +49,30 @@ query = PGN_LANGUAGE.query(
|
|
|
49
49
|
|
|
50
50
|
(movetext
|
|
51
51
|
san_move: (san_move) @san_move)
|
|
52
|
+
|
|
53
|
+
(movetext
|
|
54
|
+
lan_move: (lan_move) @lan_move)
|
|
52
55
|
''')
|
|
53
56
|
|
|
54
57
|
with open('input_file.pgn', 'rb') as file:
|
|
55
|
-
|
|
56
|
-
tree = parser.parse(content)
|
|
58
|
+
tree = parser.parse(file.read())
|
|
57
59
|
|
|
58
60
|
matches = query.captures(tree.root_node)
|
|
59
61
|
|
|
60
62
|
merged_nodes = [
|
|
61
63
|
*matches.get('game', []),
|
|
62
64
|
*matches.get('san_move', []),
|
|
65
|
+
*matches.get('lan_move', []),
|
|
63
66
|
]
|
|
64
67
|
merged_nodes = sorted(merged_nodes, key=lambda elt: elt.start_byte)
|
|
65
68
|
|
|
66
69
|
for game in more_itertools.split_before(merged_nodes, lambda node: node.type == 'game'):
|
|
67
|
-
|
|
70
|
+
main_line = []
|
|
68
71
|
for node in game:
|
|
69
|
-
if node.type
|
|
70
|
-
|
|
72
|
+
if node.type in ['san_move', 'lan_move'] and node.text is not None:
|
|
73
|
+
main_line.append(node.text.decode().strip())
|
|
71
74
|
continue
|
|
72
|
-
print(' '.join(
|
|
75
|
+
print(' '.join(main_line))
|
|
73
76
|
```
|
|
74
77
|
|
|
75
78
|
## References
|
|
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "tree-sitter-pgn"
|
|
7
7
|
description = "PGN grammar for tree-sitter"
|
|
8
|
-
version = "1.0
|
|
8
|
+
version = "1.1.0"
|
|
9
9
|
keywords = ["incremental", "parsing", "tree-sitter", "PGN", "chess"]
|
|
10
10
|
classifiers = [
|
|
11
11
|
"Intended Audience :: Developers",
|