Skip to content

Commit 70ceee8

Browse files
authored
Merge pull request Wilfred#80 from alaviss/for-0.5.0
changes staged for 0.5.0 Notable changes: - Reduced the amount of states used for tracking layout - Support for concept without a body - Support for type(x) expressions at the top level Shortlog: Leorize (9): remove flag and indentation tracking across scans allow concept body to be omitted grammar: share if alternatives between if and case eslint: disable useless-escape rule grammar: factor out for loop body support old type(x) expression in statement lists update readme for the current project status ci: bump upload/download artifact version bump version to 0.5.0
2 parents 482e2f4 + 901306b commit 70ceee8

File tree

16 files changed

+1387954
-1464301
lines changed

16 files changed

+1387954
-1464301
lines changed

.eslintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"ecmaVersion": "latest"
1111
},
1212
"rules": {
13-
"no-undef": "off"
13+
"no-undef": "off",
14+
"no-useless-escape": "off"
1415
}
1516
}

.github/FUNDING.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright 2023 leorize <[email protected]>
2+
#
3+
# SPDX-License-Identifier: CC0-1.0
4+
5+
github: alaviss

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- run: npm run build
2222

2323
- name: Upload built parser to artifacts
24-
uses: actions/upload-artifact@v3
24+
uses: actions/upload-artifact@v4
2525
with:
2626
name: parser
2727
path: src/parser.c
@@ -33,7 +33,7 @@ jobs:
3333
steps:
3434
- uses: actions/checkout@v4
3535
- name: Download generated parser
36-
uses: actions/download-artifact@v3
36+
uses: actions/download-artifact@v4
3737
with:
3838
name: parser
3939
path: src/
@@ -57,7 +57,7 @@ jobs:
5757
node-version: "16"
5858
cache: "npm"
5959
- name: Download generated parser
60-
uses: actions/download-artifact@v3
60+
uses: actions/download-artifact@v4
6161
with:
6262
name: parser
6363
path: src/
@@ -79,7 +79,7 @@ jobs:
7979
steps:
8080
- uses: actions/checkout@v4
8181
- name: Download generated parser
82-
uses: actions/download-artifact@v3
82+
uses: actions/download-artifact@v4
8383
with:
8484
name: parser
8585
path: src/

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[package]
66
name = "tree-sitter-nim"
77
description = "nim grammar for the tree-sitter parsing library"
8-
version = "0.4.0"
8+
version = "0.5.0"
99
keywords = ["incremental", "parsing", "nim"]
1010
categories = ["parsing", "text-editors"]
1111
repository = "https://github.com/tree-sitter/tree-sitter-nim"

corpus/declarations.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,8 @@ type
758758

759759
g.outgoingEdges(v) is Enumerable[EdgeType]
760760

761+
Empty = concept
762+
761763
--------------------------------------------------------------------------------
762764

763765
(source_file
@@ -884,7 +886,11 @@ type
884886
right: (bracket_expression
885887
left: (identifier)
886888
right: (argument_list
887-
(identifier)))))))))
889+
(identifier)))))))
890+
(type_declaration
891+
(type_symbol_declaration
892+
name: (identifier))
893+
(concept_declaration))))
888894

889895
================================================================================
890896
Routine declarations

corpus/errors.txt

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,39 @@ type
99

1010
--------------------------------------------------------------------------------
1111

12+
(ERROR
13+
(type_declaration
14+
(type_symbol_declaration
15+
(identifier))
16+
(object_declaration
17+
(field_declaration_list
18+
(ERROR
19+
(variant_discriminator_declaration
20+
(symbol_declaration_list
21+
(symbol_declaration
22+
(identifier))))
23+
(identifier))))))
24+
25+
================================================================================
26+
Error incomplete field within object variant
27+
================================================================================
28+
29+
type
30+
A = object
31+
32+
B = object
33+
case x: int
34+
of y:
35+
k:
36+
37+
--------------------------------------------------------------------------------
38+
1239
(source_file
1340
(type_section
41+
(type_declaration
42+
(type_symbol_declaration
43+
(identifier))
44+
(object_declaration))
1445
(type_declaration
1546
(type_symbol_declaration
1647
(identifier))
@@ -20,9 +51,17 @@ type
2051
(variant_discriminator_declaration
2152
(symbol_declaration_list
2253
(symbol_declaration
23-
(identifier)))))
24-
(ERROR
25-
(identifier)))))))
54+
(identifier)))
55+
(type_expression
56+
(identifier)))
57+
(of_branch
58+
(expression_list
59+
(identifier))
60+
(field_declaration_list
61+
(ERROR
62+
(symbol_declaration_list
63+
(symbol_declaration
64+
(identifier))))))))))))
2665

2766
================================================================================
2867
Error within statements with body
@@ -124,10 +163,9 @@ let
124163

125164
(source_file
126165
(let_section
127-
(variable_declaration
166+
(ERROR
128167
(symbol_declaration_list
129168
(symbol_declaration
130169
(identifier)))
131170
(type_expression
132-
(identifier)))
133-
(ERROR)))
171+
(identifier)))))

corpus/expressions.txt

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1777,3 +1777,82 @@ foobar""""extra spicy""""
17771777
(generalized_string
17781778
function: (identifier)
17791779
(string_content)))
1780+
1781+
================================================================================
1782+
Old typeof expressions
1783+
================================================================================
1784+
1785+
proc foo(x: type y)
1786+
var x: type y
1787+
(type y)
1788+
1789+
type(x)
1790+
type (y)
1791+
1792+
type(x) is Y
1793+
type(x) + y * z
1794+
type(x) * y - y
1795+
type(x) + y + z
1796+
1797+
--------------------------------------------------------------------------------
1798+
1799+
(source_file
1800+
(proc_declaration
1801+
name: (identifier)
1802+
parameters: (parameter_declaration_list
1803+
(parameter_declaration
1804+
(symbol_declaration_list
1805+
(symbol_declaration
1806+
name: (identifier)))
1807+
type: (type_expression
1808+
(call
1809+
function: (identifier)
1810+
(argument_list
1811+
(identifier)))))))
1812+
(var_section
1813+
(variable_declaration
1814+
(symbol_declaration_list
1815+
(symbol_declaration
1816+
name: (identifier)))
1817+
type: (type_expression
1818+
(call
1819+
function: (identifier)
1820+
(argument_list
1821+
(identifier))))))
1822+
(parenthesized
1823+
(call
1824+
function: (identifier)
1825+
(argument_list
1826+
(identifier))))
1827+
(typeof
1828+
(identifier))
1829+
(typeof
1830+
(identifier))
1831+
(infix_expression
1832+
left: (typeof
1833+
(identifier))
1834+
right: (identifier))
1835+
(infix_expression
1836+
left: (typeof
1837+
(identifier))
1838+
operator: (operator)
1839+
right: (infix_expression
1840+
left: (identifier)
1841+
operator: (operator)
1842+
right: (identifier)))
1843+
(infix_expression
1844+
left: (infix_expression
1845+
left: (typeof
1846+
(identifier))
1847+
operator: (operator)
1848+
right: (identifier))
1849+
operator: (operator)
1850+
right: (identifier))
1851+
(infix_expression
1852+
left: (infix_expression
1853+
left: (typeof
1854+
(identifier))
1855+
operator: (operator)
1856+
right: (identifier))
1857+
operator: (operator)
1858+
right: (identifier)))

0 commit comments

Comments
 (0)