Skip to content

Commit

Permalink
Merge pull request #80 from alaviss/for-0.5.0
Browse files Browse the repository at this point in the history
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
  • Loading branch information
alaviss authored Dec 30, 2023
2 parents 482e2f4 + 901306b commit 70ceee8
Show file tree
Hide file tree
Showing 16 changed files with 1,387,954 additions and 1,464,301 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"ecmaVersion": "latest"
},
"rules": {
"no-undef": "off"
"no-undef": "off",
"no-useless-escape": "off"
}
}
5 changes: 5 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2023 leorize <leorize+oss@disroot.org>
#
# SPDX-License-Identifier: CC0-1.0

github: alaviss
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- run: npm run build

- name: Upload built parser to artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: parser
path: src/parser.c
Expand All @@ -33,7 +33,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Download generated parser
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: parser
path: src/
Expand All @@ -57,7 +57,7 @@ jobs:
node-version: "16"
cache: "npm"
- name: Download generated parser
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: parser
path: src/
Expand All @@ -79,7 +79,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Download generated parser
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: parser
path: src/
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[package]
name = "tree-sitter-nim"
description = "nim grammar for the tree-sitter parsing library"
version = "0.4.0"
version = "0.5.0"
keywords = ["incremental", "parsing", "nim"]
categories = ["parsing", "text-editors"]
repository = "https://github.com/tree-sitter/tree-sitter-nim"
Expand Down
8 changes: 7 additions & 1 deletion corpus/declarations.txt
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,8 @@ type

g.outgoingEdges(v) is Enumerable[EdgeType]

Empty = concept

--------------------------------------------------------------------------------

(source_file
Expand Down Expand Up @@ -884,7 +886,11 @@ type
right: (bracket_expression
left: (identifier)
right: (argument_list
(identifier)))))))))
(identifier)))))))
(type_declaration
(type_symbol_declaration
name: (identifier))
(concept_declaration))))

================================================================================
Routine declarations
Expand Down
50 changes: 44 additions & 6 deletions corpus/errors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,39 @@ type

--------------------------------------------------------------------------------

(ERROR
(type_declaration
(type_symbol_declaration
(identifier))
(object_declaration
(field_declaration_list
(ERROR
(variant_discriminator_declaration
(symbol_declaration_list
(symbol_declaration
(identifier))))
(identifier))))))

================================================================================
Error incomplete field within object variant
================================================================================

type
A = object

B = object
case x: int
of y:
k:

--------------------------------------------------------------------------------

(source_file
(type_section
(type_declaration
(type_symbol_declaration
(identifier))
(object_declaration))
(type_declaration
(type_symbol_declaration
(identifier))
Expand All @@ -20,9 +51,17 @@ type
(variant_discriminator_declaration
(symbol_declaration_list
(symbol_declaration
(identifier)))))
(ERROR
(identifier)))))))
(identifier)))
(type_expression
(identifier)))
(of_branch
(expression_list
(identifier))
(field_declaration_list
(ERROR
(symbol_declaration_list
(symbol_declaration
(identifier))))))))))))

================================================================================
Error within statements with body
Expand Down Expand Up @@ -124,10 +163,9 @@ let

(source_file
(let_section
(variable_declaration
(ERROR
(symbol_declaration_list
(symbol_declaration
(identifier)))
(type_expression
(identifier)))
(ERROR)))
(identifier)))))
79 changes: 79 additions & 0 deletions corpus/expressions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1777,3 +1777,82 @@ foobar""""extra spicy""""
(generalized_string
function: (identifier)
(string_content)))

================================================================================
Old typeof expressions
================================================================================

proc foo(x: type y)
var x: type y
(type y)

type(x)
type (y)

type(x) is Y
type(x) + y * z
type(x) * y - y
type(x) + y + z

--------------------------------------------------------------------------------

(source_file
(proc_declaration
name: (identifier)
parameters: (parameter_declaration_list
(parameter_declaration
(symbol_declaration_list
(symbol_declaration
name: (identifier)))
type: (type_expression
(call
function: (identifier)
(argument_list
(identifier)))))))
(var_section
(variable_declaration
(symbol_declaration_list
(symbol_declaration
name: (identifier)))
type: (type_expression
(call
function: (identifier)
(argument_list
(identifier))))))
(parenthesized
(call
function: (identifier)
(argument_list
(identifier))))
(typeof
(identifier))
(typeof
(identifier))
(infix_expression
left: (typeof
(identifier))
right: (identifier))
(infix_expression
left: (typeof
(identifier))
operator: (operator)
right: (infix_expression
left: (identifier)
operator: (operator)
right: (identifier)))
(infix_expression
left: (infix_expression
left: (typeof
(identifier))
operator: (operator)
right: (identifier))
operator: (operator)
right: (identifier))
(infix_expression
left: (infix_expression
left: (typeof
(identifier))
operator: (operator)
right: (identifier))
operator: (operator)
right: (identifier)))
Loading

0 comments on commit 70ceee8

Please sign in to comment.