@willbooster/tree-sitter-java 9.0.0 → 9.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/grammar.js CHANGED
@@ -14,6 +14,7 @@ const DIGITS = token(choice('0', seq(/[1-9]/, optional(seq(optional(/_+/), DECIM
14
14
  const HEX_DIGITS = token(sep1(/[A-Fa-f0-9]+/, /_+/));
15
15
 
16
16
  const PREC = {
17
+ LAMBDA: -1,
17
18
  // https://introcs.cs.princeton.edu/java/11precedence/
18
19
  COMMENT: 0,
19
20
  ASSIGN: 1,
@@ -82,7 +83,6 @@ module.exports = grammar({
82
83
  [$._unannotated_type, $.generic_type],
83
84
  [$.generic_type, $.primary_expression],
84
85
  [$.expression, $.statement],
85
- [$.lambda_expression, $.primary_expression],
86
86
  [$.inferred_parameters, $.primary_expression],
87
87
  [$.argument_list, $.record_pattern_body],
88
88
  [$.yield_statement, $._reserved_identifier],
@@ -272,7 +272,7 @@ module.exports = grammar({
272
272
  '"""',
273
273
  repeat(choice(
274
274
  alias($._multiline_string_fragment, $.multiline_string_fragment),
275
- $._escape_sequence,
275
+ $.escape_sequence,
276
276
  $.string_interpolation,
277
277
  )),
278
278
  '"""',
@@ -280,7 +280,7 @@ module.exports = grammar({
280
280
  string_fragment: _ => token.immediate(prec(1, /[^"\\]+/)),
281
281
  _multiline_string_fragment: _ => choice(
282
282
  /[^"\\]+/,
283
- /"([^"\\]|\\")*/,
283
+ /"[^"\\]*/,
284
284
  ),
285
285
 
286
286
  string_interpolation: $ => seq(
@@ -289,10 +289,6 @@ module.exports = grammar({
289
289
  '}',
290
290
  ),
291
291
 
292
- _escape_sequence: $ => choice(
293
- prec(2, token.immediate(seq('\\', /[^bfnrts'\"\\]/))),
294
- prec(1, $.escape_sequence),
295
- ),
296
292
  escape_sequence: _ => token.immediate(choice(
297
293
  seq(/\\u+005[cC]/, choice(
298
294
  /(?:[0-3]|\\u+003[0-3])(?:[0-7]|\\u+003[0-7]){0,2}/,
@@ -302,6 +298,7 @@ module.exports = grammar({
302
298
  seq(
303
299
  choice('\\', /\\u+005[cC]/),
304
300
  choice(
301
+ '\r\n',
305
302
  /[^xu0-7]/,
306
303
  /(?:[0-3][0-7]{0,2}|[4-7][0-7]?)/,
307
304
  /x[0-9a-fA-F]{2}/,
@@ -404,13 +401,13 @@ module.exports = grammar({
404
401
  ),
405
402
  )),
406
403
 
407
- lambda_expression: $ => seq(
404
+ lambda_expression: $ => prec(PREC.LAMBDA, seq(
408
405
  field('parameters', choice(
409
406
  $.identifier, $.formal_parameters, $.inferred_parameters, $._reserved_identifier, $.underscore_pattern,
410
407
  )),
411
408
  '->',
412
409
  field('body', choice($.expression, $.block)),
413
- ),
410
+ )),
414
411
 
415
412
  inferred_parameters: $ => seq(
416
413
  '(',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-java",
3
- "version": "9.0.0",
3
+ "version": "9.0.2",
4
4
  "description": "Java grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
Binary file
package/tree-sitter.json CHANGED
@@ -14,7 +14,7 @@
14
14
  }
15
15
  ],
16
16
  "metadata": {
17
- "version": "9.0.0",
17
+ "version": "9.0.2",
18
18
  "license": "MIT",
19
19
  "description": "Java grammar for tree-sitter",
20
20
  "authors": [