Fix support for Func(...).Value
Need to set associativity on selected_component
This commit is contained in:
parent
7bd8543b71
commit
ec82f7b2cf
16
grammar.js
16
grammar.js
|
|
@ -106,10 +106,6 @@ module.exports = grammar({
|
||||||
[$._name, $.package_body_stub],
|
[$._name, $.package_body_stub],
|
||||||
|
|
||||||
],
|
],
|
||||||
inline: $ => [
|
|
||||||
// To avoid conflicts
|
|
||||||
$.selected_component,
|
|
||||||
],
|
|
||||||
|
|
||||||
rules: {
|
rules: {
|
||||||
compilation: $ => repeat(
|
compilation: $ => repeat(
|
||||||
|
|
@ -145,13 +141,17 @@ module.exports = grammar({
|
||||||
$.string_literal, // name of an operator. However, in a number of
|
$.string_literal, // name of an operator. However, in a number of
|
||||||
// places using a string doesn't make sense.
|
// places using a string doesn't make sense.
|
||||||
),
|
),
|
||||||
selected_component: $ => seq( // RM 4.1.3
|
selected_component: $ => prec.left(seq( // RM 4.1.3
|
||||||
$.identifier,
|
field('prefix', $._name),
|
||||||
seq(
|
seq(
|
||||||
'.',
|
'.',
|
||||||
$._name,
|
field('selector_name', choice(
|
||||||
|
$.identifier,
|
||||||
|
$.character_literal,
|
||||||
|
$.string_literal,
|
||||||
|
)),
|
||||||
),
|
),
|
||||||
),
|
)),
|
||||||
target_name: $ => '@', // RM 5.2.1
|
target_name: $ => '@', // RM 5.2.1
|
||||||
_name_list: $ => prec.left(comma_separated_list_of($._name)),
|
_name_list: $ => prec.left(comma_separated_list_of($._name)),
|
||||||
_defining_identifier_list: $ => comma_separated_list_of($.identifier),
|
_defining_identifier_list: $ => comma_separated_list_of($.identifier),
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,7 @@
|
||||||
(comment) @spell ;; spell-check comments
|
(comment) @spell ;; spell-check comments
|
||||||
(string_literal) @string
|
(string_literal) @string
|
||||||
(string_literal) @spell ;; spell-check strings
|
(string_literal) @spell ;; spell-check strings
|
||||||
|
(character_literal) @string
|
||||||
(identifier) @variable
|
(identifier) @variable
|
||||||
(numeric_literal) @number
|
(numeric_literal) @number
|
||||||
|
|
||||||
|
|
@ -141,6 +142,7 @@
|
||||||
(range_constraint "range" @type.definition)
|
(range_constraint "range" @type.definition)
|
||||||
(signed_integer_type_definition "range" @type.definition)
|
(signed_integer_type_definition "range" @type.definition)
|
||||||
(index_subtype_definition "range" @type.definition)
|
(index_subtype_definition "range" @type.definition)
|
||||||
|
(private_type_declaration "is" @type.definition "private" @type.definition)
|
||||||
|
|
||||||
;; Gray the body of expression functions
|
;; Gray the body of expression functions
|
||||||
(expression_function_declaration
|
(expression_function_declaration
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,11 @@
|
||||||
;; references. However, this is not yet supported by neovim
|
;; references. However, this is not yet supported by neovim
|
||||||
;; See https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables
|
;; See https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables
|
||||||
|
|
||||||
|
(compilation) @scope
|
||||||
(package_specification) @scope
|
(package_specification) @scope
|
||||||
(procedure_specification) @scope
|
(package_body) @scope
|
||||||
(function_specification) @scope
|
(subprogram_declaration) @scope
|
||||||
|
(subprogram_body) @scope
|
||||||
(block_statement) @scope
|
(block_statement) @scope
|
||||||
|
|
||||||
(with_clause (identifier) @definition.import)
|
(with_clause (identifier) @definition.import)
|
||||||
|
|
|
||||||
|
|
@ -181,26 +181,51 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"selected_component": {
|
"selected_component": {
|
||||||
"type": "SEQ",
|
"type": "PREC_LEFT",
|
||||||
"members": [
|
"value": 0,
|
||||||
{
|
"content": {
|
||||||
"type": "SYMBOL",
|
"type": "SEQ",
|
||||||
"name": "identifier"
|
"members": [
|
||||||
},
|
{
|
||||||
{
|
"type": "FIELD",
|
||||||
"type": "SEQ",
|
"name": "prefix",
|
||||||
"members": [
|
"content": {
|
||||||
{
|
|
||||||
"type": "STRING",
|
|
||||||
"value": "."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "_name"
|
"name": "_name"
|
||||||
}
|
}
|
||||||
]
|
},
|
||||||
}
|
{
|
||||||
]
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "FIELD",
|
||||||
|
"name": "selector_name",
|
||||||
|
"content": {
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "identifier"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "character_literal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "string_literal"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"target_name": {
|
"target_name": {
|
||||||
"type": "STRING",
|
"type": "STRING",
|
||||||
|
|
@ -14609,9 +14634,7 @@
|
||||||
],
|
],
|
||||||
"precedences": [],
|
"precedences": [],
|
||||||
"externals": [],
|
"externals": [],
|
||||||
"inline": [
|
"inline": [],
|
||||||
"selected_component"
|
|
||||||
],
|
|
||||||
"supertypes": []
|
"supertypes": []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
75428
src/parser.c
75428
src/parser.c
File diff suppressed because it is too large
Load Diff
|
|
@ -70,15 +70,16 @@ end;
|
||||||
(identifier)
|
(identifier)
|
||||||
(expression
|
(expression
|
||||||
(term
|
(term
|
||||||
(identifier)
|
(selected_component
|
||||||
(identifier)))))
|
(identifier)
|
||||||
|
(identifier))))))
|
||||||
(statement
|
(statement
|
||||||
(procedure_call_statement
|
(procedure_call_statement
|
||||||
(identifier)
|
(selected_component
|
||||||
(function_call
|
|
||||||
(identifier)
|
(identifier)
|
||||||
(actual_parameter_part
|
(identifier))
|
||||||
(parameter_association
|
(actual_parameter_part
|
||||||
(expression
|
(parameter_association
|
||||||
(term
|
(expression
|
||||||
(numeric_literal))))))))))))
|
(term
|
||||||
|
(numeric_literal)))))))))))
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,9 @@ use Ada.Text_IO, System;
|
||||||
(compilation
|
(compilation
|
||||||
(compilation_unit
|
(compilation_unit
|
||||||
(with_clause
|
(with_clause
|
||||||
(identifier)
|
(selected_component
|
||||||
(identifier)
|
(identifier)
|
||||||
|
(identifier))
|
||||||
(identifier)))
|
(identifier)))
|
||||||
(comment)
|
(comment)
|
||||||
(compilation_unit
|
(compilation_unit
|
||||||
|
|
@ -29,8 +30,9 @@ use Ada.Text_IO, System;
|
||||||
(identifier)))
|
(identifier)))
|
||||||
(compilation_unit
|
(compilation_unit
|
||||||
(use_clause
|
(use_clause
|
||||||
(identifier)
|
(selected_component
|
||||||
(identifier)
|
(identifier)
|
||||||
|
(identifier))
|
||||||
(identifier))))
|
(identifier))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
@ -72,8 +74,9 @@ end;
|
||||||
(identifier)))
|
(identifier)))
|
||||||
(compilation_unit
|
(compilation_unit
|
||||||
(package_specification
|
(package_specification
|
||||||
(identifier)
|
(selected_component
|
||||||
(identifier)
|
(identifier)
|
||||||
|
(identifier))
|
||||||
(comment))))
|
(comment))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
@ -94,8 +97,9 @@ end Child.P2;
|
||||||
(compilation
|
(compilation
|
||||||
(compilation_unit
|
(compilation_unit
|
||||||
(package_body
|
(package_body
|
||||||
(identifier)
|
(selected_component
|
||||||
(identifier)
|
(identifier)
|
||||||
|
(identifier))
|
||||||
(non_empty_declarative_part
|
(non_empty_declarative_part
|
||||||
(package_body
|
(package_body
|
||||||
(identifier)
|
(identifier)
|
||||||
|
|
@ -106,8 +110,9 @@ end Child.P2;
|
||||||
(handled_sequence_of_statements
|
(handled_sequence_of_statements
|
||||||
(statement
|
(statement
|
||||||
(null_statement)))
|
(null_statement)))
|
||||||
(identifier)
|
(selected_component
|
||||||
(identifier))))
|
(identifier)
|
||||||
|
(identifier)))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
separate
|
separate
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,9 @@ end P;
|
||||||
(identifier))
|
(identifier))
|
||||||
(package_renaming_declaration
|
(package_renaming_declaration
|
||||||
(identifier)
|
(identifier)
|
||||||
(identifier)
|
(selected_component
|
||||||
(identifier))
|
(identifier)
|
||||||
|
(identifier)))
|
||||||
(subprogram_renaming_declaration
|
(subprogram_renaming_declaration
|
||||||
(procedure_specification
|
(procedure_specification
|
||||||
(identifier)
|
(identifier)
|
||||||
|
|
|
||||||
|
|
@ -101,13 +101,14 @@ end P;
|
||||||
(statement
|
(statement
|
||||||
(loop_statement
|
(loop_statement
|
||||||
(iteration_scheme
|
(iteration_scheme
|
||||||
(iterator_specification
|
(loop_parameter_specification
|
||||||
(identifier)
|
(identifier)
|
||||||
(identifier)
|
(range_g
|
||||||
(identifier)
|
(selected_component
|
||||||
(tick)
|
(identifier)
|
||||||
(attribute_designator
|
(identifier))
|
||||||
(identifier))))
|
(tick)
|
||||||
|
(range_attribute_designator))))
|
||||||
(statement
|
(statement
|
||||||
(goto_statement
|
(goto_statement
|
||||||
(identifier)))
|
(identifier)))
|
||||||
|
|
@ -472,8 +473,9 @@ end;
|
||||||
(term
|
(term
|
||||||
(allocator
|
(allocator
|
||||||
(subpool_specification
|
(subpool_specification
|
||||||
(identifier)
|
(selected_component
|
||||||
(identifier))
|
(identifier)
|
||||||
|
(identifier)))
|
||||||
(qualified_expression
|
(qualified_expression
|
||||||
(identifier)
|
(identifier)
|
||||||
(tick)
|
(tick)
|
||||||
|
|
@ -542,9 +544,10 @@ end;
|
||||||
(handled_sequence_of_statements
|
(handled_sequence_of_statements
|
||||||
(statement
|
(statement
|
||||||
(assignment_statement
|
(assignment_statement
|
||||||
(identifier)
|
|
||||||
(function_call
|
(function_call
|
||||||
(identifier)
|
(selected_component
|
||||||
|
(identifier)
|
||||||
|
(identifier))
|
||||||
(actual_parameter_part
|
(actual_parameter_part
|
||||||
(parameter_association
|
(parameter_association
|
||||||
(expression
|
(expression
|
||||||
|
|
@ -558,9 +561,10 @@ end;
|
||||||
(numeric_literal)))))
|
(numeric_literal)))))
|
||||||
(statement
|
(statement
|
||||||
(assignment_statement
|
(assignment_statement
|
||||||
(identifier)
|
|
||||||
(function_call
|
(function_call
|
||||||
(identifier)
|
(selected_component
|
||||||
|
(identifier)
|
||||||
|
(identifier))
|
||||||
(actual_parameter_part
|
(actual_parameter_part
|
||||||
(parameter_association
|
(parameter_association
|
||||||
(expression
|
(expression
|
||||||
|
|
|
||||||
|
|
@ -499,3 +499,28 @@ procedure Proc (A : access Integer);
|
||||||
(identifier)
|
(identifier)
|
||||||
(access_definition
|
(access_definition
|
||||||
(identifier))))))))
|
(identifier))))))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Subprogram and field access
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
V := Func (2).Value;
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(compilation
|
||||||
|
(compilation_unit
|
||||||
|
(statement
|
||||||
|
(assignment_statement
|
||||||
|
(identifier)
|
||||||
|
(expression
|
||||||
|
(term
|
||||||
|
(selected_component
|
||||||
|
(function_call
|
||||||
|
(identifier)
|
||||||
|
(actual_parameter_part
|
||||||
|
(parameter_association
|
||||||
|
(expression
|
||||||
|
(term
|
||||||
|
(numeric_literal))))))
|
||||||
|
(identifier))))))))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user