Comments (2)
I found the cause of the problem. tree-sitter-kotlin regards return/break/continue as expressions instead of statement.
{
jump_expression: $ => choice(
prec.left(PREC.RETURN_OR_THROW, seq("throw", $._expression)),
prec.left(PREC.RETURN_OR_THROW, seq(choice("return", $._return_at), optional($._expression))),
"continue",
$._continue_at,
"break",
$._break_at
),
}
It hit the definition of infix expression.
{
infix_expression: $ => prec.left(PREC.INFIX, seq($._expression, $.simple_identifier, $._expression)),
}
I think "return/break/continue/throw" should be converted to statement.
A distinction is often made between statements, which are executed, and expressions, which are evaluated. Expressions always evaluate to a value, which statements do not. However, expressions are often used as part of a larger statement. - copy from wikipedia
from tree-sitter-kotlin.
This has been fixed.
(source_file [0, 0] - [4, 0]
(function_declaration [0, 0] - [3, 1]
(simple_identifier [0, 4] - [0, 8])
(function_value_parameters [0, 8] - [0, 16]
(parameter [0, 9] - [0, 15]
(simple_identifier [0, 9] - [0, 10])
(user_type [0, 12] - [0, 15]
(type_identifier [0, 12] - [0, 15]))))
(function_body [0, 17] - [3, 1]
(statements [1, 4] - [2, 17]
(property_declaration [1, 4] - [1, 23]
(variable_declaration [1, 8] - [1, 14]
(simple_identifier [1, 8] - [1, 14]))
(additive_expression [1, 17] - [1, 23]
(simple_identifier [1, 17] - [1, 18])
(integer_literal [1, 21] - [1, 23])))
(jump_expression [2, 4] - [2, 17]
(additive_expression [2, 11] - [2, 17]
(simple_identifier [2, 11] - [2, 12])
(integer_literal [2, 15] - [2, 17])))))))
from tree-sitter-kotlin.
Related Issues (20)
- Style the web playground to look prettier
- Automate updating the playground's bundled tree-sitter version HOT 1
- Value classes are not supported
- New parser for kotlin leads to performance degradation HOT 5
- Returning "!" with a variable that starts with "is" is parsed incorrectly
- Can we get a new release for crates.io? HOT 3
- Automate updating the Pages deployment again HOT 1
- New release
- Identify use of `it` in lambdas
- invalid crates.io category
- A PR to add field names to the grammar HOT 2
- newline causes erroneous class parsing
- Request for releasing `tree-sitter-kotlin` 0.2.12
- Functional interface parsing has ERROR HOT 1
- `tree-sitter tags` says "No tags config found" (`tags.scm` missing) HOT 1
- Add notes on contributing, especially w.r.t the parser verification check HOT 2
- [Bug] Incorrectly parsed expression HOT 2
- Is it possible to make a crates.io release out of the current state? HOT 1
- Investigate why the WASM binary no longer works in the playground HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tree-sitter-kotlin.