Updated tree-sitter grammar and highlights to match latest language changes
Signed-off-by: erick-alcachofa <erick@artichoke.dev>
This commit is contained in:
parent
f3a9620f1e
commit
acc3b5e537
300
grammar.js
300
grammar.js
@ -1,41 +1,48 @@
|
||||
// Define precedence levels. Higher numbers bind tighter.
|
||||
/**
|
||||
* Tree-sitter grammar for Artichoke
|
||||
*/
|
||||
|
||||
const PREC = {
|
||||
ASSIGN: 1,
|
||||
OR: 2,
|
||||
AND: 3,
|
||||
COMPARE: 4,
|
||||
BIT_OR: 5,
|
||||
BIT_XOR: 6,
|
||||
BIT_AND: 7,
|
||||
SHIFT: 8,
|
||||
ADD: 9,
|
||||
MULTIPLY: 10,
|
||||
PREFIX: 11,
|
||||
POSTFIX: 12,
|
||||
CALL: 13,
|
||||
FIELD: 14,
|
||||
BITWISE: 5,
|
||||
SHIFT: 6,
|
||||
ADD: 7,
|
||||
MULTIPLY: 8,
|
||||
PREFIX: 9,
|
||||
POSTFIX: 10,
|
||||
CALL: 11,
|
||||
};
|
||||
|
||||
module.exports = grammar({
|
||||
name: 'artichoke',
|
||||
|
||||
// Ignore whitespace and comments everywhere automatically
|
||||
extras: $ => [
|
||||
/\s/,
|
||||
$.comment,
|
||||
],
|
||||
|
||||
// Define conflicts where the parser needs help deciding (common in generics vs comparisons)
|
||||
word: $ => $.identifier,
|
||||
|
||||
conflicts: $ => [
|
||||
[$._type_name, $.expression],
|
||||
[$._type_name, $.primary_expression],
|
||||
[$.generic_params_list, $.expression],
|
||||
[$.types_list, $.expression_list],
|
||||
[$.type_name, $.access_expression],
|
||||
[$._primary_expression, $.type_initiated_literal],
|
||||
[$._primary_expression, $.access_expression],
|
||||
[$.namespaced_identifier],
|
||||
[$.access_expression],
|
||||
[$._primary_expression, $.type_name],
|
||||
[$._suffix_op],
|
||||
[$.positional_field_list],
|
||||
[$.named_field_list],
|
||||
[$.fn_params_list],
|
||||
[$.type],
|
||||
[$._primary_expression, $.type],
|
||||
[$.prefix_expression, $.type], // <--- NEW: Explicitly resolve *deref vs *type
|
||||
],
|
||||
|
||||
rules: {
|
||||
// --- Program Structure ---
|
||||
source_file: $ => repeat($._declaration),
|
||||
|
||||
_declaration: $ => choice(
|
||||
@ -65,20 +72,14 @@ module.exports = grammar({
|
||||
'module',
|
||||
field('name', $.namespaced_identifier),
|
||||
'{',
|
||||
repeat(choice(
|
||||
$.module_statement,
|
||||
$.alias_statement,
|
||||
$.struct_declaration,
|
||||
$.enum_declaration,
|
||||
$.function_declaration
|
||||
)),
|
||||
repeat($._declaration),
|
||||
'}'
|
||||
),
|
||||
|
||||
import_statement: $ => seq(
|
||||
'import',
|
||||
field('path', $.namespaced_identifier),
|
||||
optional(seq('::', field('wildcard', '*'))),
|
||||
optional(seq('::', '*')),
|
||||
';'
|
||||
),
|
||||
|
||||
@ -90,8 +91,6 @@ module.exports = grammar({
|
||||
';'
|
||||
),
|
||||
|
||||
// --- Declarations ---
|
||||
|
||||
function_declaration: $ => seq(
|
||||
'fn',
|
||||
field('name', $.identifier),
|
||||
@ -103,11 +102,7 @@ module.exports = grammar({
|
||||
field('body', $.code_block)
|
||||
),
|
||||
|
||||
fn_params_list: $ => choice(
|
||||
seq($._this_param, optional(seq(',', commaSep1($.fn_param)))),
|
||||
commaSep1($.fn_param)
|
||||
),
|
||||
|
||||
fn_params_list: $ => commaSep1(choice($._this_param, $.fn_param)),
|
||||
_this_param: $ => seq('this', $.type),
|
||||
fn_param: $ => seq(field('name', $.identifier), ':', field('type', $.type)),
|
||||
|
||||
@ -116,8 +111,7 @@ module.exports = grammar({
|
||||
field('name', $.identifier),
|
||||
optional($.generic_params),
|
||||
'{',
|
||||
optional(commaSep1($.struct_member)),
|
||||
optional(','), // trailing comma
|
||||
optional(seq(commaSep1($.struct_member), optional(','))),
|
||||
'}'
|
||||
),
|
||||
|
||||
@ -128,26 +122,22 @@ module.exports = grammar({
|
||||
field('name', $.identifier),
|
||||
optional($.generic_params),
|
||||
'{',
|
||||
optional(commaSep1($.enum_member)),
|
||||
optional(','), // trailing comma
|
||||
optional(seq(commaSep1($.enum_member), optional(','))),
|
||||
'}'
|
||||
),
|
||||
|
||||
enum_member: $ => seq(
|
||||
field('name', $.identifier),
|
||||
optional(seq('(', field('type', $.type), ')'))
|
||||
optional(seq('(', $.type, ')'))
|
||||
),
|
||||
|
||||
generic_params: $ => seq('<', $.generic_params_list, '>'),
|
||||
generic_params_list: $ => commaSep1($.generic_param),
|
||||
generic_params: $ => seq('<', commaSep1($.generic_param), '>'),
|
||||
generic_param: $ => seq('typename', $.identifier),
|
||||
|
||||
// --- Statements ---
|
||||
|
||||
code_block: $ => seq('{', repeat($._statement), '}'),
|
||||
|
||||
_statement: $ => choice(
|
||||
$.variable_declaration,
|
||||
$.variable_declaration_stmt,
|
||||
$.if_statement,
|
||||
$.defer_statement,
|
||||
$.errdefer_statement,
|
||||
@ -161,20 +151,19 @@ module.exports = grammar({
|
||||
),
|
||||
|
||||
expression_statement: $ => seq($.expression, ';'),
|
||||
variable_declaration_stmt: $ => seq($.variable_declaration, ';'),
|
||||
|
||||
variable_declaration: $ => seq(
|
||||
choice('let', 'def'),
|
||||
field('declarator', choice('let', 'def')),
|
||||
field('name', $.identifier),
|
||||
choice(
|
||||
seq(':', field('type', $.type), optional(seq('=', field('value', $.expression)))),
|
||||
seq('=', field('value', $.expression))
|
||||
),
|
||||
';'
|
||||
)
|
||||
),
|
||||
|
||||
if_statement: $ => seq(
|
||||
'if',
|
||||
'(', field('condition', $.expression), ')',
|
||||
'if', '(', field('condition', $.expression), ')',
|
||||
optional($.variable_unwrapper),
|
||||
field('consequence', $.code_block),
|
||||
optional($.else_statement)
|
||||
@ -190,7 +179,6 @@ module.exports = grammar({
|
||||
|
||||
variable_unwrapper: $ => seq('|', $.identifier, '|'),
|
||||
|
||||
// Loops
|
||||
loop_statement: $ => seq(
|
||||
optional(seq(field('label', $.identifier), ':=')),
|
||||
choice(
|
||||
@ -204,9 +192,9 @@ module.exports = grammar({
|
||||
|
||||
c_for_statement: $ => seq(
|
||||
'for', '(',
|
||||
field('initializer', optional(choice($.variable_declaration, seq($.expression, ';')))),
|
||||
optional(choice($.variable_declaration, $.expression)), ';',
|
||||
field('condition', $.expression), ';',
|
||||
field('update', optional($.expression)),
|
||||
optional(field('update', $.expression)),
|
||||
')',
|
||||
$.code_block
|
||||
),
|
||||
@ -231,15 +219,16 @@ module.exports = grammar({
|
||||
|
||||
inf_loop_statement: $ => seq('loop', $.code_block),
|
||||
|
||||
// Match/Switch
|
||||
match_statement: $ => seq(
|
||||
'match', '(', field('value', $.expression), ')',
|
||||
'{', repeat($.match_case), optional($.default_case), '}'
|
||||
),
|
||||
|
||||
match_case: $ => seq(
|
||||
$._type_name, optional(seq('(', field('capture', $.identifier), ')')),
|
||||
'->', $.code_block
|
||||
$.type,
|
||||
optional($.variable_unwrapper),
|
||||
'->',
|
||||
$.code_block
|
||||
),
|
||||
|
||||
switch_statement: $ => seq(
|
||||
@ -247,125 +236,153 @@ module.exports = grammar({
|
||||
'{', repeat($.switch_case), optional($.default_case), '}'
|
||||
),
|
||||
|
||||
switch_case: $ => seq(field('value', $.expression), '->', $.code_block),
|
||||
|
||||
switch_case: $ => seq($.expression, '->', $.code_block),
|
||||
default_case: $ => seq('_', '->', $.code_block),
|
||||
|
||||
// Control flow keywords
|
||||
break_statement: $ => seq('break', optional(field('label', $.identifier)), ';'),
|
||||
continue_statement: $ => seq('continue', optional(field('label', $.identifier)), ';'),
|
||||
break_statement: $ => seq('break', optional($.identifier), ';'),
|
||||
continue_statement: $ => seq('continue', optional($.identifier), ';'),
|
||||
return_statement: $ => seq('return', optional($.expression), ';'),
|
||||
defer_statement: $ => seq('defer', choice($.expression, $.code_block), ';'),
|
||||
errdefer_statement: $ => seq('errdefer', choice($.expression, $.code_block), ';'),
|
||||
|
||||
defer_statement: $ => seq(
|
||||
'defer',
|
||||
choice(
|
||||
$.code_block,
|
||||
seq($.expression, ';')
|
||||
)
|
||||
),
|
||||
|
||||
// --- Expressions (Flattened using precedence) ---
|
||||
errdefer_statement: $ => prec(1, seq(
|
||||
'errdefer',
|
||||
choice(
|
||||
$.code_block,
|
||||
seq($.expression, ';')
|
||||
)
|
||||
)),
|
||||
|
||||
expression: $ => choice(
|
||||
$.primary_expression,
|
||||
$.assignment_expression,
|
||||
$.binary_expression,
|
||||
$.unary_expression,
|
||||
$.postfix_expression
|
||||
$._bool_or_expression
|
||||
),
|
||||
|
||||
assignment_expression: $ => prec.right(PREC.ASSIGN, seq(
|
||||
field('left', $.expression),
|
||||
field('operator', choice('=', '+=', '-=', '*=', '/=', '%=', '&=', '|=', '<<=', '>>=', '||=', '&&=')),
|
||||
field('right', $.expression)
|
||||
$._bool_or_expression,
|
||||
choice('=', '+=', '-=', '*=', '/=', '%=', '&=', '|=', '^=', '<<=', '>>=', '||=', '&&='),
|
||||
$.expression
|
||||
)),
|
||||
|
||||
binary_expression: $ => choice(
|
||||
prec.left(PREC.OR, seq($.expression, choice('||', 'or'), $.expression)),
|
||||
prec.left(PREC.AND, seq($.expression, choice('&&', 'and'), $.expression)),
|
||||
prec.left(PREC.COMPARE, seq($.expression, choice('==', '!=', '>', '<', '>=', '<='), $.expression)),
|
||||
prec.left(PREC.BIT_OR, seq($.expression, '|', $.expression)),
|
||||
prec.left(PREC.BIT_XOR, seq($.expression, '^', $.expression)),
|
||||
prec.left(PREC.BIT_AND, seq($.expression, '&', $.expression)),
|
||||
prec.left(PREC.SHIFT, seq($.expression, choice('<<', '>>'), $.expression)),
|
||||
prec.left(PREC.ADD, seq($.expression, choice('+', '-'), $.expression)),
|
||||
prec.left(PREC.MULTIPLY, seq($.expression, choice('*', '/', '%'), $.expression))
|
||||
),
|
||||
|
||||
unary_expression: $ => prec(PREC.PREFIX, seq(
|
||||
field('operator', choice('!', '-', '~', '&', '*')),
|
||||
field('operand', $.expression)
|
||||
_bool_or_expression: $ => prec.left(PREC.OR, choice(
|
||||
seq($._bool_or_expression, choice('||', 'or'), $._bool_and_expression),
|
||||
$._bool_and_expression
|
||||
)),
|
||||
|
||||
postfix_expression: $ => prec.left(PREC.POSTFIX, choice(
|
||||
// Array access: expr[index] or slice: expr[start:end]
|
||||
seq($.expression, '[', choice(
|
||||
seq(field('index', $.expression), ']'),
|
||||
seq(optional(field('start', $.expression)), ':', optional(field('end', $.expression)), ']')
|
||||
)),
|
||||
// Field access: expr.field
|
||||
prec(PREC.FIELD, seq($.expression, '.', field('field', $.identifier))),
|
||||
// Namespaced access with optional generics: expr::Ident<T>
|
||||
prec(PREC.FIELD, seq($.expression, '::', field('field', $.identifier), optional($.type_arguments))),
|
||||
// Arrow access: expr->field
|
||||
prec(PREC.FIELD, seq($.expression, '->', field('field', $.identifier))),
|
||||
// Special suffixes
|
||||
seq($.expression, '.@', optional($.identifier)),
|
||||
seq($.expression, '.[', $.expression, ']'),
|
||||
seq($.expression, '.#'),
|
||||
seq($.expression, '.*'),
|
||||
// Function calls
|
||||
prec(PREC.CALL, seq(field('function', $.expression), '(', optional($.expression_list), ')'))
|
||||
_bool_and_expression: $ => prec.left(PREC.AND, choice(
|
||||
seq($._bool_and_expression, choice('&&', 'and'), $.compare_expression),
|
||||
$.compare_expression
|
||||
)),
|
||||
|
||||
primary_expression: $ => choice(
|
||||
compare_expression: $ => prec.left(PREC.COMPARE, seq(
|
||||
$.bitwise_expression,
|
||||
optional(seq(choice('==', '!=', '>', '<', '>=', '<='), $.bitwise_expression))
|
||||
)),
|
||||
|
||||
bitwise_expression: $ => prec.left(PREC.BITWISE, choice(
|
||||
seq($.bitwise_expression, choice('&', '^', '|'), $.bitwise_shift_expression),
|
||||
$.bitwise_shift_expression
|
||||
)),
|
||||
|
||||
bitwise_shift_expression: $ => prec.left(PREC.SHIFT, choice(
|
||||
seq($.bitwise_shift_expression, choice('<<', '>>'), $.addition_expression),
|
||||
$.addition_expression
|
||||
)),
|
||||
|
||||
addition_expression: $ => prec.left(PREC.ADD, choice(
|
||||
seq($.addition_expression, choice('+', '-'), $.multiply_expression),
|
||||
$.multiply_expression
|
||||
)),
|
||||
|
||||
multiply_expression: $ => prec.left(PREC.MULTIPLY, choice(
|
||||
seq($.multiply_expression, choice('*', '/', '%'), $.prefix_expression),
|
||||
$.prefix_expression
|
||||
)),
|
||||
|
||||
prefix_expression: $ => prec(PREC.PREFIX, seq(
|
||||
repeat(choice('!', '-', '~', '&', '*')),
|
||||
$.postfix_expression
|
||||
)),
|
||||
|
||||
postfix_expression: $ => prec.left(PREC.POSTFIX, seq(
|
||||
$._primary_expression,
|
||||
repeat(choice(
|
||||
$._suffix_op,
|
||||
$.fn_call_arguments
|
||||
))
|
||||
)),
|
||||
|
||||
_primary_expression: $ => choice(
|
||||
seq('(', $.expression, ')'),
|
||||
$.literal,
|
||||
$.type_initiated_literal,
|
||||
seq($.access_expression, optional(seq('{', optional($.struct_literal_body), '}')))
|
||||
),
|
||||
|
||||
access_expression: $ => prec(2, seq(
|
||||
$.identifier,
|
||||
// Struct literal initialization: MyType{ ... }
|
||||
seq($._type_name, '{', $.struct_literal_body, '}')
|
||||
optional(seq('::', '<', $.types_list, '>'))
|
||||
)),
|
||||
|
||||
type_initiated_literal: $ => seq(
|
||||
$.type,
|
||||
'{',
|
||||
optional($.struct_literal_body),
|
||||
'}'
|
||||
),
|
||||
|
||||
expression_list: $ => commaSep1($.expression),
|
||||
type_arguments: $ => seq('<', $.types_list, '>'),
|
||||
fn_call_arguments: $ => prec(PREC.CALL, seq(
|
||||
'(',
|
||||
optional(commaSep1($.expression)),
|
||||
')'
|
||||
)),
|
||||
|
||||
struct_literal_body: $ => choice(
|
||||
commaSep1(seq(field('field', $.identifier), ':', field('value', $.expression))),
|
||||
commaSep1($.expression)
|
||||
struct_literal_body: $ => seq(
|
||||
choice($.named_field_list, $.positional_field_list),
|
||||
optional(',')
|
||||
),
|
||||
|
||||
// --- Types ---
|
||||
named_field_list: $ => commaSep1($.named_field_init),
|
||||
named_field_init: $ => seq('.', field('field', $.identifier), '=', $.expression),
|
||||
positional_field_list: $ => commaSep1($.expression),
|
||||
|
||||
_suffix_op: $ => choice(
|
||||
seq('[', choice(
|
||||
seq(optional($.expression), ':', optional($.expression), ']'),
|
||||
seq($.expression, ']')
|
||||
)),
|
||||
seq('.', $.identifier),
|
||||
prec(3, seq('::', $.identifier, optional(seq('::', '<', $.types_list, '>')))),
|
||||
seq('->', $.identifier),
|
||||
seq('.@', optional($.identifier)),
|
||||
seq('.[', $.expression, ']'),
|
||||
'.#',
|
||||
'.*'
|
||||
),
|
||||
|
||||
type: $ => seq(
|
||||
optional($.type_qualifier_chain),
|
||||
$._type_name
|
||||
repeat(choice('*', '[]', '$', '?')),
|
||||
$.type_name
|
||||
),
|
||||
|
||||
// Recursive type qualifiers based on your EBNF rules
|
||||
type_qualifier_chain: $ => choice(
|
||||
seq(choice('*', '[]'), optional($.type_qualifier_chain)),
|
||||
seq('$', optional($._qualifier_after_mutable)),
|
||||
seq('?', optional($._qualifier_after_optional))
|
||||
),
|
||||
_qualifier_after_optional: $ => choice(
|
||||
seq(choice('*', '[]'), optional($.type_qualifier_chain)),
|
||||
seq('$', optional($._qualifier_after_mutable))
|
||||
),
|
||||
_qualifier_after_mutable: $ => choice(
|
||||
seq(choice('*', '[]'), optional($.type_qualifier_chain)),
|
||||
seq('?', optional($._qualifier_after_optional))
|
||||
type_name: $ => seq(
|
||||
$.access_expression,
|
||||
repeat(seq('::', $.identifier, optional(seq('::', '<', $.types_list, '>'))))
|
||||
),
|
||||
|
||||
// A type name, potentially namespaced and generic: std::vec::Vec<int>
|
||||
_type_name: $ => seq(
|
||||
$.identifier,
|
||||
optional($.type_arguments),
|
||||
repeat(seq('::', $.identifier, optional($.type_arguments)))
|
||||
),
|
||||
|
||||
namespaced_identifier: $ => prec.left(seq(
|
||||
namespaced_identifier: $ => prec(1, seq(
|
||||
$.identifier,
|
||||
repeat(seq('::', $.identifier))
|
||||
)),
|
||||
|
||||
types_list: $ => commaSep1($.type),
|
||||
|
||||
|
||||
// --- Tokens & Literals (Simplified for now) ---
|
||||
identifier: $ => /[a-zA-Z_][a-zA-Z0-9_]*/,
|
||||
|
||||
literal: $ => choice(
|
||||
@ -378,22 +395,17 @@ module.exports = grammar({
|
||||
|
||||
null_literal: $ => 'null',
|
||||
boolean_literal: $ => choice('true', 'false'),
|
||||
// Basic regex for literals - adjust to match your lexer exactly
|
||||
number_literal: $ => /\d+(\.\d+)?/,
|
||||
char_literal: $ => /'([^'\\]|\\.)'/,
|
||||
string_literal: $ => /"([^"\\]|\\.)*"/,
|
||||
|
||||
comment: $ => token(choice(
|
||||
seq('//', /.*/),
|
||||
seq(
|
||||
'/*',
|
||||
/[^*]*\*+([^/*][^*]*\*+)*/,
|
||||
'/'
|
||||
)
|
||||
seq('/*', /[^*]*\*+([^/*][^*]*\*+)*/, '/')
|
||||
)),
|
||||
}
|
||||
});
|
||||
|
||||
// Helper function for comma-separated lists
|
||||
function commaSep1(rule) {
|
||||
return seq(rule, repeat(seq(',', rule)));
|
||||
}
|
||||
|
||||
@ -1,84 +1,70 @@
|
||||
; ==============================================================================
|
||||
; ARTICHOKE HIGHLIGHTING - STABLE VERSION
|
||||
; ==============================================================================
|
||||
; ============================================================================
|
||||
; Artichoke Tree-sitter Highlights (Corrected)
|
||||
; ============================================================================
|
||||
|
||||
; --- 1. Keywords ---
|
||||
["let" "def"] @keyword
|
||||
["if" "else" "match" "switch" "while" "do" "for" "loop"] @conditional
|
||||
; --- 6. The Variable Catch-All (Low Priority) ---
|
||||
; Matches 'argc', 'PI', and general variables
|
||||
(identifier) @variable
|
||||
|
||||
; --- 1. Keywords & Builtins ---
|
||||
(export_declaration "export" @keyword)
|
||||
["import" "using" "module"] @keyword.import
|
||||
["fn" "struct" "enum" "typename"] @keyword.storage
|
||||
["let" "def"] @keyword.variable
|
||||
["if" "else" "match" "switch" "while" "for" "do" "loop" "->"] @keyword.control
|
||||
["return" "break" "continue" "defer" "errdefer"] @keyword.control
|
||||
["import" "export" "using" "module" "typename" "this"] @keyword.directive
|
||||
"fn" @keyword.function
|
||||
["struct" "enum"] @keyword.storage
|
||||
|
||||
; --- 2. Literals ---
|
||||
(string_literal) @string
|
||||
(char_literal) @character
|
||||
(number_literal) @number
|
||||
(boolean_literal) @boolean
|
||||
(null_literal) @constant.builtin
|
||||
(comment) @comment
|
||||
(boolean_literal) @boolean
|
||||
"this" @variable.builtin
|
||||
|
||||
; --- 3. Types ---
|
||||
(type) @type
|
||||
(generic_param (identifier) @type.definition)
|
||||
(namespaced_identifier "::" (identifier) @type .)
|
||||
|
||||
; --- 4. Functions & Methods ---
|
||||
; Function declarations
|
||||
; --- 2. Definitions ---
|
||||
(function_declaration name: (identifier) @function)
|
||||
|
||||
; Function calls: Any identifier that is the first child of a postfix_expression
|
||||
; and is NOT followed by a field access dot/arrow.
|
||||
(postfix_expression (identifier) @function.call)
|
||||
|
||||
; Method/Field access: Any identifier assigned to the 'field' role
|
||||
(postfix_expression field: (identifier) @property)
|
||||
|
||||
; --- 5. Variables & Parameters ---
|
||||
(variable_declaration name: (identifier) @variable)
|
||||
(fn_param name: (identifier) @variable.parameter)
|
||||
(struct_member name: (identifier) @property)
|
||||
(enum_member name: (identifier) @constant)
|
||||
(variable_unwrapper (identifier) @variable.parameter)
|
||||
|
||||
; --- 6. Namespacing ---
|
||||
(namespaced_identifier (identifier) @module)
|
||||
|
||||
; --- 7. Operators & Punctuation ---
|
||||
["=" "+=" "-=" "*=" "/=" "%=" "&=" "|=" "<<=" ">>=" "||=" "&&=" ":="] @operator
|
||||
["==" "!=" ">" "<" ">=" "<=" "||" "&&" "or" "and" "!" "~"] @operator
|
||||
["+" "-" "*" "/" "%" "&" "^" "|" "<<" ">>"] @operator
|
||||
["->" "::" "." ".*" ".@" ".#" "?" "$"] @operator
|
||||
|
||||
["(" ")" "[" "]" "{" "}"] @punctuation.bracket
|
||||
[":" ";" "," "|"] @punctuation.delimiter
|
||||
|
||||
|
||||
; --- Improved Type Highlighting ---
|
||||
|
||||
; 1. Definitions (The name following 'struct' or 'enum')
|
||||
(struct_declaration name: (identifier) @type)
|
||||
(enum_declaration name: (identifier) @type)
|
||||
|
||||
; 2. Type Annotations (The identifier used after a colon or '->')
|
||||
; This covers 'let x: Type' and 'fn() -> Type'
|
||||
(fn_param type: (type (identifier) @type))
|
||||
(variable_declaration type: (type (identifier) @type))
|
||||
(function_declaration return_type: (type (identifier) @type))
|
||||
|
||||
; 3. Struct Literals (The name before the '{')
|
||||
; Matches 'Asset { ... }'
|
||||
(primary_expression (identifier) @type . "{")
|
||||
|
||||
; 4. Generic Parameters
|
||||
; Matches 'typename T'
|
||||
(generic_param (identifier) @type.definition)
|
||||
|
||||
; 5. Namespaced Types
|
||||
; In 'AssetType::Texture', 'AssetType' is the type/module
|
||||
(namespaced_identifier (identifier) @type . "::")
|
||||
; --- 3. Type Usage (The "Deep Recursion" Fix) ---
|
||||
; We target identifiers inside the type hierarchy
|
||||
(type (type_name (access_expression (identifier) @type)))
|
||||
(type_name (access_expression (identifier) @type))
|
||||
|
||||
; 6. Built-in/Primitive Type Hint (Optional)
|
||||
; If you want standard types like 'int', 'string', 'u64' to look different
|
||||
((identifier) @type.builtin
|
||||
(#match? @type.builtin "^(u8|u16|u32|u64|i8|i16|i32|i64|f32|f64|bool)$"))
|
||||
; Highlights T in Point::<T>
|
||||
(types_list (type (type_name (access_expression (identifier) @type))))
|
||||
|
||||
; --- 4. Function Calls (Contextual Match) ---
|
||||
; Match an identifier followed by () in a postfix_expression
|
||||
(postfix_expression
|
||||
(access_expression (identifier) @function.call)
|
||||
(fn_call_arguments))
|
||||
|
||||
; --- 5. Members & Fields ---
|
||||
(fn_param name: (identifier) @variable.parameter)
|
||||
(struct_member name: (identifier) @variable.member)
|
||||
(enum_member name: (identifier) @constant)
|
||||
(named_field_init field: (identifier) @variable.member)
|
||||
|
||||
; Field access (obj.member or obj->member)
|
||||
(postfix_expression
|
||||
(identifier) @variable.member)
|
||||
|
||||
; --- 7. Literals, Comments & Metadata ---
|
||||
(number_literal) @number
|
||||
(string_literal) @string
|
||||
(char_literal) @string.special
|
||||
(comment) @comment @spell
|
||||
(variable_unwrapper (identifier) @variable.unwrapper)
|
||||
(namespaced_identifier (identifier) @module)
|
||||
|
||||
; Artichoke Reflection/Suffixes
|
||||
".@" @operator.special
|
||||
".#" @operator.special
|
||||
".*" @operator.special
|
||||
".[" @operator.special
|
||||
|
||||
; --- 8. Punctuation & Operators ---
|
||||
["(" ")" "[" "]" "{" "}"] @punctuation.bracket
|
||||
[":" ";" "," "." "::" "->"] @punctuation.delimiter
|
||||
["=" "+=" "-=" "*=" "/=" "%=" "&=" "|=" "^=" "<<=" ">>=" "||=" "&&=" ":="] @operator
|
||||
["+" "-" "*" "/" "%" "==" "!=" ">" "<" ">=" "<=" "!" "&" "|" "^" "||" "&&" "~" "<<" ">>"] @operator
|
||||
["?" "$"] @operator.special
|
||||
|
||||
2048
src/grammar.json
generated
2048
src/grammar.json
generated
File diff suppressed because it is too large
Load Diff
742
src/node-types.json
generated
742
src/node-types.json
generated
@ -1,4 +1,42 @@
|
||||
[
|
||||
{
|
||||
"type": "access_expression",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "identifier",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "types_list",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "addition_expression",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "addition_expression",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "multiply_expression",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "alias_statement",
|
||||
"named": true,
|
||||
@ -28,85 +66,24 @@
|
||||
{
|
||||
"type": "assignment_expression",
|
||||
"named": true,
|
||||
"fields": {
|
||||
"left": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "expression",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"operator": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "%=",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "&&=",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "&=",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "*=",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "+=",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "-=",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "/=",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "<<=",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "=",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": ">>=",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "|=",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "||=",
|
||||
"named": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"right": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "expression",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "compare_expression",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "expression",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "binary_expression",
|
||||
"type": "bitwise_expression",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
@ -114,7 +91,30 @@
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "expression",
|
||||
"type": "bitwise_expression",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "bitwise_shift_expression",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "bitwise_shift_expression",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "addition_expression",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "bitwise_shift_expression",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
@ -128,17 +128,16 @@
|
||||
{
|
||||
"type": "break_statement",
|
||||
"named": true,
|
||||
"fields": {
|
||||
"label": {
|
||||
"multiple": false,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "identifier",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": false,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "identifier",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -155,24 +154,6 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"initializer": {
|
||||
"multiple": true,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": ";",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "expression",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "variable_declaration",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"update": {
|
||||
"multiple": false,
|
||||
"required": false,
|
||||
@ -185,12 +166,20 @@
|
||||
}
|
||||
},
|
||||
"children": {
|
||||
"multiple": false,
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "code_block",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "expression",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "variable_declaration",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -244,7 +233,22 @@
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "variable_declaration",
|
||||
"type": "variable_declaration_stmt",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "compare_expression",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "bitwise_expression",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
@ -253,17 +257,16 @@
|
||||
{
|
||||
"type": "continue_statement",
|
||||
"named": true,
|
||||
"fields": {
|
||||
"label": {
|
||||
"multiple": false,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "identifier",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": false,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "identifier",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -392,17 +395,17 @@
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": {
|
||||
"multiple": false,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "type",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"children": {
|
||||
"multiple": false,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "type",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -456,42 +459,15 @@
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"multiple": true,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "assignment_expression",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "binary_expression",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "postfix_expression",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "primary_expression",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "unary_expression",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "expression_list",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "expression",
|
||||
"type": "compare_expression",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
@ -512,6 +488,21 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "fn_call_arguments",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "expression",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "fn_param",
|
||||
"named": true,
|
||||
@ -626,21 +617,6 @@
|
||||
"type": "generic_params",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "generic_params_list",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "generic_params_list",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
@ -705,16 +681,6 @@
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"wildcard": {
|
||||
"multiple": false,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "*",
|
||||
"named": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -809,18 +775,7 @@
|
||||
{
|
||||
"type": "match_case",
|
||||
"named": true,
|
||||
"fields": {
|
||||
"capture": {
|
||||
"multiple": false,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "identifier",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
@ -830,11 +785,11 @@
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "identifier",
|
||||
"type": "type",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "type_arguments",
|
||||
"type": "variable_unwrapper",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
@ -897,10 +852,18 @@
|
||||
"type": "enum_declaration",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "export_declaration",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "function_declaration",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "import_statement",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "module_statement",
|
||||
"named": true
|
||||
@ -912,6 +875,66 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "multiply_expression",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "multiply_expression",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "prefix_expression",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "named_field_init",
|
||||
"named": true,
|
||||
"fields": {
|
||||
"field": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "identifier",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"children": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "expression",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "named_field_list",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "named_field_init",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "namespaced_identifier",
|
||||
"named": true,
|
||||
@ -928,85 +951,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "postfix_expression",
|
||||
"named": true,
|
||||
"fields": {
|
||||
"end": {
|
||||
"multiple": false,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "expression",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"field": {
|
||||
"multiple": false,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "identifier",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"function": {
|
||||
"multiple": false,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "expression",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"index": {
|
||||
"multiple": false,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "expression",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"start": {
|
||||
"multiple": false,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "expression",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "expression",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "expression_list",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "identifier",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "type_arguments",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "primary_expression",
|
||||
"type": "positional_field_list",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
@ -1016,6 +961,29 @@
|
||||
{
|
||||
"type": "expression",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "postfix_expression",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "access_expression",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "expression",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "fn_call_arguments",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "identifier",
|
||||
@ -1030,7 +998,26 @@
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "type_arguments",
|
||||
"type": "type_initiated_literal",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "types_list",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "prefix_expression",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "postfix_expression",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
@ -1160,34 +1147,17 @@
|
||||
{
|
||||
"type": "struct_literal_body",
|
||||
"named": true,
|
||||
"fields": {
|
||||
"field": {
|
||||
"multiple": true,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "identifier",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"value": {
|
||||
"multiple": true,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "expression",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": false,
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "expression",
|
||||
"type": "named_field_list",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "positional_field_list",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
@ -1222,25 +1192,18 @@
|
||||
{
|
||||
"type": "switch_case",
|
||||
"named": true,
|
||||
"fields": {
|
||||
"value": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "expression",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": false,
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "code_block",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "expression",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1279,33 +1242,52 @@
|
||||
"type": "type",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "type_name",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "type_initiated_literal",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "struct_literal_body",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "type",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "type_name",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "access_expression",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "identifier",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "type_arguments",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "type_qualifier_chain",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "type_arguments",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "types_list",
|
||||
"named": true
|
||||
@ -1313,21 +1295,6 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "type_qualifier_chain",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": false,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "type_qualifier_chain",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "types_list",
|
||||
"named": true,
|
||||
@ -1343,52 +1310,24 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "unary_expression",
|
||||
"named": true,
|
||||
"fields": {
|
||||
"operand": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "expression",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"operator": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "!",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "&",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "*",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "-",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "~",
|
||||
"named": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "variable_declaration",
|
||||
"named": true,
|
||||
"fields": {
|
||||
"declarator": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "def",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "let",
|
||||
"named": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"name": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
@ -1421,6 +1360,21 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "variable_declaration_stmt",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "variable_declaration",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "variable_unwrapper",
|
||||
"named": true,
|
||||
@ -1650,6 +1604,10 @@
|
||||
"type": "^",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "^=",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "_",
|
||||
"named": false
|
||||
|
||||
20503
src/parser.c
generated
20503
src/parser.c
generated
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user