Support for renaming declarations
This commit is contained in:
parent
bf801ce20e
commit
ad302a74a2
79
corpus/access.txt
Normal file
79
corpus/access.txt
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
========
|
||||
access types
|
||||
========
|
||||
|
||||
package P is
|
||||
type A is access Integer;
|
||||
type B is access not null Integer;
|
||||
type C is access constant Integer;
|
||||
type D is access all Integer;
|
||||
type E is access function return Boolean;
|
||||
type F is access protected function return Boolean;
|
||||
end;
|
||||
|
||||
-------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_specification
|
||||
(name
|
||||
(identifier))
|
||||
(type_declaration
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(type_definition
|
||||
(access_type_definition
|
||||
(access_to_object_definition
|
||||
(subtype_indication
|
||||
(name
|
||||
(identifier))))))))
|
||||
(type_declaration
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(type_definition
|
||||
(access_type_definition
|
||||
(access_to_object_definition
|
||||
(subtype_indication
|
||||
(null_exclusion)
|
||||
(name
|
||||
(identifier))))))))
|
||||
(type_declaration
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(type_definition
|
||||
(access_type_definition
|
||||
(access_to_object_definition
|
||||
(general_access_modifier)
|
||||
(subtype_indication
|
||||
(name
|
||||
(identifier))))))))
|
||||
(type_declaration
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(type_definition
|
||||
(access_type_definition
|
||||
(access_to_object_definition
|
||||
(general_access_modifier)
|
||||
(subtype_indication
|
||||
(name
|
||||
(identifier))))))))
|
||||
(type_declaration
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(type_definition
|
||||
(access_type_definition
|
||||
(access_to_subprogram_definition
|
||||
(parameter_and_result_profile
|
||||
(result_profile
|
||||
(name
|
||||
(identifier)))))))))
|
||||
(type_declaration
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(type_definition
|
||||
(access_type_definition
|
||||
(access_to_subprogram_definition
|
||||
(parameter_and_result_profile
|
||||
(result_profile
|
||||
(name
|
||||
(identifier))))))))))))
|
||||
85
corpus/renames.txt
Normal file
85
corpus/renames.txt
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
================================================================================
|
||||
Renames object
|
||||
================================================================================
|
||||
|
||||
procedure P is
|
||||
Threshold renames Global_Threshold;
|
||||
A : Integer renames B;
|
||||
CE : exception renames Constraint_Error;
|
||||
package TIO renames Ada.Text_IO;
|
||||
procedure Proc (A : Integer) renames Process;
|
||||
generic procedure Proc renames Generic_Process;
|
||||
begin
|
||||
null;
|
||||
end P;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(proper_body
|
||||
(subprogram_body
|
||||
(subprogram_specification
|
||||
(procedure_specification
|
||||
(name
|
||||
(identifier))))
|
||||
(non_empty_declarative_part
|
||||
(declarative_item_pragma
|
||||
(renaming_declaration
|
||||
(object_renaming_declaration
|
||||
(identifier)
|
||||
(name
|
||||
(identifier)))))
|
||||
(declarative_item_pragma
|
||||
(renaming_declaration
|
||||
(object_renaming_declaration
|
||||
(identifier)
|
||||
(name
|
||||
(identifier))
|
||||
(name
|
||||
(identifier)))))
|
||||
(declarative_item_pragma
|
||||
(renaming_declaration
|
||||
(exception_renaming_declaration
|
||||
(identifier)
|
||||
(name
|
||||
(identifier)))))
|
||||
(declarative_item_pragma
|
||||
(renaming_declaration
|
||||
(package_renaming_declaration
|
||||
(name
|
||||
(identifier))
|
||||
(name
|
||||
(identifier)
|
||||
(identifier)))))
|
||||
(declarative_item_pragma
|
||||
(renaming_declaration
|
||||
(subprogram_renaming_declaration
|
||||
(subprogram_specification
|
||||
(procedure_specification
|
||||
(name
|
||||
(identifier))
|
||||
(non_empty_parameter_profile
|
||||
(formal_part
|
||||
(parameter_specification_list
|
||||
(parameter_specification
|
||||
(defining_identifier_list
|
||||
(identifier))
|
||||
(name
|
||||
(identifier))))))))
|
||||
(name
|
||||
(identifier)))))
|
||||
(declarative_item_pragma
|
||||
(renaming_declaration
|
||||
(generic_renaming_declaration
|
||||
(name
|
||||
(identifier))
|
||||
(name
|
||||
(identifier))))))
|
||||
(handled_sequence_of_statements
|
||||
(sequence_of_statements
|
||||
(statement
|
||||
(simple_statement
|
||||
(null_statement)))))
|
||||
(name
|
||||
(identifier))))))
|
||||
94
grammar.js
94
grammar.js
|
|
@ -66,6 +66,13 @@ module.exports = grammar({
|
|||
|
||||
[$.attribute_definition_clause, $.attribute_reference],
|
||||
|
||||
// identifier . ':' ...
|
||||
[$.defining_identifier_list, $.object_renaming_declaration,
|
||||
$.exception_renaming_declaration],
|
||||
|
||||
// 'generic' . 'package' ...
|
||||
[$.generic_formal_part, $.generic_renaming_declaration],
|
||||
|
||||
// 'type' identifier 'is' 'new' subtype_indication . 'with'
|
||||
// which could be either a record_extension_part or
|
||||
// an aspect_specification.
|
||||
|
|
@ -1369,11 +1376,88 @@ module.exports = grammar({
|
|||
';',
|
||||
)),
|
||||
renaming_declaration: $ => choice(
|
||||
// $.object_renaming_declaration,
|
||||
// $.exception_renaming_declaration,
|
||||
// $.package_renaming_declaration,
|
||||
// $.subprogram_renaming_declaration,
|
||||
// $.generic_renaming_declaration,
|
||||
$.object_renaming_declaration,
|
||||
$.exception_renaming_declaration,
|
||||
$.package_renaming_declaration,
|
||||
$.subprogram_renaming_declaration,
|
||||
$.generic_renaming_declaration,
|
||||
),
|
||||
object_renaming_declaration: $ => choice(
|
||||
seq(
|
||||
$.identifier,
|
||||
optional(seq(
|
||||
':',
|
||||
optional($.null_exclusion),
|
||||
$.name,
|
||||
)),
|
||||
reservedWord('renames'),
|
||||
$.name,
|
||||
optional($.aspect_specification),
|
||||
';',
|
||||
),
|
||||
seq(
|
||||
$.identifier,
|
||||
':',
|
||||
$.access_definition,
|
||||
reservedWord('renames'),
|
||||
$.name,
|
||||
optional($.aspect_specification),
|
||||
';',
|
||||
),
|
||||
),
|
||||
exception_renaming_declaration: $ => seq(
|
||||
$.identifier,
|
||||
':',
|
||||
reservedWord('exception'),
|
||||
reservedWord('renames'),
|
||||
$.name,
|
||||
optional($.aspect_specification),
|
||||
';',
|
||||
),
|
||||
package_renaming_declaration: $ => seq(
|
||||
reservedWord('package'),
|
||||
$.name,
|
||||
reservedWord('renames'),
|
||||
$.name,
|
||||
optional($.aspect_specification),
|
||||
';',
|
||||
),
|
||||
subprogram_renaming_declaration: $ => seq(
|
||||
optional($.overriding_indicator),
|
||||
$.subprogram_specification,
|
||||
reservedWord('renames'),
|
||||
$.name,
|
||||
optional($.aspect_specification),
|
||||
';',
|
||||
),
|
||||
generic_renaming_declaration: $ => choice(
|
||||
seq(
|
||||
reservedWord('generic'),
|
||||
reservedWord('package'),
|
||||
$.name,
|
||||
reservedWord('renames'),
|
||||
$.name,
|
||||
optional($.aspect_specification),
|
||||
';',
|
||||
),
|
||||
seq(
|
||||
reservedWord('generic'),
|
||||
reservedWord('procedure'),
|
||||
$.name,
|
||||
reservedWord('renames'),
|
||||
$.name,
|
||||
optional($.aspect_specification),
|
||||
';',
|
||||
),
|
||||
seq(
|
||||
reservedWord('generic'),
|
||||
reservedWord('function'),
|
||||
$.name,
|
||||
reservedWord('renames'),
|
||||
$.name,
|
||||
optional($.aspect_specification),
|
||||
';',
|
||||
),
|
||||
),
|
||||
result_profile: $ => seq(
|
||||
reservedWord('return'),
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user