Add field names

This commit is contained in:
Jonatan Kłosko 2021-09-28 17:26:43 +02:00
parent d229dddf66
commit bb5f90516e
8 changed files with 270366 additions and 259448 deletions

View File

@ -364,7 +364,7 @@ module.exports = grammar({
_keywords_with_trailing_separator: ($) => _keywords_with_trailing_separator: ($) =>
seq(sep1($.pair, ","), optional(",")), seq(sep1($.pair, ","), optional(",")),
pair: ($) => seq($._keyword, $._expression), pair: ($) => seq(field("key", $._keyword), field("value", $._expression)),
_keyword: ($) => choice($.keyword, $.quoted_keyword), _keyword: ($) => choice($.keyword, $.quoted_keyword),
@ -534,7 +534,11 @@ module.exports = grammar({
dot: ($) => dot: ($) =>
prec( prec(
PREC.DOT_OP, PREC.DOT_OP,
seq(choice($._expression), ".", choice($.alias, $.tuple)) seq(
field("left", $._expression),
field("operator", "."),
field("right", choice($.alias, $.tuple))
)
), ),
call: ($) => choice($._call_without_parentheses, $._call_with_parentheses), call: ($) => choice($._call_without_parentheses, $._call_with_parentheses),
@ -560,7 +564,7 @@ module.exports = grammar({
_local_call_without_parentheses: ($) => _local_call_without_parentheses: ($) =>
prec.left( prec.left(
seq( seq(
$._identifier, field("target", $._identifier),
alias($._call_arguments_without_parentheses, $.arguments), alias($._call_arguments_without_parentheses, $.arguments),
optional(seq(optional($._newline_before_do), $.do_block)) optional(seq(optional($._newline_before_do), $.do_block))
) )
@ -569,7 +573,7 @@ module.exports = grammar({
_local_call_with_parentheses: ($) => _local_call_with_parentheses: ($) =>
prec.left( prec.left(
seq( seq(
$._identifier, field("target", $._identifier),
alias($._call_arguments_with_parentheses_immediate, $.arguments), alias($._call_arguments_with_parentheses_immediate, $.arguments),
optional(seq(optional($._newline_before_do), $.do_block)) optional(seq(optional($._newline_before_do), $.do_block))
) )
@ -577,12 +581,12 @@ module.exports = grammar({
_local_call_just_do_block: ($) => _local_call_just_do_block: ($) =>
// Lower precedence than identifier, because `foo bar do` is `foo(bar) do end` // Lower precedence than identifier, because `foo bar do` is `foo(bar) do end`
prec(-1, seq($._identifier, $.do_block)), prec(-1, seq(field("target", $._identifier), $.do_block)),
_remote_call_without_parentheses: ($) => _remote_call_without_parentheses: ($) =>
prec.left( prec.left(
seq( seq(
alias($._remote_dot, $.dot), field("target", alias($._remote_dot, $.dot)),
optional(alias($._call_arguments_without_parentheses, $.arguments)), optional(alias($._call_arguments_without_parentheses, $.arguments)),
optional(seq(optional($._newline_before_do), $.do_block)) optional(seq(optional($._newline_before_do), $.do_block))
) )
@ -591,7 +595,7 @@ module.exports = grammar({
_remote_call_with_parentheses: ($) => _remote_call_with_parentheses: ($) =>
prec.left( prec.left(
seq( seq(
alias($._remote_dot, $.dot), field("target", alias($._remote_dot, $.dot)),
alias($._call_arguments_with_parentheses_immediate, $.arguments), alias($._call_arguments_with_parentheses_immediate, $.arguments),
optional(seq(optional($._newline_before_do), $.do_block)) optional(seq(optional($._newline_before_do), $.do_block))
) )
@ -601,8 +605,10 @@ module.exports = grammar({
prec( prec(
PREC.DOT_OP, PREC.DOT_OP,
seq( seq(
$._expression, field("left", $._expression),
".", field("operator", "."),
field(
"right",
choice( choice(
$._identifier, $._identifier,
alias(choice(...RESERVED_WORD_TOKENS), $.identifier), alias(choice(...RESERVED_WORD_TOKENS), $.identifier),
@ -611,19 +617,26 @@ module.exports = grammar({
alias($._quoted_i_single, $.charlist) alias($._quoted_i_single, $.charlist)
) )
) )
)
), ),
_anonymous_call: ($) => _anonymous_call: ($) =>
seq( seq(
alias($._anonymous_dot, $.dot), field("target", alias($._anonymous_dot, $.dot)),
alias($._call_arguments_with_parentheses, $.arguments) alias($._call_arguments_with_parentheses, $.arguments)
), ),
_anonymous_dot: ($) => prec(PREC.DOT_OP, seq($._expression, ".")), _anonymous_dot: ($) =>
prec(
PREC.DOT_OP,
seq(field("left", $._expression), field("operator", "."))
),
_double_call: ($) => _double_call: ($) =>
prec.left( prec.left(
seq( seq(
field(
"target",
alias( alias(
choice( choice(
$._local_call_with_parentheses, $._local_call_with_parentheses,
@ -631,6 +644,7 @@ module.exports = grammar({
$._anonymous_call $._anonymous_call
), ),
$.call $.call
)
), ),
alias($._call_arguments_with_parentheses, $.arguments), alias($._call_arguments_with_parentheses, $.arguments),
optional(seq(optional($._newline_before_do), $.do_block)) optional(seq(optional($._newline_before_do), $.do_block))
@ -684,12 +698,23 @@ module.exports = grammar({
access_call: ($) => access_call: ($) =>
prec( prec(
PREC.ACCESS, PREC.ACCESS,
seq($._expression, token.immediate("["), $._expression, "]") seq(
field("target", $._expression),
token.immediate("["),
field("key", $._expression),
"]"
)
), ),
stab_clause: ($) => stab_clause: ($) =>
// Right precedence, because we want to consume body if any // Right precedence, because we want to consume body if any
prec.right(seq(optional($._stab_clause_left), "->", optional($.body))), prec.right(
seq(
optional(field("left", $._stab_clause_left)),
field("operator", "->"),
optional(field("right", $.body))
)
),
_stab_clause_left: ($) => _stab_clause_left: ($) =>
choice( choice(
@ -738,9 +763,12 @@ module.exports = grammar({
_stab_clause_arguments_with_parentheses_with_guard: ($) => _stab_clause_arguments_with_parentheses_with_guard: ($) =>
seq( seq(
alias($._stab_clause_arguments_with_parentheses, $.arguments), field(
"when", "left",
$._expression alias($._stab_clause_arguments_with_parentheses, $.arguments)
),
field("operator", "when"),
field("right", $._expression)
), ),
_stab_clause_arguments_without_parentheses_with_guard: ($) => _stab_clause_arguments_without_parentheses_with_guard: ($) =>
@ -751,9 +779,12 @@ module.exports = grammar({
prec.dynamic( prec.dynamic(
1, 1,
seq( seq(
alias($._stab_clause_arguments_without_parentheses, $.arguments), field(
"when", "left",
$._expression alias($._stab_clause_arguments_without_parentheses, $.arguments)
),
field("operator", "when"),
field("right", $._expression)
) )
), ),
@ -798,7 +829,7 @@ function unaryOp($, assoc, precedence, operator, right = null) {
seq( seq(
optional($._before_unary_op), optional($._before_unary_op),
field("operator", operator), field("operator", operator),
right || $._expression field("operand", right || $._expression)
) )
) )
); );

View File

@ -2102,13 +2102,21 @@
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
{ {
"type": "FIELD",
"name": "key",
"content": {
"type": "SYMBOL", "type": "SYMBOL",
"name": "_keyword" "name": "_keyword"
}
}, },
{ {
"type": "FIELD",
"name": "value",
"content": {
"type": "SYMBOL", "type": "SYMBOL",
"name": "_expression" "name": "_expression"
} }
}
] ]
}, },
"_keyword": { "_keyword": {
@ -2690,9 +2698,13 @@
} }
}, },
{ {
"type": "FIELD",
"name": "operand",
"content": {
"type": "SYMBOL", "type": "SYMBOL",
"name": "_capture_expression" "name": "_capture_expression"
} }
}
] ]
} }
} }
@ -2752,9 +2764,13 @@
} }
}, },
{ {
"type": "FIELD",
"name": "operand",
"content": {
"type": "SYMBOL", "type": "SYMBOL",
"name": "_expression" "name": "_expression"
} }
}
] ]
} }
} }
@ -2789,9 +2805,13 @@
} }
}, },
{ {
"type": "FIELD",
"name": "operand",
"content": {
"type": "SYMBOL", "type": "SYMBOL",
"name": "_expression" "name": "_expression"
} }
}
] ]
} }
} }
@ -2826,9 +2846,13 @@
} }
}, },
{ {
"type": "FIELD",
"name": "operand",
"content": {
"type": "SYMBOL", "type": "SYMBOL",
"name": "integer" "name": "integer"
} }
}
] ]
} }
} }
@ -3914,19 +3938,25 @@
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
{ {
"type": "CHOICE", "type": "FIELD",
"members": [ "name": "left",
{ "content": {
"type": "SYMBOL", "type": "SYMBOL",
"name": "_expression" "name": "_expression"
} }
]
}, },
{ {
"type": "FIELD",
"name": "operator",
"content": {
"type": "STRING", "type": "STRING",
"value": "." "value": "."
}
}, },
{ {
"type": "FIELD",
"name": "right",
"content": {
"type": "CHOICE", "type": "CHOICE",
"members": [ "members": [
{ {
@ -3939,6 +3969,7 @@
} }
] ]
} }
}
] ]
} }
}, },
@ -4000,8 +4031,12 @@
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
{ {
"type": "FIELD",
"name": "target",
"content": {
"type": "SYMBOL", "type": "SYMBOL",
"name": "_identifier" "name": "_identifier"
}
}, },
{ {
"type": "ALIAS", "type": "ALIAS",
@ -4051,8 +4086,12 @@
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
{ {
"type": "FIELD",
"name": "target",
"content": {
"type": "SYMBOL", "type": "SYMBOL",
"name": "_identifier" "name": "_identifier"
}
}, },
{ {
"type": "ALIAS", "type": "ALIAS",
@ -4102,8 +4141,12 @@
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
{ {
"type": "FIELD",
"name": "target",
"content": {
"type": "SYMBOL", "type": "SYMBOL",
"name": "_identifier" "name": "_identifier"
}
}, },
{ {
"type": "SYMBOL", "type": "SYMBOL",
@ -4119,6 +4162,9 @@
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
{ {
"type": "FIELD",
"name": "target",
"content": {
"type": "ALIAS", "type": "ALIAS",
"content": { "content": {
"type": "SYMBOL", "type": "SYMBOL",
@ -4126,6 +4172,7 @@
}, },
"named": true, "named": true,
"value": "dot" "value": "dot"
}
}, },
{ {
"type": "CHOICE", "type": "CHOICE",
@ -4183,6 +4230,9 @@
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
{ {
"type": "FIELD",
"name": "target",
"content": {
"type": "ALIAS", "type": "ALIAS",
"content": { "content": {
"type": "SYMBOL", "type": "SYMBOL",
@ -4190,6 +4240,7 @@
}, },
"named": true, "named": true,
"value": "dot" "value": "dot"
}
}, },
{ {
"type": "ALIAS", "type": "ALIAS",
@ -4239,14 +4290,25 @@
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
{ {
"type": "FIELD",
"name": "left",
"content": {
"type": "SYMBOL", "type": "SYMBOL",
"name": "_expression" "name": "_expression"
}
}, },
{ {
"type": "FIELD",
"name": "operator",
"content": {
"type": "STRING", "type": "STRING",
"value": "." "value": "."
}
}, },
{ {
"type": "FIELD",
"name": "right",
"content": {
"type": "CHOICE", "type": "CHOICE",
"members": [ "members": [
{ {
@ -4347,6 +4409,7 @@
} }
] ]
} }
}
] ]
} }
}, },
@ -4354,6 +4417,9 @@
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
{ {
"type": "FIELD",
"name": "target",
"content": {
"type": "ALIAS", "type": "ALIAS",
"content": { "content": {
"type": "SYMBOL", "type": "SYMBOL",
@ -4361,6 +4427,7 @@
}, },
"named": true, "named": true,
"value": "dot" "value": "dot"
}
}, },
{ {
"type": "ALIAS", "type": "ALIAS",
@ -4380,13 +4447,21 @@
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
{ {
"type": "FIELD",
"name": "left",
"content": {
"type": "SYMBOL", "type": "SYMBOL",
"name": "_expression" "name": "_expression"
}
}, },
{ {
"type": "FIELD",
"name": "operator",
"content": {
"type": "STRING", "type": "STRING",
"value": "." "value": "."
} }
}
] ]
} }
}, },
@ -4397,6 +4472,9 @@
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
{ {
"type": "FIELD",
"name": "target",
"content": {
"type": "ALIAS", "type": "ALIAS",
"content": { "content": {
"type": "CHOICE", "type": "CHOICE",
@ -4417,6 +4495,7 @@
}, },
"named": true, "named": true,
"value": "call" "value": "call"
}
}, },
{ {
"type": "ALIAS", "type": "ALIAS",
@ -5291,8 +5370,12 @@
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
{ {
"type": "FIELD",
"name": "target",
"content": {
"type": "SYMBOL", "type": "SYMBOL",
"name": "_expression" "name": "_expression"
}
}, },
{ {
"type": "IMMEDIATE_TOKEN", "type": "IMMEDIATE_TOKEN",
@ -5302,8 +5385,12 @@
} }
}, },
{ {
"type": "FIELD",
"name": "key",
"content": {
"type": "SYMBOL", "type": "SYMBOL",
"name": "_expression" "name": "_expression"
}
}, },
{ {
"type": "STRING", "type": "STRING",
@ -5322,8 +5409,12 @@
"type": "CHOICE", "type": "CHOICE",
"members": [ "members": [
{ {
"type": "FIELD",
"name": "left",
"content": {
"type": "SYMBOL", "type": "SYMBOL",
"name": "_stab_clause_left" "name": "_stab_clause_left"
}
}, },
{ {
"type": "BLANK" "type": "BLANK"
@ -5331,15 +5422,23 @@
] ]
}, },
{ {
"type": "FIELD",
"name": "operator",
"content": {
"type": "STRING", "type": "STRING",
"value": "->" "value": "->"
}
}, },
{ {
"type": "CHOICE", "type": "CHOICE",
"members": [ "members": [
{ {
"type": "FIELD",
"name": "right",
"content": {
"type": "SYMBOL", "type": "SYMBOL",
"name": "body" "name": "body"
}
}, },
{ {
"type": "BLANK" "type": "BLANK"
@ -5551,6 +5650,9 @@
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
{ {
"type": "FIELD",
"name": "left",
"content": {
"type": "ALIAS", "type": "ALIAS",
"content": { "content": {
"type": "SYMBOL", "type": "SYMBOL",
@ -5558,15 +5660,24 @@
}, },
"named": true, "named": true,
"value": "arguments" "value": "arguments"
}
}, },
{ {
"type": "FIELD",
"name": "operator",
"content": {
"type": "STRING", "type": "STRING",
"value": "when" "value": "when"
}
}, },
{ {
"type": "FIELD",
"name": "right",
"content": {
"type": "SYMBOL", "type": "SYMBOL",
"name": "_expression" "name": "_expression"
} }
}
] ]
}, },
"_stab_clause_arguments_without_parentheses_with_guard": { "_stab_clause_arguments_without_parentheses_with_guard": {
@ -5576,6 +5687,9 @@
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
{ {
"type": "FIELD",
"name": "left",
"content": {
"type": "ALIAS", "type": "ALIAS",
"content": { "content": {
"type": "SYMBOL", "type": "SYMBOL",
@ -5583,15 +5697,24 @@
}, },
"named": true, "named": true,
"value": "arguments" "value": "arguments"
}
}, },
{ {
"type": "FIELD",
"name": "operator",
"content": {
"type": "STRING", "type": "STRING",
"value": "when" "value": "when"
}
}, },
{ {
"type": "FIELD",
"name": "right",
"content": {
"type": "SYMBOL", "type": "SYMBOL",
"name": "_expression" "name": "_expression"
} }
}
] ]
} }
}, },

View File

@ -2,9 +2,9 @@
{ {
"type": "access_call", "type": "access_call",
"named": true, "named": true,
"fields": {}, "fields": {
"children": { "key": {
"multiple": true, "multiple": false,
"required": true, "required": true,
"types": [ "types": [
{ {
@ -108,6 +108,113 @@
"named": true "named": true
} }
] ]
},
"target": {
"multiple": false,
"required": true,
"types": [
{
"type": "access_call",
"named": true
},
{
"type": "alias",
"named": true
},
{
"type": "anonymous_function",
"named": true
},
{
"type": "atom",
"named": true
},
{
"type": "binary_operator",
"named": true
},
{
"type": "bitstring",
"named": true
},
{
"type": "block",
"named": true
},
{
"type": "boolean",
"named": true
},
{
"type": "call",
"named": true
},
{
"type": "char",
"named": true
},
{
"type": "charlist",
"named": true
},
{
"type": "dot",
"named": true
},
{
"type": "float",
"named": true
},
{
"type": "identifier",
"named": true
},
{
"type": "integer",
"named": true
},
{
"type": "list",
"named": true
},
{
"type": "map",
"named": true
},
{
"type": "nil",
"named": true
},
{
"type": "quoted_atom",
"named": true
},
{
"type": "sigil",
"named": true
},
{
"type": "special_identifier",
"named": true
},
{
"type": "string",
"named": true
},
{
"type": "tuple",
"named": true
},
{
"type": "unary_operator",
"named": true
},
{
"type": "unused_identifier",
"named": true
}
]
}
} }
}, },
{ {
@ -361,7 +468,7 @@
"fields": { "fields": {
"left": { "left": {
"multiple": false, "multiple": false,
"required": false, "required": true,
"types": [ "types": [
{ {
"type": "access_call", "type": "access_call",
@ -375,6 +482,10 @@
"type": "anonymous_function", "type": "anonymous_function",
"named": true "named": true
}, },
{
"type": "arguments",
"named": true
},
{ {
"type": "atom", "type": "atom",
"named": true "named": true
@ -471,7 +582,7 @@
}, },
"operator": { "operator": {
"multiple": false, "multiple": false,
"required": false, "required": true,
"types": [ "types": [
{ {
"type": "!=", "type": "!=",
@ -657,7 +768,7 @@
}, },
"right": { "right": {
"multiple": false, "multiple": false,
"required": false, "required": true,
"types": [ "types": [
{ {
"type": "access_call", "type": "access_call",
@ -765,116 +876,6 @@
} }
] ]
} }
},
"children": {
"multiple": true,
"required": false,
"types": [
{
"type": "access_call",
"named": true
},
{
"type": "alias",
"named": true
},
{
"type": "anonymous_function",
"named": true
},
{
"type": "arguments",
"named": true
},
{
"type": "atom",
"named": true
},
{
"type": "binary_operator",
"named": true
},
{
"type": "bitstring",
"named": true
},
{
"type": "block",
"named": true
},
{
"type": "boolean",
"named": true
},
{
"type": "call",
"named": true
},
{
"type": "char",
"named": true
},
{
"type": "charlist",
"named": true
},
{
"type": "dot",
"named": true
},
{
"type": "float",
"named": true
},
{
"type": "identifier",
"named": true
},
{
"type": "integer",
"named": true
},
{
"type": "list",
"named": true
},
{
"type": "map",
"named": true
},
{
"type": "nil",
"named": true
},
{
"type": "quoted_atom",
"named": true
},
{
"type": "sigil",
"named": true
},
{
"type": "special_identifier",
"named": true
},
{
"type": "string",
"named": true
},
{
"type": "tuple",
"named": true
},
{
"type": "unary_operator",
"named": true
},
{
"type": "unused_identifier",
"named": true
}
]
} }
}, },
{ {
@ -1226,23 +1227,15 @@
{ {
"type": "call", "type": "call",
"named": true, "named": true,
"fields": {}, "fields": {
"children": { "target": {
"multiple": true, "multiple": false,
"required": false, "required": true,
"types": [ "types": [
{
"type": "arguments",
"named": true
},
{ {
"type": "call", "type": "call",
"named": true "named": true
}, },
{
"type": "do_block",
"named": true
},
{ {
"type": "dot", "type": "dot",
"named": true "named": true
@ -1262,6 +1255,21 @@
] ]
} }
}, },
"children": {
"multiple": true,
"required": false,
"types": [
{
"type": "arguments",
"named": true
},
{
"type": "do_block",
"named": true
}
]
}
},
{ {
"type": "catch_block", "type": "catch_block",
"named": true, "named": true,
@ -1534,9 +1542,9 @@
{ {
"type": "dot", "type": "dot",
"named": true, "named": true,
"fields": {}, "fields": {
"children": { "left": {
"multiple": true, "multiple": false,
"required": true, "required": true,
"types": [ "types": [
{ {
@ -1611,10 +1619,6 @@
"type": "nil", "type": "nil",
"named": true "named": true
}, },
{
"type": "operator_identifier",
"named": true
},
{ {
"type": "quoted_atom", "type": "quoted_atom",
"named": true "named": true
@ -1644,6 +1648,55 @@
"named": true "named": true
} }
] ]
},
"operator": {
"multiple": false,
"required": true,
"types": [
{
"type": ".",
"named": false
}
]
},
"right": {
"multiple": false,
"required": false,
"types": [
{
"type": "alias",
"named": true
},
{
"type": "charlist",
"named": true
},
{
"type": "identifier",
"named": true
},
{
"type": "operator_identifier",
"named": true
},
{
"type": "special_identifier",
"named": true
},
{
"type": "string",
"named": true
},
{
"type": "tuple",
"named": true
},
{
"type": "unused_identifier",
"named": true
}
]
}
} }
}, },
{ {
@ -2154,9 +2207,23 @@
{ {
"type": "pair", "type": "pair",
"named": true, "named": true,
"fields": {}, "fields": {
"children": { "key": {
"multiple": true, "multiple": false,
"required": true,
"types": [
{
"type": "keyword",
"named": true
},
{
"type": "quoted_keyword",
"named": true
}
]
},
"value": {
"multiple": false,
"required": true, "required": true,
"types": [ "types": [
{ {
@ -2219,10 +2286,6 @@
"type": "integer", "type": "integer",
"named": true "named": true
}, },
{
"type": "keyword",
"named": true
},
{ {
"type": "list", "type": "list",
"named": true "named": true
@ -2239,10 +2302,6 @@
"type": "quoted_atom", "type": "quoted_atom",
"named": true "named": true
}, },
{
"type": "quoted_keyword",
"named": true
},
{ {
"type": "sigil", "type": "sigil",
"named": true "named": true
@ -2269,6 +2328,7 @@
} }
] ]
} }
}
}, },
{ {
"type": "quoted_atom", "type": "quoted_atom",
@ -2581,9 +2641,9 @@
{ {
"type": "stab_clause", "type": "stab_clause",
"named": true, "named": true,
"fields": {}, "fields": {
"children": { "left": {
"multiple": true, "multiple": false,
"required": false, "required": false,
"types": [ "types": [
{ {
@ -2593,13 +2653,30 @@
{ {
"type": "binary_operator", "type": "binary_operator",
"named": true "named": true
}
]
}, },
"operator": {
"multiple": false,
"required": true,
"types": [
{
"type": "->",
"named": false
}
]
},
"right": {
"multiple": false,
"required": false,
"types": [
{ {
"type": "body", "type": "body",
"named": true "named": true
} }
] ]
} }
}
}, },
{ {
"type": "string", "type": "string",
@ -2790,49 +2867,18 @@
"type": "unary_operator", "type": "unary_operator",
"named": true, "named": true,
"fields": { "fields": {
"operator": { "operand": {
"multiple": false, "multiple": true,
"required": true, "required": true,
"types": [ "types": [
{ {
"type": "!", "type": "(",
"named": false "named": false
}, },
{ {
"type": "&", "type": ")",
"named": false "named": false
}, },
{
"type": "+",
"named": false
},
{
"type": "-",
"named": false
},
{
"type": "@",
"named": false
},
{
"type": "^",
"named": false
},
{
"type": "not",
"named": false
},
{
"type": "~~~",
"named": false
}
]
}
},
"children": {
"multiple": false,
"required": true,
"types": [
{ {
"type": "access_call", "type": "access_call",
"named": true "named": true
@ -2934,6 +2980,45 @@
"named": true "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": "not",
"named": false
},
{
"type": "~~~",
"named": false
}
]
}
} }
}, },
{ {

527802
src/parser.c

File diff suppressed because it is too large Load Diff

View File

@ -771,3 +771,33 @@ end
(integer)))) (integer))))
(body (body
(identifier))))))) (identifier)))))))
=====================================
[field names]
=====================================
fun do
x -> x
x when x == [] -> x
end
---
(source
(call
target: (identifier)
(do_block
(stab_clause
left: (arguments
(identifier))
right: (body
(identifier)))
(stab_clause
left: (binary_operator
left: (arguments
(identifier))
right: (binary_operator
left: (identifier)
right: (list)))
right: (body
(identifier))))))

View File

@ -916,6 +916,46 @@ unquote(name)()
(identifier))) (identifier)))
(arguments))) (arguments)))
=====================================
[field names]
=====================================
fun()
fun a
Mod.fun a
fun()()
fun.()
map[key]
---
(source
(call
target: (identifier)
(arguments))
(call
target: (identifier)
(arguments
(identifier)))
(call
target: (dot
left: (alias)
right: (identifier))
(arguments
(identifier)))
(call
target: (call
target: (identifier)
(arguments))
(arguments))
(call
target: (dot
left: (identifier))
(arguments))
(access_call
target: (identifier)
key: (identifier)))
===================================== =====================================
[error] leading argument separator [error] leading argument separator
===================================== =====================================

View File

@ -742,3 +742,19 @@ foo do end..bar do end//baz do end
(integer))) (integer)))
(block (block
(integer)))) (integer))))
=====================================
[field names]
=====================================
a + b
@a
---
(source
(binary_operator
left: (identifier)
right: (identifier))
(unary_operator
operand: (identifier)))

View File

@ -194,6 +194,23 @@ key interpolation
(quoted_content)) (quoted_content))
(integer))))) (integer)))))
=====================================
[field names]
=====================================
[a: 1, b: 2]
---
(source
(list
(keywords
(pair
key: (keyword)
value: (integer))
(pair
key: (keyword)
value: (integer)))))
===================================== =====================================
[error] with trailing items [error] with trailing items
===================================== =====================================