Merge commit 'e7cb801ef57f74db5c4ebe14df74de852bb451b5'

pull/261/head
Wilfred Hughes 2022-04-17 16:52:33 +07:00
commit d9b9ec45a8
13 changed files with 25654 additions and 23096 deletions

@ -6,7 +6,7 @@ Added support for Kotlin and TOML.
Fixed an issue with YAML and `|` block strings.
Updated to the latest upstream C++, C#, Elixir, Go and Haskell
Updated to the latest upstream C++, C#, Elixir, Go, Haskell and Java
parsers.
### Diffing

@ -1,8 +1,8 @@
name: Build/test
on:
pull_request:
push:
branches:
- "**"
jobs:
test:
runs-on: ${{ matrix.os }}
@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
node-version: 16
- run: npm install
- run: npm test
test_windows:
@ -23,6 +23,6 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
node-version: 16
- run: npm install
- run: npm run-script test-windows

@ -1,7 +1,7 @@
[package]
name = "tree-sitter-java"
description = "Java grammar for the tree-sitter parsing library"
version = "0.19.0"
version = "0.20.0"
authors = [
"Douglas Creager <dcreager@dcreager.net>",
"Ayman Nadeem <aymannadeem@github.com>",
@ -25,7 +25,7 @@ include = [
path = "bindings/rust/lib.rs"
[dependencies]
tree-sitter = "0.19"
tree-sitter = ">= 0.19, < 0.21"
[build-dependencies]
cc = "1.0"

@ -31,7 +31,8 @@ module.exports = grammar({
name: 'java',
extras: $ => [
$.comment,
$.line_comment,
$.block_comment,
/\s/
],
@ -44,6 +45,8 @@ module.exports = grammar({
$._type,
$._simple_type,
$._unannotated_type,
$.comment,
$.module_directive,
],
inline: $ => [
@ -85,6 +88,7 @@ module.exports = grammar({
$.false,
$.character_literal,
$.string_literal,
$.text_block,
$.null_literal
),
@ -113,9 +117,9 @@ module.exports = grammar({
decimal_floating_point_literal: $ => token(choice(
seq(DIGITS, '.', optional(DIGITS), optional(seq((/[eE]/), optional(choice('-', '+')), DIGITS)), optional(/[fFdD]/)),
seq('.', DIGITS, optional(seq((/[eE]/), optional(choice('-','+')), DIGITS)), optional(/[fFdD]/)),
seq(DIGITS, /[eEpP]/, optional(choice('-','+')), DIGITS, optional(/[fFdD]/)),
seq(DIGITS, optional(seq((/[eE]/), optional(choice('-','+')), DIGITS)), (/[fFdD]/))
seq('.', DIGITS, optional(seq((/[eE]/), optional(choice('-', '+')), DIGITS)), optional(/[fFdD]/)),
seq(DIGITS, /[eEpP]/, optional(choice('-', '+')), DIGITS, optional(/[fFdD]/)),
seq(DIGITS, optional(seq((/[eE]/), optional(choice('-', '+')), DIGITS)), (/[fFdD]/))
)),
hex_floating_point_literal: $ => token(seq(
@ -126,7 +130,7 @@ module.exports = grammar({
),
optional(seq(
/[eEpP]/,
optional(choice('-','+')),
optional(choice('-', '+')),
DIGITS,
optional(/[fFdD]/)
))
@ -152,6 +156,10 @@ module.exports = grammar({
// seq('"', repeat(choice(/[^\\"\n]/, /\\(.|\n)/)), '"', '+', /\n/, '"', repeat(choice(/[^\\"\n]/, /\\(.|\n)/)))
)),
text_block: $ => token(choice(
seq('"""', /\s*\n/, optional(repeat(choice(/[^\\"]/, /\\(.)/))), '"""'),
)),
null_literal: $ => 'null',
// Expressions
@ -166,7 +174,7 @@ module.exports = grammar({
$.primary_expression,
$.unary_expression,
$.cast_expression,
prec(PREC.SWITCH_EXP, $.switch_expression),
prec(PREC.SWITCH_EXP, $.switch_expression),
),
cast_expression: $ => prec(PREC.CAST, seq(
@ -189,32 +197,32 @@ module.exports = grammar({
binary_expression: $ => choice(
...[
['>', PREC.REL],
['<', PREC.REL],
['>=', PREC.REL],
['<=', PREC.REL],
['==', PREC.EQUALITY],
['!=', PREC.EQUALITY],
['&&', PREC.AND],
['||', PREC.OR],
['+', PREC.ADD],
['-', PREC.ADD],
['*', PREC.MULT],
['/', PREC.MULT],
['&', PREC.BIT_AND],
['|', PREC.BIT_OR],
['^', PREC.BIT_XOR],
['%', PREC.MULT],
['<<', PREC.SHIFT],
['>>', PREC.SHIFT],
['>>>', PREC.SHIFT],
].map(([operator, precedence]) =>
prec.left(precedence, seq(
field('left', $.expression),
field('operator', operator),
field('right', $.expression)
))
)),
['>', PREC.REL],
['<', PREC.REL],
['>=', PREC.REL],
['<=', PREC.REL],
['==', PREC.EQUALITY],
['!=', PREC.EQUALITY],
['&&', PREC.AND],
['||', PREC.OR],
['+', PREC.ADD],
['-', PREC.ADD],
['*', PREC.MULT],
['/', PREC.MULT],
['&', PREC.BIT_AND],
['|', PREC.BIT_OR],
['^', PREC.BIT_XOR],
['%', PREC.MULT],
['<<', PREC.SHIFT],
['>>', PREC.SHIFT],
['>>>', PREC.SHIFT],
].map(([operator, precedence]) =>
prec.left(precedence, seq(
field('left', $.expression),
field('operator', operator),
field('right', $.expression)
))
)),
instanceof_expression: $ => prec(PREC.REL, seq(
field('left', $.expression),
@ -386,22 +394,22 @@ module.exports = grammar({
switch_block: $ => seq(
'{',
choice(
repeat($.switch_block_statement_group),
repeat($.switch_block_statement_group),
repeat($.switch_rule)
),
'}'
),
switch_block_statement_group: $ => prec.left (seq(
repeat1(seq($.switch_label, ':')),
repeat($.statement),
switch_block_statement_group: $ => prec.left(seq(
repeat1(seq($.switch_label, ':')),
repeat($.statement),
)),
switch_rule: $ => seq(
$.switch_label,
'->',
choice($.expression_statement, $.throw_statement, $.block)
),
),
switch_label: $ => choice(
seq('case', commaSep1($.expression)),
@ -646,19 +654,63 @@ module.exports = grammar({
'}'
),
module_directive: $ => seq(choice(
seq('requires', repeat($.requires_modifier), $._name),
seq('exports', $._name, optional('to'), optional($._name), repeat(seq(',', $._name))),
seq('opens', $._name, optional('to'), optional($._name), repeat(seq(',', $._name))),
seq('uses', $._name),
seq('provides', $._name, 'with', $._name, repeat(seq(',', $._name)))
), ';'),
module_directive: $ => choice(
$.requires_module_directive,
$.exports_module_directive,
$.opens_module_directive,
$.uses_module_directive,
$.provides_module_directive
),
requires_module_directive: $ => seq(
'requires',
repeat(field('modifiers', $.requires_modifier)),
field('module', $._name),
';'
),
requires_modifier: $ => choice(
'transitive',
'static'
),
exports_module_directive: $ => seq(
'exports',
field('package', $._name),
optional(seq(
'to',
field('modules', $._name),
repeat(seq(',', field('modules', $._name)))
)),
';'
),
opens_module_directive: $ => seq(
'opens',
field('package', $._name),
optional(seq(
'to',
field('modules', $._name),
repeat(seq(',', field('modules', $._name)))
)),
';'
),
uses_module_directive: $ => seq(
'uses',
field('type', $._name),
';'
),
provides_module_directive: $ => seq(
'provides',
field('provided', $._name),
'with',
$._name,
repeat(seq(',', (field('provider', $._name)))),
';'
),
package_declaration: $ => seq(
repeat($._annotation),
'package',
@ -736,7 +788,7 @@ module.exports = grammar({
type_parameter: $ => seq(
repeat($._annotation),
$.identifier,
alias($.identifier, $.type_identifier),
optional($.type_bound)
),
@ -843,7 +895,7 @@ module.exports = grammar({
'record',
field('name', $.identifier),
field('parameters', $.formal_parameters),
field('body', $.class_body)
field('body', $.class_body)
),
annotation_type_declaration: $ => seq(
@ -1081,18 +1133,24 @@ module.exports = grammar({
identifier: $ => /[\p{L}_$][\p{L}\p{Nd}_$]*/,
// http://stackoverflow.com/questions/13014947/regex-to-match-a-c-style-multiline-comment/36328890#36328890
comment: $ => token(prec(PREC.COMMENT, choice(
seq('//', /.*/),
comment: $ => choice(
$.line_comment,
$.block_comment,
),
line_comment: $ => token(prec(PREC.COMMENT, seq('//', /[^\n]*/))),
block_comment: $ => token(prec(PREC.COMMENT,
seq(
'/*',
/[^*]*\*+([^/*][^*]*\*+)*/,
'/'
)
))),
)),
}
});
function sep1 (rule, separator) {
function sep1(rule, separator) {
return seq(rule, repeat(seq(separator, rule)));
}

@ -17,6 +17,8 @@
; Types
(type_identifier) @type
(interface_declaration
name: (identifier) @type)
(class_declaration
@ -30,12 +32,16 @@
((scoped_identifier
scope: (identifier) @type)
(#match? @type "^[A-Z]"))
((method_invocation
object: (identifier) @type)
(#match? @type "^[A-Z]"))
((method_reference
. (identifier) @type)
(#match? @type "^[A-Z]"))
(constructor_declaration
name: (identifier) @type)
(type_identifier) @type
[
(boolean_type)
(integral_type)
@ -74,7 +80,10 @@
(null_literal)
] @constant.builtin
(comment) @comment
[
(line_comment)
(block_comment)
] @comment
; Keywords

@ -52,6 +52,10 @@
"type": "SYMBOL",
"name": "string_literal"
},
{
"type": "SYMBOL",
"name": "text_block"
},
{
"type": "SYMBOL",
"name": "null_literal"
@ -1097,6 +1101,55 @@
]
}
},
"text_block": {
"type": "TOKEN",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "\"\"\""
},
{
"type": "PATTERN",
"value": "\\s*\\n"
},
{
"type": "CHOICE",
"members": [
{
"type": "REPEAT",
"content": {
"type": "CHOICE",
"members": [
{
"type": "PATTERN",
"value": "[^\\\\\"]"
},
{
"type": "PATTERN",
"value": "\\\\(.)"
}
]
}
},
{
"type": "BLANK"
}
]
},
{
"type": "STRING",
"value": "\"\"\""
}
]
}
]
}
},
"null_literal": {
"type": "STRING",
"value": "null"
@ -4393,8 +4446,90 @@
]
},
"module_directive": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "requires_module_directive"
},
{
"type": "SYMBOL",
"name": "exports_module_directive"
},
{
"type": "SYMBOL",
"name": "opens_module_directive"
},
{
"type": "SYMBOL",
"name": "uses_module_directive"
},
{
"type": "SYMBOL",
"name": "provides_module_directive"
}
]
},
"requires_module_directive": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "requires"
},
{
"type": "REPEAT",
"content": {
"type": "FIELD",
"name": "modifiers",
"content": {
"type": "SYMBOL",
"name": "requires_modifier"
}
}
},
{
"type": "FIELD",
"name": "module",
"content": {
"type": "SYMBOL",
"name": "_name"
}
},
{
"type": "STRING",
"value": ";"
}
]
},
"requires_modifier": {
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "transitive"
},
{
"type": "STRING",
"value": "static"
}
]
},
"exports_module_directive": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "exports"
},
{
"type": "FIELD",
"name": "package",
"content": {
"type": "SYMBOL",
"name": "_name"
}
},
{
"type": "CHOICE",
"members": [
@ -4403,56 +4538,16 @@
"members": [
{
"type": "STRING",
"value": "requires"
"value": "to"
},
{
"type": "REPEAT",
"type": "FIELD",
"name": "modules",
"content": {
"type": "SYMBOL",
"name": "requires_modifier"
"name": "_name"
}
},
{
"type": "SYMBOL",
"name": "_name"
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "exports"
},
{
"type": "SYMBOL",
"name": "_name"
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "to"
},
{
"type": "BLANK"
}
]
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_name"
},
{
"type": "BLANK"
}
]
},
{
"type": "REPEAT",
"content": {
@ -4463,98 +4558,61 @@
"value": ","
},
{
"type": "SYMBOL",
"name": "_name"
"type": "FIELD",
"name": "modules",
"content": {
"type": "SYMBOL",
"name": "_name"
}
}
]
}
}
]
},
{
"type": "BLANK"
}
]
},
{
"type": "STRING",
"value": ";"
}
]
},
"opens_module_directive": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "opens"
},
{
"type": "FIELD",
"name": "package",
"content": {
"type": "SYMBOL",
"name": "_name"
}
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "opens"
},
{
"type": "SYMBOL",
"name": "_name"
"value": "to"
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "to"
},
{
"type": "BLANK"
}
]
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_name"
},
{
"type": "BLANK"
}
]
},
{
"type": "REPEAT",
"type": "FIELD",
"name": "modules",
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "SYMBOL",
"name": "_name"
}
]
"type": "SYMBOL",
"name": "_name"
}
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "uses"
},
{
"type": "SYMBOL",
"name": "_name"
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "provides"
},
{
"type": "SYMBOL",
"name": "_name"
},
{
"type": "STRING",
"value": "with"
},
{
"type": "SYMBOL",
"name": "_name"
},
{
"type": "REPEAT",
@ -4566,13 +4624,20 @@
"value": ","
},
{
"type": "SYMBOL",
"name": "_name"
"type": "FIELD",
"name": "modules",
"content": {
"type": "SYMBOL",
"name": "_name"
}
}
]
}
}
]
},
{
"type": "BLANK"
}
]
},
@ -4582,16 +4647,73 @@
}
]
},
"requires_modifier": {
"type": "CHOICE",
"uses_module_directive": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "transitive"
"value": "uses"
},
{
"type": "FIELD",
"name": "type",
"content": {
"type": "SYMBOL",
"name": "_name"
}
},
{
"type": "STRING",
"value": "static"
"value": ";"
}
]
},
"provides_module_directive": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "provides"
},
{
"type": "FIELD",
"name": "provided",
"content": {
"type": "SYMBOL",
"name": "_name"
}
},
{
"type": "STRING",
"value": "with"
},
{
"type": "SYMBOL",
"name": "_name"
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "FIELD",
"name": "provider",
"content": {
"type": "SYMBOL",
"name": "_name"
}
}
]
}
},
{
"type": "STRING",
"value": ";"
}
]
},
@ -5063,8 +5185,13 @@
}
},
{
"type": "SYMBOL",
"name": "identifier"
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "identifier"
},
"named": true,
"value": "type_identifier"
},
{
"type": "CHOICE",
@ -6721,42 +6848,57 @@
"value": "[\\p{L}_$][\\p{L}\\p{Nd}_$]*"
},
"comment": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "line_comment"
},
{
"type": "SYMBOL",
"name": "block_comment"
}
]
},
"line_comment": {
"type": "TOKEN",
"content": {
"type": "PREC",
"value": 0,
"content": {
"type": "CHOICE",
"type": "SEQ",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "//"
},
{
"type": "PATTERN",
"value": ".*"
}
]
"type": "STRING",
"value": "//"
},
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "/*"
},
{
"type": "PATTERN",
"value": "[^*]*\\*+([^/*][^*]*\\*+)*"
},
{
"type": "STRING",
"value": "/"
}
]
"type": "PATTERN",
"value": "[^\\n]*"
}
]
}
}
},
"block_comment": {
"type": "TOKEN",
"content": {
"type": "PREC",
"value": 0,
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "/*"
},
{
"type": "PATTERN",
"value": "[^*]*\\*+([^/*][^*]*\\*+)*"
},
{
"type": "STRING",
"value": "/"
}
]
}
@ -6766,7 +6908,11 @@
"extras": [
{
"type": "SYMBOL",
"name": "comment"
"name": "line_comment"
},
{
"type": "SYMBOL",
"name": "block_comment"
},
{
"type": "PATTERN",
@ -6833,7 +6979,9 @@
"_literal",
"_type",
"_simple_type",
"_unannotated_type"
"_unannotated_type",
"comment",
"module_directive"
]
}

@ -43,6 +43,10 @@
"type": "string_literal",
"named": true
},
{
"type": "text_block",
"named": true
},
{
"type": "true",
"named": true
@ -111,6 +115,20 @@
}
]
},
{
"type": "comment",
"named": true,
"subtypes": [
{
"type": "block_comment",
"named": true
},
{
"type": "line_comment",
"named": true
}
]
},
{
"type": "declaration",
"named": true,
@ -191,6 +209,32 @@
}
]
},
{
"type": "module_directive",
"named": true,
"subtypes": [
{
"type": "exports_module_directive",
"named": true
},
{
"type": "opens_module_directive",
"named": true
},
{
"type": "provides_module_directive",
"named": true
},
{
"type": "requires_module_directive",
"named": true
},
{
"type": "uses_module_directive",
"named": true
}
]
},
{
"type": "primary_expression",
"named": true,
@ -1702,6 +1746,40 @@
}
}
},
{
"type": "exports_module_directive",
"named": true,
"fields": {
"modules": {
"multiple": true,
"required": false,
"types": [
{
"type": "identifier",
"named": true
},
{
"type": "scoped_identifier",
"named": true
}
]
},
"package": {
"multiple": false,
"required": true,
"types": [
{
"type": "identifier",
"named": true
},
{
"type": "scoped_identifier",
"named": true
}
]
}
}
},
{
"type": "expression_statement",
"named": true,
@ -2545,29 +2623,6 @@
]
}
},
{
"type": "module_directive",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "identifier",
"named": true
},
{
"type": "requires_modifier",
"named": true
},
{
"type": "scoped_identifier",
"named": true
}
]
}
},
{
"type": "object_creation_expression",
"named": true,
@ -2618,6 +2673,40 @@
]
}
},
{
"type": "opens_module_directive",
"named": true,
"fields": {
"modules": {
"multiple": true,
"required": false,
"types": [
{
"type": "identifier",
"named": true
},
{
"type": "scoped_identifier",
"named": true
}
]
},
"package": {
"multiple": false,
"required": true,
"types": [
{
"type": "identifier",
"named": true
},
{
"type": "scoped_identifier",
"named": true
}
]
}
}
},
{
"type": "package_declaration",
"named": true,
@ -2675,6 +2764,54 @@
]
}
},
{
"type": "provides_module_directive",
"named": true,
"fields": {
"provided": {
"multiple": false,
"required": true,
"types": [
{
"type": "identifier",
"named": true
},
{
"type": "scoped_identifier",
"named": true
}
]
},
"provider": {
"multiple": true,
"required": false,
"types": [
{
"type": "identifier",
"named": true
},
{
"type": "scoped_identifier",
"named": true
}
]
}
},
"children": {
"multiple": false,
"required": true,
"types": [
{
"type": "identifier",
"named": true
},
{
"type": "scoped_identifier",
"named": true
}
]
}
},
{
"type": "receiver_parameter",
"named": true,
@ -2757,6 +2894,36 @@
"named": true,
"fields": {}
},
{
"type": "requires_module_directive",
"named": true,
"fields": {
"modifiers": {
"multiple": true,
"required": false,
"types": [
{
"type": "requires_modifier",
"named": true
}
]
},
"module": {
"multiple": false,
"required": true,
"types": [
{
"type": "identifier",
"named": true
},
{
"type": "scoped_identifier",
"named": true
}
]
}
}
},
{
"type": "resource",
"named": true,
@ -3295,15 +3462,15 @@
"named": true
},
{
"type": "identifier",
"type": "marker_annotation",
"named": true
},
{
"type": "marker_annotation",
"type": "type_bound",
"named": true
},
{
"type": "type_bound",
"type": "type_identifier",
"named": true
}
]
@ -3377,6 +3544,26 @@
]
}
},
{
"type": "uses_module_directive",
"named": true,
"fields": {
"type": {
"multiple": false,
"required": true,
"types": [
{
"type": "identifier",
"named": true
},
{
"type": "scoped_identifier",
"named": true
}
]
}
}
},
{
"type": "variable_declarator",
"named": true,
@ -3677,6 +3864,10 @@
"type": "binary_integer_literal",
"named": true
},
{
"type": "block_comment",
"named": true
},
{
"type": "boolean_type",
"named": true
@ -3709,10 +3900,6 @@
"type": "class",
"named": false
},
{
"type": "comment",
"named": true
},
{
"type": "continue",
"named": false
@ -3809,6 +3996,10 @@
"type": "interface",
"named": false
},
{
"type": "line_comment",
"named": true
},
{
"type": "long",
"named": false
@ -3901,6 +4092,10 @@
"type": "synchronized",
"named": false
},
{
"type": "text_block",
"named": true
},
{
"type": "this",
"named": true

File diff suppressed because it is too large Load Diff

@ -102,8 +102,8 @@ struct TSLanguage {
const uint16_t *small_parse_table;
const uint32_t *small_parse_table_map;
const TSParseActionEntry *parse_actions;
const char **symbol_names;
const char **field_names;
const char * const *symbol_names;
const char * const *field_names;
const TSFieldMapSlice *field_map_slices;
const TSFieldMapEntry *field_map_entries;
const TSSymbolMetadata *symbol_metadata;

@ -5,10 +5,23 @@ comment
// This is a comment
/* This is also a comment */
/* this comment /* // /** ends here: */
/**/
a /* dkjfhsdf + */ + b; /* ***** */
---
(program (comment) (comment) (comment))
(program
(line_comment)
(block_comment)
(block_comment)
(block_comment)
(expression_statement
(binary_expression
(identifier)
(block_comment)
(identifier)))
(block_comment))
======================
comments and literals
@ -21,4 +34,4 @@ comments and literals
(program
(expression_statement (decimal_integer_literal))
(comment))
(line_comment))

@ -172,8 +172,8 @@ module com.example.foo {
name: (identifier))
name: (identifier))
body: (module_body
(module_directive
(scoped_identifier
(requires_module_directive
module: (scoped_identifier
scope: (scoped_identifier
scope: (scoped_identifier
scope: (identifier)
@ -207,27 +207,27 @@ module com.example.foo {
(module_declaration
(scoped_identifier (scoped_identifier (identifier) (identifier)) (identifier))
(module_body
(module_directive
(requires_module_directive
(scoped_identifier (scoped_identifier (identifier) (identifier)) (identifier)))
(module_directive
(requires_module_directive
(scoped_identifier (identifier) (identifier)))
(module_directive
(requires_module_directive
(requires_modifier)
(scoped_identifier (scoped_identifier (identifier) (identifier)) (identifier)))
(module_directive
(exports_module_directive
(scoped_identifier (scoped_identifier (identifier) (identifier)) (identifier)))
(module_directive
(exports_module_directive
(scoped_identifier (scoped_identifier (identifier) (identifier)) (identifier))
(scoped_identifier (scoped_identifier (identifier) (identifier)) (identifier)))
(module_directive
(opens_module_directive
(scoped_identifier (scoped_identifier (identifier) (identifier)) (identifier)))
(module_directive
(opens_module_directive
(scoped_identifier (scoped_identifier (identifier) (identifier)) (identifier))
(scoped_identifier (scoped_identifier (identifier) (identifier)) (identifier))
(scoped_identifier (scoped_identifier (identifier) (identifier)) (identifier)))
(module_directive
(uses_module_directive
(scoped_identifier (scoped_identifier (identifier) (identifier)) (identifier)))
(module_directive
(provides_module_directive
(scoped_identifier (scoped_identifier (identifier) (identifier)) (identifier))
(scoped_identifier (scoped_identifier (identifier) (identifier)) (identifier))))))
@ -425,7 +425,7 @@ class Beyonce {
(formal_parameter (integral_type) (identifier))
(formal_parameter (floating_point_type) (identifier))
(formal_parameter (floating_point_type) (identifier)))
(block (comment))))))
(block (line_comment))))))
========================
constructor declaration

@ -786,7 +786,7 @@ class Test {
int a = switch (i) {
case 0, 1 -> 6;
case 2 -> 7;
default -> {
default -> {
int result = 8;
yield result;
}
@ -873,7 +873,7 @@ class Test {
type: (integral_type)
name: (identifier)))
body: (block
(comment)
(line_comment)
(local_variable_declaration
type: (integral_type)
declarator: (variable_declarator
@ -895,7 +895,7 @@ class Test {
(switch_label)
(expression_statement
(decimal_integer_literal)))))))))))))
==================================
type arguments
==================================
@ -913,7 +913,7 @@ class Box <T> {
(identifier)
(type_parameters
(type_parameter
(identifier)))
(type_identifier)))
(class_body
(field_declaration
(modifiers)
@ -930,7 +930,7 @@ class Box <T> {
(expression_statement (assignment_expression
(identifier)
(identifier)))))
(comment))))
(line_comment))))
==================================
wildcard
@ -974,7 +974,7 @@ class someClass <T> {
(identifier)
(type_parameters
(type_parameter
(identifier)))
(type_identifier)))
(class_body
(method_declaration
(modifiers)
@ -1000,7 +1000,7 @@ class someClass <T> {
(modifiers)
(type_parameters
(type_parameter
(identifier)))
(type_identifier)))
(void_type)
(identifier)
(formal_parameters

@ -152,6 +152,31 @@ string literals
(expression_statement (string_literal))
(expression_statement (string_literal)))
===============
text block
===============
"""
""";
"""
Closing token
at the same line""";
"""
Spaces after
opening token""";
"""
Closing token
at new line
""";
---
(program
(expression_statement (text_block))
(expression_statement (text_block))
(expression_statement (text_block))
(expression_statement (text_block)))
=============
null literals
=============