Merge commit '494fb7644a9d2bbe4c7a0c5db2ef94d2aad6b0d8'

significant_whitespace
Wilfred Hughes 2023-10-26 08:40:51 +07:00
commit 8400000b3b
15 changed files with 471517 additions and 462563 deletions

@ -4,6 +4,8 @@
Added support for SCSS.
Updated the Kotlin parser.
### Command Line Interface
Added the option `--strip-cr`. This removes all carriage return

@ -10,12 +10,18 @@ on:
jobs:
build:
runs-on: ubuntu-latest
env:
EMSCRIPTEN_VERSION: '2.0.17'
steps:
- uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install Emscripten
uses: mymindstorm/setup-emsdk@v12
with:
version: ${{ env.EMSCRIPTEN_VERSION }}
- name: Install dependencies
run: npm install
- name: Generate parser
@ -27,6 +33,13 @@ jobs:
test -z "$diff"
- name: Run tests
run: npm test
- name: Build WASM binary
run: npm run build-wasm
- name: Upload WASM binary
uses: actions/upload-artifact@v3
with:
name: tree-sitter-kotlin.wasm
path: ./tree-sitter-kotlin.wasm
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:

@ -7,12 +7,18 @@ on:
jobs:
deploy:
runs-on: ubuntu-latest
env:
EMSCRIPTEN_VERSION: '2.0.17'
steps:
- uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install Emscripten
uses: mymindstorm/setup-emsdk@v12
with:
version: ${{ env.EMSCRIPTEN_VERSION }}
- name: Install dependencies
run: npm install
- name: Compile grammar

@ -52,7 +52,7 @@ dependencies = [
[[package]]
name = "tree-sitter-kotlin"
version = "0.2.11"
version = "0.3.2"
dependencies = [
"cc",
"tree-sitter",

@ -1,7 +1,7 @@
[package]
name = "tree-sitter-kotlin"
description = "Kotlin grammar for the tree-sitter parsing library"
version = "0.2.11"
version = "0.3.2"
keywords = ["incremental", "parsing", "kotlin"]
categories = ["parsing", "text-editors"]
repository = "https://github.com/fwcd/tree-sitter-kotlin"

@ -1,4 +1,4 @@
VERSION := 0.2.11
VERSION := 0.3.2
# Repository
SRC_DIR := src

@ -1,6 +1,8 @@
# Kotlin Grammar for Tree-Sitter
[![Build](https://github.com/fwcd/tree-sitter-kotlin/actions/workflows/build.yml/badge.svg)](https://github.com/fwcd/tree-sitter-kotlin/actions/workflows/build.yml)
[![NPM](https://img.shields.io/npm/v/tree-sitter-kotlin)](https://www.npmjs.com/package/tree-sitter-kotlin)
[![crates.io](https://img.shields.io/crates/v/tree-sitter-kotlin)](https://crates.io/crates/tree-sitter-kotlin)
[Kotlin](https://kotlinlang.org) language grammar for [Tree-Sitter](http://tree-sitter.github.io/tree-sitter/). You can try it out directly [on the web](https://fwcd.github.io/tree-sitter-kotlin).

@ -4,7 +4,7 @@ This crate provides a Kotlin grammar for the [tree-sitter](https://tree-sitter.g
```toml
tree-sitter = "0.20"
tree-sitter-kotlin = "0.2.11"
tree-sitter-kotlin = "0.3.2"
```
Typically, you will use the `language` function to add this grammar to a tree-sitter [`Parser`](https://docs.rs/tree-sitter/*/tree_sitter/struct.Parser.html), and then use the parser to parse some code:

@ -60,14 +60,6 @@ module.exports = grammar({
// Ambiguous when used in an explicit delegation expression,
// since the '{' could either be interpreted as the class body
// or as the anonymous function body. Consider the following sequence:
//
// 'class' simple_identifier ':' user_type 'by' 'fun' '(' ')' • '{' …
//
// Possible interpretations:
//
// 'class' simple_identifier ':' user_type 'by' (anonymous_function 'fun' '(' ')' • function_body)
// 'class' simple_identifier ':' user_type 'by' (anonymous_function 'fun' '(' ')') • '{' …
[$.anonymous_function],
// Member access operator '::' conflicts with callable reference
[$._primary_expression, $.callable_reference],
@ -84,7 +76,6 @@ module.exports = grammar({
[$._postfix_unary_expression, $._expression],
// ambiguity between generics and comparison operations (foo < b > c)
[$.call_expression, $.prefix_expression, $.comparison_expression],
[$.call_expression, $.range_expression, $.comparison_expression],
[$.call_expression, $.elvis_expression, $.comparison_expression],
[$.call_expression, $.check_expression, $.comparison_expression],
@ -995,7 +986,8 @@ module.exports = grammar({
"sealed",
"annotation",
"data",
"inner"
"inner",
"value",
),
member_modifier: $ => choice(
@ -1095,6 +1087,7 @@ module.exports = grammar({
"expect",
"data",
"inner",
"value",
"actual",
"set",
"get"

@ -1,12 +1,12 @@
{
"name": "tree-sitter-kotlin",
"version": "0.2.11",
"version": "0.3.2",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "tree-sitter-kotlin",
"version": "0.2.11",
"version": "0.3.2",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {

@ -1,6 +1,6 @@
{
"name": "tree-sitter-kotlin",
"version": "0.2.11",
"version": "0.3.2",
"description": "Tree-Sitter grammar for Kotlin",
"main": "bindings/node",
"scripts": {

@ -5068,6 +5068,10 @@
{
"type": "STRING",
"value": "inner"
},
{
"type": "STRING",
"value": "value"
}
]
},
@ -5378,6 +5382,10 @@
"type": "STRING",
"value": "inner"
},
{
"type": "STRING",
"value": "value"
},
{
"type": "STRING",
"value": "actual"
@ -6089,9 +6097,6 @@
}
],
"conflicts": [
[
"anonymous_function"
],
[
"_primary_expression",
"callable_reference"
@ -6112,11 +6117,6 @@
"_postfix_unary_expression",
"_expression"
],
[
"call_expression",
"prefix_expression",
"comparison_expression"
],
[
"call_expression",
"range_expression",

@ -9519,6 +9519,10 @@
"type": "val",
"named": false
},
{
"type": "value",
"named": false
},
{
"type": "var",
"named": false

File diff suppressed because it is too large Load Diff

@ -358,3 +358,28 @@ data class JwtConfiguration(
(simple_identifier)
(user_type
(type_identifier))))))
================================================================================
Value class: https://kotlinlang.org/docs/inline-classes.html
================================================================================
@JvmInline
value class Password(private val s: String)
--------------------------------------------------------------------------------
(source_file
(class_declaration
(modifiers
(annotation
(user_type
(type_identifier)))
(class_modifier))
(type_identifier)
(primary_constructor
(class_parameter
(modifiers
(visibility_modifier))
(simple_identifier)
(user_type
(type_identifier))))))