rename intrinsics
This commit is contained in:
@@ -383,6 +383,7 @@ module.exports = grammar({
|
||||
$.catch_expression,
|
||||
$.unary_expression,
|
||||
$.field_expression,
|
||||
$.intrinsic_call_expression,
|
||||
$.call_expression,
|
||||
$.index_expression,
|
||||
$.slice_expression,
|
||||
@@ -440,6 +441,12 @@ module.exports = grammar({
|
||||
field('field', $.identifier),
|
||||
)),
|
||||
|
||||
intrinsic_call_expression: $ => prec(PREC.POSTFIX, seq(
|
||||
field('function', $.identifier),
|
||||
field('marker', '!'),
|
||||
field('arguments', $.argument_list),
|
||||
)),
|
||||
|
||||
call_expression: $ => prec.left(PREC.POSTFIX, seq(
|
||||
field('function', $.expression),
|
||||
field('arguments', $.argument_list),
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
(function_declaration name: (identifier) @function)
|
||||
(parameter name: (identifier) @variable.parameter)
|
||||
|
||||
(intrinsic_call_expression function: (identifier) @function.builtin)
|
||||
(call_expression function: (expression (identifier) @function))
|
||||
(call_expression function: (expression (field_expression field: (identifier) @function)))
|
||||
(field_expression field: (identifier) @property)
|
||||
|
||||
@@ -2696,6 +2696,10 @@
|
||||
"type": "SYMBOL",
|
||||
"name": "field_expression"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "intrinsic_call_expression"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "call_expression"
|
||||
@@ -3271,6 +3275,39 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"intrinsic_call_expression": {
|
||||
"type": "PREC",
|
||||
"value": 9,
|
||||
"content": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "FIELD",
|
||||
"name": "function",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "identifier"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "FIELD",
|
||||
"name": "marker",
|
||||
"content": {
|
||||
"type": "STRING",
|
||||
"value": "!"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "FIELD",
|
||||
"name": "arguments",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "argument_list"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"call_expression": {
|
||||
"type": "PREC_LEFT",
|
||||
"value": 9,
|
||||
|
||||
@@ -730,6 +730,10 @@
|
||||
"type": "integer",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "intrinsic_call_expression",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "multiline_string",
|
||||
"named": true
|
||||
@@ -1309,6 +1313,42 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "intrinsic_call_expression",
|
||||
"named": true,
|
||||
"fields": {
|
||||
"arguments": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "argument_list",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"function": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "identifier",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"marker": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "!",
|
||||
"named": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "keyed_field_initializer",
|
||||
"named": true,
|
||||
|
||||
+107077
-106183
File diff suppressed because it is too large
Load Diff
@@ -96,6 +96,34 @@ sum func(a, b i32) i32 ! Status {
|
||||
(enum_literal
|
||||
(identifier))))))))))))
|
||||
|
||||
==================
|
||||
Intrinsic calls
|
||||
==================
|
||||
|
||||
main func() void {
|
||||
_ = sizeof ! (i32)
|
||||
}
|
||||
|
||||
---
|
||||
|
||||
(source_file
|
||||
(function_declaration
|
||||
(identifier)
|
||||
(parameter_list)
|
||||
(type
|
||||
(builtin_type))
|
||||
(block
|
||||
(statement
|
||||
(assignment_statement
|
||||
(expression
|
||||
(sink))
|
||||
(expression
|
||||
(intrinsic_call_expression
|
||||
(identifier)
|
||||
(argument_list
|
||||
(expression
|
||||
(builtin_type))))))))))
|
||||
|
||||
==================
|
||||
Errdefer
|
||||
==================
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
main func() void {
|
||||
_ = sizeof!(i32)
|
||||
# ^^^^^^ function.builtin
|
||||
# ^ operator
|
||||
_ = sizeof(i32)
|
||||
# ^^^^^^ function
|
||||
}
|
||||
Reference in New Issue
Block a user