Bump tree-sitter-mozjs to v0.17 (#535)

* Bump tree-sitter-mozjs to v0.17

* mozjs: Treat elseifs differently
This commit is contained in:
Luni-4 2021-03-10 16:43:13 +01:00 коммит произвёл GitHub
Родитель 5717a23e89
Коммит d190deaaa1
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
11 изменённых файлов: 42017 добавлений и 39584 удалений

2
Cargo.lock сгенерированный
Просмотреть файл

@ -2241,7 +2241,7 @@ dependencies = [
[[package]]
name = "tree-sitter-mozjs"
version = "0.16.0"
version = "0.17.0"
dependencies = [
"cc",
"tree-sitter 0.17.1",

Просмотреть файл

@ -35,7 +35,7 @@ tree-sitter-java = "^0.16"
tree-sitter-preproc = { path = "./tree-sitter-preproc", version = "^0.17" }
tree-sitter-ccomment = { path = "./tree-sitter-ccomment", version = "^0.17" }
tree-sitter-mozcpp = { path = "./tree-sitter-mozcpp", version = "^0.16" }
tree-sitter-mozjs = { path = "./tree-sitter-mozjs", version = "^0.16" }
tree-sitter-mozjs = { path = "./tree-sitter-mozjs", version = "^0.17" }
[dev-dependencies]
pretty_assertions = "^0.7"

2
enums/Cargo.lock сгенерированный
Просмотреть файл

@ -535,7 +535,7 @@ dependencies = [
[[package]]
name = "tree-sitter-mozjs"
version = "0.16.0"
version = "0.17.0"
dependencies = [
"cc",
"tree-sitter 0.17.1",

Просмотреть файл

@ -21,4 +21,4 @@ tree-sitter-java = "^0.16"
tree-sitter-preproc = { path = "../tree-sitter-preproc", version = "^0.17" }
tree-sitter-ccomment = { path = "../tree-sitter-ccomment", version = "^0.17" }
tree-sitter-mozcpp = { path = "../tree-sitter-mozcpp" }
tree-sitter-mozjs = { path = "../tree-sitter-mozjs" }
tree-sitter-mozjs = { path = "../tree-sitter-mozjs", version = "^0.17" }

Просмотреть файл

@ -145,7 +145,16 @@ impl Checker for MozjsCode {
ArrowFunction
);
mk_else_if!(IfStatement);
#[inline(always)]
fn is_else_if(node: &Node) -> bool {
if node.object().kind_id() != <Self as TSLanguage>::BaseLang::IfStatement {
return false;
}
if let Some(parent) = node.object().parent() {
return parent.kind_id() == <Self as TSLanguage>::BaseLang::ElseClause;
}
false
}
mk_checker!(is_non_arg, LPAREN, COMMA, RPAREN);
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,7 +1,7 @@
[package]
name = "tree-sitter-mozjs"
description = "Mozjs grammar for the tree-sitter parsing library"
version = "0.16.0"
version = "0.17.0"
authors = ["Calixte Denizet <cdenizet@mozilla.com>"]
license = "MIT"
readme = "bindings/rust/README.md"

Просмотреть файл

@ -747,6 +747,19 @@
]
}
},
"else_clause": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "else"
},
{
"type": "SYMBOL",
"name": "_statement"
}
]
},
"if_statement": {
"type": "PREC_RIGHT",
"value": 0,
@ -777,21 +790,12 @@
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "else"
},
{
"type": "FIELD",
"name": "alternative",
"content": {
"type": "SYMBOL",
"name": "_statement"
}
}
]
"type": "FIELD",
"name": "alternative",
"content": {
"type": "SYMBOL",
"name": "else_clause"
}
},
{
"type": "BLANK"
@ -1500,7 +1504,7 @@
"members": [
{
"type": "SYMBOL",
"name": "_constructable_expression"
"name": "_primary_expression"
},
{
"type": "SYMBOL",
@ -1540,7 +1544,7 @@
},
{
"type": "SYMBOL",
"name": "call_expression"
"name": "new_expression"
},
{
"type": "SYMBOL",
@ -1548,6 +1552,112 @@
}
]
},
"_primary_expression": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "this"
},
{
"type": "SYMBOL",
"name": "super"
},
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "_reserved_identifier"
},
"named": true,
"value": "identifier"
},
{
"type": "SYMBOL",
"name": "number"
},
{
"type": "SYMBOL",
"name": "string"
},
{
"type": "SYMBOL",
"name": "template_string"
},
{
"type": "SYMBOL",
"name": "regex"
},
{
"type": "SYMBOL",
"name": "true"
},
{
"type": "SYMBOL",
"name": "false"
},
{
"type": "SYMBOL",
"name": "null"
},
{
"type": "SYMBOL",
"name": "undefined"
},
{
"type": "SYMBOL",
"name": "import"
},
{
"type": "SYMBOL",
"name": "object"
},
{
"type": "SYMBOL",
"name": "array"
},
{
"type": "SYMBOL",
"name": "function"
},
{
"type": "SYMBOL",
"name": "arrow_function"
},
{
"type": "SYMBOL",
"name": "generator_function"
},
{
"type": "SYMBOL",
"name": "class"
},
{
"type": "SYMBOL",
"name": "parenthesized_expression"
},
{
"type": "SYMBOL",
"name": "subscript_expression"
},
{
"type": "SYMBOL",
"name": "member_expression"
},
{
"type": "SYMBOL",
"name": "meta_property"
},
{
"type": "SYMBOL",
"name": "call_expression"
}
]
},
"yield_expression": {
"type": "PREC_RIGHT",
"value": 0,
@ -1981,6 +2091,10 @@
"type": "SYMBOL",
"name": "_jsx_element"
},
{
"type": "SYMBOL",
"name": "jsx_fragment"
},
{
"type": "SYMBOL",
"name": "jsx_expression"
@ -2688,51 +2802,72 @@
]
},
"call_expression": {
"type": "PREC",
"value": 12,
"content": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "function",
"content": {
"type": "CHOICE",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "PREC",
"value": 12,
"content": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "function",
"content": {
"type": "SYMBOL",
"name": "_expression"
},
{
"type": "SYMBOL",
"name": "super"
},
{
"type": "SYMBOL",
"name": "function"
}
]
}
},
{
"type": "FIELD",
"name": "arguments",
"content": {
"type": "CHOICE",
"members": [
{
},
{
"type": "FIELD",
"name": "arguments",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "arguments"
},
{
"type": "SYMBOL",
"name": "template_string"
}
]
}
}
]
}
},
{
"type": "PREC",
"value": 14,
"content": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "function",
"content": {
"type": "SYMBOL",
"name": "_primary_expression"
}
},
{
"type": "STRING",
"value": "?."
},
{
"type": "FIELD",
"name": "arguments",
"content": {
"type": "SYMBOL",
"name": "arguments"
},
{
"type": "SYMBOL",
"name": "template_string"
}
]
}
}
]
}
]
}
}
]
},
"new_expression": {
"type": "PREC_RIGHT",
@ -2749,7 +2884,7 @@
"name": "constructor",
"content": {
"type": "SYMBOL",
"name": "_constructable_expression"
"name": "_primary_expression"
}
},
{
@ -2759,8 +2894,12 @@
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "arguments"
"type": "PREC_DYNAMIC",
"value": 1,
"content": {
"type": "SYMBOL",
"name": "arguments"
}
},
{
"type": "BLANK"
@ -2771,108 +2910,6 @@
]
}
},
"_constructable_expression": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "this"
},
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "_reserved_identifier"
},
"named": true,
"value": "identifier"
},
{
"type": "SYMBOL",
"name": "number"
},
{
"type": "SYMBOL",
"name": "string"
},
{
"type": "SYMBOL",
"name": "template_string"
},
{
"type": "SYMBOL",
"name": "regex"
},
{
"type": "SYMBOL",
"name": "true"
},
{
"type": "SYMBOL",
"name": "false"
},
{
"type": "SYMBOL",
"name": "null"
},
{
"type": "SYMBOL",
"name": "undefined"
},
{
"type": "SYMBOL",
"name": "import"
},
{
"type": "SYMBOL",
"name": "object"
},
{
"type": "SYMBOL",
"name": "array"
},
{
"type": "SYMBOL",
"name": "function"
},
{
"type": "SYMBOL",
"name": "arrow_function"
},
{
"type": "SYMBOL",
"name": "generator_function"
},
{
"type": "SYMBOL",
"name": "class"
},
{
"type": "SYMBOL",
"name": "parenthesized_expression"
},
{
"type": "SYMBOL",
"name": "subscript_expression"
},
{
"type": "SYMBOL",
"name": "member_expression"
},
{
"type": "SYMBOL",
"name": "meta_property"
},
{
"type": "SYMBOL",
"name": "new_expression"
}
]
},
"await_expression": {
"type": "SEQ",
"members": [
@ -2904,27 +2941,23 @@
},
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "SYMBOL",
"name": "super"
},
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "_reserved_identifier"
},
"named": true,
"value": "identifier"
"name": "_primary_expression"
}
]
}
},
{
"type": "STRING",
"value": "."
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "."
},
{
"type": "STRING",
"value": "?."
}
]
},
{
"type": "FIELD",
@ -2960,11 +2993,23 @@
},
{
"type": "SYMBOL",
"name": "super"
"name": "_primary_expression"
}
]
}
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "?."
},
{
"type": "BLANK"
}
]
},
{
"type": "STRING",
"value": "["
@ -3052,6 +3097,36 @@
]
}
},
"_augmented_assignment_lhs": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "member_expression"
},
{
"type": "SYMBOL",
"name": "subscript_expression"
},
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "_reserved_identifier"
},
"named": true,
"value": "identifier"
},
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "SYMBOL",
"name": "parenthesized_expression"
}
]
},
"augmented_assignment_expression": {
"type": "PREC_RIGHT",
"value": 0,
@ -3062,34 +3137,8 @@
"type": "FIELD",
"name": "left",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "member_expression"
},
{
"type": "SYMBOL",
"name": "subscript_expression"
},
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "_reserved_identifier"
},
"named": true,
"value": "identifier"
},
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "SYMBOL",
"name": "parenthesized_expression"
}
]
"type": "SYMBOL",
"name": "_augmented_assignment_lhs"
}
},
{
@ -3142,6 +3191,18 @@
{
"type": "STRING",
"value": "**="
},
{
"type": "STRING",
"value": "&&="
},
{
"type": "STRING",
"value": "||="
},
{
"type": "STRING",
"value": "??="
}
]
},
@ -4511,7 +4572,7 @@
},
{
"type": "PATTERN",
"value": "[^*]*\\*+([^\\/*][^*]*\\*+)*"
"value": "[^*]*\\*+([^/*][^*]*\\*+)*"
},
{
"type": "STRING",
@ -4673,7 +4734,7 @@
},
{
"type": "PATTERN",
"value": "[^\\/\\\\\\[\\n]"
"value": "[^/\\\\\\[\\n]"
}
]
}
@ -5182,13 +5243,13 @@
"members": [
{
"type": "PATTERN",
"value": "[^\\x00-\\x1F\\s0-9:;`\"'@#.,|^&<=>+\\-*\\/\\\\%?!~()\\[\\]{}\\uFEFF\\u2060\\u200B\\u00A0]|\\\\u[0-9a-fA-F]{4}|\\\\u\\{[0-9a-fA-F]+\\}"
"value": "[^\\x00-\\x1F\\s0-9:;`\"'@#.,|^&<=>+\\-*/\\\\%?!~()\\[\\]{}\\uFEFF\\u2060\\u200B\\u00A0]|\\\\u[0-9a-fA-F]{4}|\\\\u\\{[0-9a-fA-F]+\\}"
},
{
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\x00-\\x1F\\s:;`\"'@#.,|^&<=>+\\-*\\/\\\\%?!~()\\[\\]{}\\uFEFF\\u2060\\u200B\\u00A0]|\\\\u[0-9a-fA-F]{4}|\\\\u\\{[0-9a-fA-F]+\\}"
"value": "[^\\x00-\\x1F\\s:;`\"'@#.,|^&<=>+\\-*/\\\\%?!~()\\[\\]{}\\uFEFF\\u2060\\u200B\\u00A0]|\\\\u[0-9a-fA-F]{4}|\\\\u\\{[0-9a-fA-F]+\\}"
}
}
]
@ -5331,7 +5392,7 @@
"members": [
{
"type": "SYMBOL",
"name": "_identifier_reference"
"name": "identifier"
},
{
"type": "ALIAS",
@ -5355,24 +5416,6 @@
}
]
},
"_identifier_reference": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "_reserved_identifier"
},
"named": true,
"value": "identifier"
}
]
},
"decorator_member_expression": {
"type": "PREC",
"value": 14,
@ -5387,7 +5430,7 @@
"members": [
{
"type": "SYMBOL",
"name": "_identifier_reference"
"name": "identifier"
},
{
"type": "ALIAS",
@ -5435,7 +5478,7 @@
"members": [
{
"type": "SYMBOL",
"name": "_identifier_reference"
"name": "identifier"
},
{
"type": "ALIAS",
@ -5948,13 +5991,12 @@
],
"inline": [
"_call_signature",
"_constructable_expression",
"_primary_expression",
"_statement",
"_expressions",
"_semicolon",
"_formal_parameter",
"_destructuring_pattern",
"_identifier_reference",
"_reserved_identifier",
"_jsx_attribute",
"_jsx_element_name",

Просмотреть файл

@ -147,6 +147,10 @@
"type": "subscript_expression",
"named": true
},
{
"type": "super",
"named": true
},
{
"type": "template_string",
"named": true
@ -666,10 +670,6 @@
{
"type": "_expression",
"named": true
},
{
"type": "super",
"named": true
}
]
}
@ -917,6 +917,21 @@
}
}
},
{
"type": "else_clause",
"named": true,
"fields": {},
"children": {
"multiple": false,
"required": true,
"types": [
{
"type": "_statement",
"named": true
}
]
}
},
{
"type": "empty_statement",
"named": true,
@ -1356,7 +1371,7 @@
"required": false,
"types": [
{
"type": "_statement",
"type": "else_clause",
"named": true
}
]
@ -1443,7 +1458,7 @@
"fields": {
"source": {
"multiple": false,
"required": false,
"required": true,
"types": [
{
"type": "string",
@ -1563,6 +1578,10 @@
"type": "jsx_expression",
"named": true
},
{
"type": "jsx_fragment",
"named": true
},
{
"type": "jsx_self_closing_element",
"named": true
@ -1613,6 +1632,10 @@
"type": "jsx_expression",
"named": true
},
{
"type": "jsx_fragment",
"named": true
},
{
"type": "jsx_self_closing_element",
"named": true
@ -1767,10 +1790,6 @@
{
"type": "_expression",
"named": true
},
{
"type": "super",
"named": true
}
]
},
@ -1924,6 +1943,10 @@
"type": "arrow_function",
"named": true
},
{
"type": "call_expression",
"named": true
},
{
"type": "class",
"named": true
@ -1956,10 +1979,6 @@
"type": "meta_property",
"named": true
},
{
"type": "new_expression",
"named": true
},
{
"type": "null",
"named": true
@ -1988,6 +2007,10 @@
"type": "subscript_expression",
"named": true
},
{
"type": "super",
"named": true
},
{
"type": "template_string",
"named": true
@ -2348,10 +2371,6 @@
{
"type": "_expression",
"named": true
},
{
"type": "super",
"named": true
}
]
}
@ -2804,6 +2823,10 @@
"type": "&&",
"named": false
},
{
"type": "&&=",
"named": false
},
{
"type": "&=",
"named": false
@ -2948,10 +2971,18 @@
"type": "?",
"named": false
},
{
"type": "?.",
"named": false
},
{
"type": "??",
"named": false
},
{
"type": "??=",
"named": false
},
{
"type": "@",
"named": false
@ -3004,6 +3035,10 @@
"type": "class",
"named": false
},
{
"type": "comment",
"named": true
},
{
"type": "const",
"named": false
@ -3224,6 +3259,10 @@
"type": "||",
"named": false
},
{
"type": "||=",
"named": false
},
{
"type": "}",
"named": false

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -35,6 +35,7 @@ typedef uint16_t TSStateId;
typedef struct {
bool visible : 1;
bool named : 1;
bool supertype: 1;
} TSSymbolMetadata;
typedef struct TSLexer TSLexer;
@ -119,6 +120,8 @@ struct TSLanguage {
const uint16_t *small_parse_table;
const uint32_t *small_parse_table_map;
const TSSymbol *public_symbol_map;
const uint16_t *alias_map;
uint32_t state_count;
};
/*