summaryrefslogtreecommitdiffstats
path: root/.github/release-drafter.yml
AgeCommit message (Expand)Author
2021-01-16fix typoanoy
2021-01-13first improvements for the release-drafterBenjamin Brahmer
2021-01-10Test release drafterBenjamin Brahmer
le diffstat' width='100%'> -rw-r--r--vendored_parsers/tree-sitter-kotlin/.github/labeler.yml11
-rw-r--r--vendored_parsers/tree-sitter-kotlin/.github/workflows/build.yml22
-rw-r--r--vendored_parsers/tree-sitter-kotlin/.github/workflows/deploy-to-crates-io.yml7
-rw-r--r--vendored_parsers/tree-sitter-kotlin/.github/workflows/deploy-to-github.yml7
-rw-r--r--vendored_parsers/tree-sitter-kotlin/.github/workflows/deploy-to-npm.yml7
-rw-r--r--vendored_parsers/tree-sitter-kotlin/.github/workflows/labeler.yml14
-rw-r--r--vendored_parsers/tree-sitter-kotlin/.github/workflows/regenerate-parser.yml27
-rw-r--r--vendored_parsers/tree-sitter-kotlin/.gitignore8
-rw-r--r--vendored_parsers/tree-sitter-kotlin/Cargo.lock26
-rw-r--r--vendored_parsers/tree-sitter-kotlin/Makefile114
-rw-r--r--vendored_parsers/tree-sitter-kotlin/bindings/c/tree-sitter.h.in16
-rw-r--r--vendored_parsers/tree-sitter-kotlin/bindings/c/tree-sitter.pc.in11
-rw-r--r--vendored_parsers/tree-sitter-kotlin/grammar.js89
-rw-r--r--vendored_parsers/tree-sitter-kotlin/package-lock.json28
-rw-r--r--vendored_parsers/tree-sitter-kotlin/package.json12
-rw-r--r--vendored_parsers/tree-sitter-kotlin/queries/highlights.scm380
-rw-r--r--vendored_parsers/tree-sitter-kotlin/src/grammar.json314
-rw-r--r--vendored_parsers/tree-sitter-kotlin/src/node-types.json1195
-rw-r--r--vendored_parsers/tree-sitter-kotlin/src/parser.c1052846
-rw-r--r--vendored_parsers/tree-sitter-kotlin/src/scanner.c336
-rw-r--r--vendored_parsers/tree-sitter-kotlin/src/tree_sitter/parser.h1
-rw-r--r--vendored_parsers/tree-sitter-kotlin/test/corpus/annotations.txt2
-rw-r--r--vendored_parsers/tree-sitter-kotlin/test/corpus/assignment.txt19
-rw-r--r--vendored_parsers/tree-sitter-kotlin/test/corpus/classes.txt247
-rw-r--r--vendored_parsers/tree-sitter-kotlin/test/corpus/comments.txt27
-rw-r--r--vendored_parsers/tree-sitter-kotlin/test/corpus/expressions.txt312
-rw-r--r--vendored_parsers/tree-sitter-kotlin/test/corpus/functions.txt74
-rw-r--r--vendored_parsers/tree-sitter-kotlin/test/corpus/literals.txt117
-rw-r--r--vendored_parsers/tree-sitter-kotlin/test/corpus/newlines.txt197
-rw-r--r--vendored_parsers/tree-sitter-kotlin/test/corpus/soft_keywords.txt2
-rw-r--r--vendored_parsers/tree-sitter-kotlin/test/corpus/source-files.txt34
-rw-r--r--vendored_parsers/tree-sitter-kotlin/test/corpus/statements.txt41
-rw-r--r--vendored_parsers/tree-sitter-kotlin/test/corpus/types.txt276
34 files changed, 553007 insertions, 503814 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9744a3ac4..beacf1277 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,7 +2,7 @@
### Parsing
-Updated Elixir, Erlang, Go and Racket parsers.
+Updated Elixir, Erlang, Go, Kotlin and Racket parsers.
### Display
diff --git a/vendored_parsers/tree-sitter-kotlin/.github/labeler.yml b/vendored_parsers/tree-sitter-kotlin/.github/labeler.yml
new file mode 100644
index 000000000..38c921614
--- /dev/null
+++ b/vendored_parsers/tree-sitter-kotlin/.github/labeler.yml
@@ -0,0 +1,11 @@
+ci-cd:
+- .github/**/*
+
+grammar:
+- grammar.js
+
+bindings:
+- bindings/**/*
+
+examples:
+- examples/**/*
diff --git a/vendored_parsers/tree-sitter-kotlin/.github/workflows/build.yml b/vendored_parsers/tree-sitter-kotlin/.github/workflows/build.yml
index e423481ed..1618c07e6 100644
--- a/vendored_parsers/tree-sitter-kotlin/.github/workflows/build.yml
+++ b/vendored_parsers/tree-sitter-kotlin/.github/workflows/build.yml
@@ -1,20 +1,30 @@
name: Build
-on: [push, pull_request]
+
+on:
+ push:
+ branches:
+ - main
+ pull_request:
+ workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- name: Set up Node
- uses: actions/setup-node@v2
+ uses: actions/setup-node@v3
with:
- node-version: '12'
- cache: 'npm'
+ node-version: '18'
- name: Install dependencies
run: npm install
- - name: Compile grammar
+ - name: Generate parser
run: npm run generate
+ - name: Verify that generated parser matches the repository
+ run: |
+ diff=`git diff HEAD -- src`
+ echo "$diff"
+ test -z "$diff"
- name: Run tests
run: npm test
- name: Set up Rust
diff --git a/vendored_parsers/tree-sitter-kotlin/.github/workflows/deploy-to-crates-io.yml b/vendored_parsers/tree-sitter-kotlin/.github/workflows/deploy-to-crates-io.yml
index 14c24f1c2..be9e72e80 100644
--- a/vendored_parsers/tree-sitter-kotlin/.github/workflows/deploy-to-crates-io.yml
+++ b/vendored_parsers/tree-sitter-kotlin/.github/workflows/deploy-to-crates-io.yml
@@ -8,12 +8,11 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- name: Set up Node
- uses: actions/setup-node@v2
+ uses: actions/setup-node@v3
with:
- node-version: '12'
- cache: 'npm'
+ node-version: '18'
- name: Install dependencies
run: npm install
- name: Compile grammar
diff --git a/vendored_parsers/tree-sitter-kotlin/.github/workflows/deploy-to-github.yml b/vendored_parsers/tree-sitter-kotlin/.github/workflows/deploy-to-github.yml
index 0c6ebb765..44b7ed5e9 100644
--- a/vendored_parsers/tree-sitter-kotlin/.github/workflows/deploy-to-github.yml
+++ b/vendored_parsers/tree-sitter-kotlin/.github/workflows/deploy-to-github.yml
@@ -8,12 +8,11 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- name: Set up Node
- uses: actions/setup-node@v2
+ uses: actions/setup-node@v3
with:
- node-version: '12'
- cache: 'npm'
+ node-version: '18'
- name: Install dependencies
run: npm install
- name: Compile grammar
diff --git a/vendored_parsers/tree-sitter-kotlin/.github/workflows/deploy-to-npm.yml b/vendored_parsers/tree-sitter-kotlin/.github/workflows/deploy-to-npm.yml
index 8fe41cf5d..21f0901d1 100644
--- a/vendored_parsers/tree-sitter-kotlin/.github/workflows/deploy-to-npm.yml
+++ b/vendored_parsers/tree-sitter-kotlin/.github/workflows/deploy-to-npm.yml
@@ -8,13 +8,12 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- name: Set up Node
- uses: actions/setup-node@v2
+ uses: actions/setup-node@v3
with:
- node-version: '12'
+ node-version: '18'
registry-url: 'https://registry.npmjs.org'
- cache: 'npm'
- name: Install dependencies
run: npm install
- name: Compile grammar
diff --git a/vendored_parsers/tree-sitter-kotlin/.github/workflows/labeler.yml b/vendored_parsers/tree-sitter-kotlin/.github/workflows/labeler.yml
new file mode 100644
index 000000000..5a2205614
--- /dev/null
+++ b/vendored_parsers/tree-sitter-kotlin/.github/workflows/labeler.yml
@@ -0,0 +1,14 @@
+name: "Pull Request Labeler"
+
+on:
+- pull_request_target
+
+jobs:
+ triage:
+ permissions:
+ contents: read
+ pull-requests: write
+
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/labeler@v4
diff --git a/vendored_parsers/tree-sitter-kotlin/.github/workflows/regenerate-parser.yml b/vendored_parsers/tree-sitter-kotlin/.github/workflows/regenerate-parser.yml
new file mode 100644
index 000000000..14f3df115
--- /dev/null
+++ b/vendored_parsers/tree-sitter-kotlin/.github/workflows/regenerate-parser.yml
@@ -0,0 +1,27 @@
+name: Regenerate Parser
+
+on:
+ workflow_dispatch:
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ - name: Configure Git user
+ run: |
+ git config --global user.name "github-actions[bot]"
+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
+ - name: Set up Node
+ uses: actions/setup-node@v3
+ with:
+ node-version: '18'
+ - name: Install dependencies
+ run: npm install
+ - name: Generate parser
+ run: npm run generate
+ - name: Commit the updated parser
+ run: |
+ git add src
+ git commit -m "Regenerate the parser ($(git rev-parse --short HEAD))"
+ git push
diff --git a/vendored_parsers/tree-sitter-kotlin/.gitignore b/vendored_parsers/tree-sitter-kotlin/.gitignore
index 3811d1486..92d81b658 100644
--- a/vendored_parsers/tree-sitter-kotlin/.gitignore
+++ b/vendored_parsers/tree-sitter-kotlin/.gitignore
@@ -21,3 +21,11 @@ node_modules
# Rust build artifacts
target
+
+# C
+/*.a
+/*.dylib
+/*.so*
+*.o
+/bindings/c/*.h
+/bindings/c/tree-sitter-*.pc
diff --git a/vendored_parsers/tree-sitter-kotlin/Cargo.lock b/vendored_parsers/tree-sitter-kotlin/Cargo.lock
index 41027b11b..90a37b642 100644
--- a/vendored_parsers/tree-sitter-kotlin/Cargo.lock
+++ b/vendored_parsers/tree-sitter-kotlin/Cargo.lock
@@ -1,31 +1,33 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
+version = 3
+
[[package]]
name = "aho-corasick"
-version = "0.7.18"
+version = "0.7.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
+checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
dependencies = [
"memchr",
]
[[package]]
name = "cc"
-version = "1.0.68"
+version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4a72c244c1ff497a746a7e1fb3d14bd08420ecda70c8f25c7112f2781652d787"
+checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
[[package]]
name = "memchr"
-version = "2.4.0"
+version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc"
+checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
name = "regex"
-version = "1.5.4"
+version = "1.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
+checksum = "cce168fea28d3e05f158bda4576cf0c844d5045bc2cc3620fa0292ed5bb5814c"
dependencies = [
"aho-corasick",
"memchr",
@@ -34,15 +36,15 @@ dependencies = [
[[package]]
name = "regex-syntax"
-version = "0.6.25"
+version = "0.6.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
+checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
[[package]]
name = "tree-sitter"
-version = "0.20.0"
+version = "0.20.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "63ec02a07a782abef91279b72fe8fd2bee4c168a22112cedec5d3b0d49b9e4f9"
+checksum = "d4423c784fe11398ca91e505cdc71356b07b1a924fc8735cfab5333afe3e18bc"
dependencies = [
"cc",
"regex",
diff --git a/vendored_parsers/tree-sitter-kotlin/Makefile b/vendored_parsers/tree-sitter-kotlin/Makefile
new file mode 100644
index 000000000..e3c2ef1b6
--- /dev/null
+++ b/vendored_parsers/tree-sitter-kotlin/Makefile
@@ -0,0 +1,114 @@
+VERSION := 0.2.11
+
+# Repository
+SRC_DIR := src
+
+PARSER_REPO_URL := $(shell git -C $(SRC_DIR) remote get-url origin )
+
+ifeq (, $(PARSER_NAME))
+ PARSER_NAME := $(shell basename $(PARSER_REPO_URL))
+ PARSER_NAME := $(subst tree-sitter-,,$(PARSER_NAME))
+ PARSER_NAME := $(subst .git,,$(PARSER_NAME))
+endif
+
+ifeq (, $(PARSER_URL))
+ PARSER_URL := $(subst :,/,$(PARSER_REPO_URL))
+ PARSER_URL := $(subst git@,https://,$(PARSER_URL))
+ PARSER_URL := $(subst .git,,$(PARSER_URL))
+endif
+
+UPPER_PARSER_NAME := $(shell echo $(PARSER_NAME) | tr a-z A-Z )
+
+# install directory layout
+PREFIX ?= /usr/local
+INCLUDEDIR ?= $(PREFIX)/include
+LIBDIR ?= $(PREFIX)/lib
+PCLIBDIR ?= $(LIBDIR)/pkgconfig
+
+# collect C++ sources, and link if necessary
+CPPSRC := $(wildcard $(SRC_DIR)/*.cc)
+
+ifeq (, $(CPPSRC))
+ ADDITIONALLIBS :=
+else
+ ADDITIONALLIBS := -lc++
+endif
+
+# collect sources
+SRC := $(wildcard $(SRC_DIR)/*.c)
+SRC += $(CPPSRC)
+OBJ := $(addsuffix .o,$(basename $(SRC)))
+
+# ABI versioning
+SONAME_MAJOR := 0
+SONAME_MINOR := 0
+
+CFLAGS ?= -O3 -Wall -Wextra -I$(SRC_DIR)
+CXXFLAGS ?= -O3 -Wall -Wextra -I$(SRC_DIR)
+override CFLAGS += -std=gnu99 -fPIC
+override CXXFLAGS += -fPIC
+
+# OS-specific bits
+ifeq ($(shell uname),Darwin)
+ SOEXT = dylib
+ SOEXTVER_MAJOR = $(SONAME_MAJOR).dylib
+ SOEXTVER = $(SONAME_MAJOR).$(SONAME_MINOR).dylib
+ LINKSHARED := $(LINKSHARED)-dynamiclib -Wl,
+ ifneq ($(ADDITIONALLIBS),)
+ LINKSHARED := $(LINKSHARED)$(ADDITIONALLIBS),
+ endif
+ LINKSHARED := $(LINKSHARED)-install_name,$(LIBDIR)/libtree-sitter-$(PARSER_NAME).$(SONAME_MAJOR).dylib,-rpath,@executable_path/../Frameworks
+else
+ SOEXT = so
+ SOEXTVER_MAJOR = so.$(SONAME_MAJOR)
+ SOEXTVER = so.$(SONAME_MAJOR).$(SONAME_MINOR)
+ LINKSHARED := $(LINKSHARED)-shared -Wl,
+ ifneq ($(ADDITIONALLIBS),)
+ LINKSHARED := $(LINKSHARED)$(ADDITIONALLIBS),
+ endif
+ LINKSHARED := $(LINKSHARED)-soname,libtree-sitter-$(PARSER_NAME).so.$(SONAME_MAJOR)
+endif
+ifneq (,$(filter $(shell uname),FreeBSD NetBSD DragonFly))
+ PCLIBDIR := $(PREFIX)/libdata/pkgconfig
+endif
+
+all: libtree-sitter-$(PARSER_NAME).a libtree-sitter-$(PARSER_NAME).$(SOEXTVER) bindings/c/$(PARSER_NAME).h bindings/c/tree-sitter-$(PARSER_NAME).pc
+
+libtree-sitter-$(PARSER_NAME).a: $(OBJ)
+ $(AR) rcs $@ $^
+
+libtree-sitter-$(PARSER_NAME).$(SOEXTVER): $(OBJ)
+ $(CC) $(LDFLAGS) $(LINKSHARED) $^ $(LDLIBS) -o $@
+ ln -sf $@ libtree-sitter-$(PARSER_NAME).$(SOEXT)
+ ln -sf $@ libtree-sitter-$(PARSER_NAME).$(SOEXTVER_MAJOR)
+
+bindings/c/$(PARSER_NAME).h:
+ sed -e 's|@UPPER_PARSERNAME@|$(UPPER_PARSER_NAME)|' \
+ -e 's|@PARSERNAME@|$(PARSER_NAME)|' \
+ bindings/c/tree-sitter.h.in > $@
+
+bindings/c/tree-sitter-$(PARSER_NAME).pc:
+ sed -e 's|@LIBDIR@|$(LIBDIR)|;s|@INCLUDEDIR@|$(INCLUDEDIR)|;s|@VERSION@|$(VERSION)|' \
+ -e 's|=$(PREFIX)|=$${prefix}|' \
+ -e 's|@PREFIX@|$(PREFIX)|' \
+ -e 's|@ADDITIONALLIBS@|$(ADDITIONALLIBS)|' \
+ -e 's|@PARSERNAME@|$(PARSER_NAME)|' \
+ -e 's|@PARSERURL@|$(PARSER_URL)|' \
+ bindings/c/tree-sitter.pc.in > $@
+
+install: all
+ install -d '$(DESTDIR)$(LIBDIR)'
+ install -m755 libtree-sitter-$(PARSER_NAME).a '$(DESTDIR)$(LIBDIR)'/libtree-sitter-$(PARSER_NAME).a
+ install -m755 libtree-sitter-$(PARSER_NAME).$(SOEXTVER) '$(DESTDIR)$(LIBDIR)'/libtree-sitter-$(PARSER_NAME).$(SOEXTVER)
+ ln -sf libtree-sitter-$(PARSER_NAME).$(SOEXTVER) '$(DESTDIR)$(LIBDIR)'/libtree-sitter-$(PARSER_NAME).$(SOEXTVER_MAJOR)
+ ln -sf libtree-sitter-$(PARSER_NAME).$(SOEXTVER) '$(DESTDIR)$(LIBDIR)'/libtree-sitter-$(PARSER_NAME).$(SOEXT)
+ install -d '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter
+ install -m644 bindings/c/$(PARSER_NAME).h '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter/
+ install -d '$(DESTDIR)$(PCLIBDIR)'
+ install -m644 bindings/c/tree-sitter-$(PARSER_NAME).pc '$(DESTDIR)$(PCLIBDIR)'/
+
+clean:
+ rm -f $(OBJ) libtree-sitter-$(PARSER_NAME).a libtree-sitter-$(PARSER_NAME).$(SOEXT) libtree-sitter-$(PARSER_NAME).$(SOEXTVER_MAJOR) libtree-sitter-$(PARSER_NAME).$(SOEXTVER)
+ rm -f bindings/c/$(PARSER_NAME).h bindings/c/tree-sitter-$(PARSER_NAME).pc
+
+.PHONY: all install clean
diff --git a/vendored_parsers/tree-sitter-kotlin/bindings/c/tree-sitter.h.in b/vendored_parsers/tree-sitter-kotlin/bindings/c/tree-sitter.h.in
new file mode 100644
index 000000000..e19269f46
--- /dev/null
+++ b/vendored_parsers/tree-sitter-kotlin/bindings/c/tree-sitter.h.in
@@ -0,0 +1,16 @@
+#ifndef TREE_SITTER_@UPPER_PARSERNAME@_H_
+#define TREE_SITTER_@UPPER_PARSERNAME@_H_
+
+#include <tree_sitter/parser.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern TSLanguage *tree_sitter_@PARSERNAME@();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // TREE_SITTER_@UPPER_PARSERNAME@_H_
diff --git a/vendored_parsers/tree-sitter-kotlin/bindings/c/tree-sitter.pc.in b/vendored_parsers/tree-sitter-kotlin/bindings/c/tree-sitter.pc.in
new file mode 100644
index 000000000..80d60b6db
--- /dev/null
+++ b/vendored_parsers/tree-sitter-kotlin/bindings/c/tree-sitter.pc.in
@@ -0,0 +1,11 @@
+prefix=@PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+additionallibs=@ADDITIONALLIBS@
+
+Name: tree-sitter-@PARSERNAME@
+Description: A tree-sitter grammar for the @PARSERNAME@ programming language.
+URL: @PARSERURL@
+Version: @VERSION@
+Libs: -L${libdir} ${additionallibs} -ltree-sitter-@PARSERNAME@
+Cflags: -I${includedir}
diff --git a/vendored_parsers/tree-sitter-kotlin/grammar.js b/vendored_parsers/tree-sitter-kotlin/grammar.js
index 237784d8f..cd56a3c1c 100644
--- a/vendored_parsers/tree-sitter-kotlin/grammar.js
+++ b/vendored_parsers/tree-sitter-kotlin/grammar.js
@@ -39,9 +39,9 @@ const PREC = {
EQUALITY: 5,
CONJUNCTION: 4,
DISJUNCTION: 3,
+ VAR_DECL: 3,
SPREAD: 2,
SIMPLE_USER_TYPE: 2,
- VAR_DECL: 1,
ASSIGNMENT: 1,
BLOCK: 1,
LAMBDA_LITERAL: 0,
@@ -113,16 +113,26 @@ module.exports = grammar({
// ambiguity between parameter modifiers in anonymous functions
[$.parameter_modifiers, $._type_modifier],
+
+ // ambiguity between type modifiers before an @
+ [$.type_modifiers],
+ // ambiguity between associating type modifiers
+ [$.not_nullable_type],
],
externals: $ => [
$._automatic_semicolon,
$._import_list_delimiter,
$.safe_nav,
+ $.multiline_comment,
+ $._string_start,
+ $._string_end,
+ $._string_content,
],
extras: $ => [
- $.comment,
+ $.line_comment,
+ $.multiline_comment,
/\s+/ // Whitespace
],
@@ -179,6 +189,7 @@ module.exports = grammar({
optional($.modifiers),
"typealias",
alias($.simple_identifier, $.type_identifier),
+ optional($.type_parameters),
"=",
$._type
),
@@ -317,7 +328,7 @@ module.exports = grammar({
optional($.class_body)
),
- _function_value_parameters: $ => seq(
+ function_value_parameters: $ => seq(
"(",
optional(sep1($._function_value_parameter, ",")),
optional(","),
@@ -345,7 +356,7 @@ module.exports = grammar({
optional($.type_parameters),
optional(seq($._receiver_type, optional('.'))),
$.simple_identifier,
- $._function_value_parameters,
+ $.function_value_parameters,
optional(seq(":", $._type)),
optional($.type_constraints),
optional($.function_body)
@@ -423,7 +434,7 @@ module.exports = grammar({
secondary_constructor: $ => seq(
optional($.modifiers),
"constructor",
- $._function_value_parameters,
+ $.function_value_parameters,
optional(seq(":", $.constructor_delegation_call)),
optional($._block)
),
@@ -460,13 +471,22 @@ module.exports = grammar({
$.parenthesized_type,
$.nullable_type,
$._type_reference,
- $.function_type
+ $.function_type,
+ $.not_nullable_type
)
),
- _type_reference: $ => choice(
+ _type_reference: $ => prec.left(1, choice(
$.user_type,
"dynamic"
+ )),
+
+ not_nullable_type: $ => seq(
+ optional($.type_modifiers),
+ choice($.user_type, $.parenthesized_user_type),
+ '&',
+ optional($.type_modifiers),
+ choice($.user_type, $.parenthesized_user_type),
),
nullable_type: $ => seq(
@@ -698,7 +718,16 @@ module.exports = grammar({
type_arguments: $ => seq("<", sep1($.type_projection, ","), ">"),
- value_arguments: $ => seq("(", optional(sep1($.value_argument, ",")), ")"),
+ value_arguments: $ => seq(
+ "(",
+ optional(
+ seq(
+ sep1($.value_argument, ","),
+ optional(","),
+ )
+ ),
+ ")"
+ ),
value_argument: $ => seq(
optional($.annotation),
@@ -711,7 +740,7 @@ module.exports = grammar({
$.parenthesized_expression,
$.simple_identifier,
$._literal_constant,
- $._string_literal,
+ $.string_literal,
$.callable_reference,
$._function_literal,
$.object_literal,
@@ -740,31 +769,14 @@ module.exports = grammar({
$.unsigned_literal
),
- _string_literal: $ => choice(
- $.line_string_literal,
- $.multi_line_string_literal
- ),
-
- line_string_literal: $ => seq('"', repeat(choice($._line_string_content, $._interpolation)), '"'),
-
- multi_line_string_literal: $ => seq(
- '"""',
- repeat(choice(
- $._multi_line_string_content,
- $._interpolation
- )),
- '"""'
- ),
-
- _line_string_content: $ => choice(
- $._line_str_text,
- $.character_escape_seq
+ string_literal: $ => seq(
+ $._string_start,
+ repeat(choice($._string_content, $._interpolation)),
+ $._string_end,
),
line_string_expression: $ => seq("${", $._expression, "}"),
- _multi_line_string_content: $ => choice($._multi_line_str_text, '"'),
-
_interpolation: $ => choice(
seq("${", alias($._expression, $.interpolated_expression), "}"),
seq("$", alias($.simple_identifier, $.interpolated_identifier))
@@ -793,7 +805,7 @@ module.exports = grammar({
anonymous_function: $ => prec.right(seq(
"fun",
optional(seq(sep1($._simple_user_type, "."), ".")), // TODO
- $._function_value_parameters,
+ $.function_value_parameters,
optional(seq(":", $._type)),
optional($.function_body)
)),
@@ -1100,11 +1112,7 @@ module.exports = grammar({
// General
// ==========
- // Source: https://github.com/tree-sitter/tree-sitter-java/blob/bc7124d924723e933b6ffeb5f22c4cf5248416b7/grammar.js#L1030
- comment: $ => token(prec(PREC.COMMENT, choice(
- seq("//", /.*/),
- seq("/*", /[^*]*\*+([^/*][^*]*\*+)*/, "/")
- ))),
+ line_comment: $ => token(seq('//', /.*/)),
// ==========
// Separators and operations
@@ -1179,7 +1187,7 @@ module.exports = grammar({
$._backtick_identifier,
),
- _alpha_identifier: $ => /[a-zA-Z_][a-zA-Z_0-9]*/,
+ _alpha_identifier: $ => /[\p{L}_][\p{L}_\p{Nd}]*/,
_backtick_identifier: $ => /`[^\r\n`]+`/,
@@ -1190,13 +1198,6 @@ module.exports = grammar({
_escaped_identifier: $ => /\\[tbrn'"\\$]/,
- // ==========
- // Strings
- // ==========
-
- _line_str_text: $ => /[^\\"$]+/,
-
- _multi_line_str_text: $ => /[^"$]+/
}
});
diff --git a/vendored_parsers/tree-sitter-kotlin/package-lock.json b/vendored_parsers/tree-sitter-kotlin/package-lock.json
index ca0d1e60f..a8f86b55b 100644
--- a/vendored_parsers/tree-sitter-kotlin/package-lock.json
+++ b/vendored_parsers/tree-sitter-kotlin/package-lock.json
@@ -10,21 +10,21 @@
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
- "nan": "^2.15.0"
+ "nan": "^2.17.0"
},
"devDependencies": {
- "tree-sitter-cli": "^0.20.0"
+ "tree-sitter-cli": "^0.20.8"
}
},
"node_modules/nan": {
- "version": "2.15.0",
- "resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz",
- "integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ=="
+ "version": "2.17.0",
+ "resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz",
+ "integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ=="
},
"node_modules/tree-sitter-cli": {
- "version": "0.20.0",
- "resolved": "https://registry.npmjs.org/tree-sitter-cli/-/tree-sitter-cli-0.20.0.tgz",
- "integrity": "sha512-4D1qapWbJXZ5rrSUGM5rcw5Vuq/smzn9KbiFRhlON6KeuuXjra+KAtDYVrDgAoLIG4ku+jbEEGrJxCptUGi3dg==",
+ "version": "0.20.8",
+ "resolved": "https://registry.npmjs.org/tree-sitter-cli/-/tree-sitter-cli-0.20.8.tgz",
+ "integrity": "sha512-XjTcS3wdTy/2cc/ptMLc/WRyOLECRYcMTrSWyhZnj1oGSOWbHLTklgsgRICU3cPfb0vy+oZCC33M43u6R1HSCA==",
"dev": true,
"hasInstallScript": true,
"bin": {
@@ -34,14 +34,14 @@
},
"dependencies": {
"nan": {
- "version": "2.15.0",
- "resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz",
- "integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ=="
+ "version": "2.17.0",
+ "resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz",
+ "integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ=="
},
"tree-sitter-cli": {
- "version": "0.20.0",
- "resolved": "https://registry.npmjs.org/tree-sitter-cli/-/tree-sitter-cli-0.20.0.tgz",
- "integrity": "sha512-4D1qapWbJXZ5rrSUGM5rcw5Vuq/smzn9KbiFRhlON6KeuuXjra+KAtDYVrDgAoLIG4ku+jbEEGrJxCptUGi3dg==",
+ "version": "0.20.8",
+ "resolved": "https://registry.npmjs.org/tree-sitter-cli/-/tree-sitter-cli-0.20.8.tgz",
+ "integrity": "sha512-XjTcS3wdTy/2cc/ptMLc/WRyOLECRYcMTrSWyhZnj1oGSOWbHLTklgsgRICU3cPfb0