Add support for redefining operators
This commit is contained in:
parent
f32b258652
commit
4433fab200
|
|
@ -660,3 +660,49 @@ function F (A : My_Array) return Boolean
|
||||||
(factor
|
(factor
|
||||||
(primary
|
(primary
|
||||||
(numeric_literal)))))))))))))
|
(numeric_literal)))))))))))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Operators
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
overriding function "<" (Left, Right : My_Int) return Boolean is
|
||||||
|
begin
|
||||||
|
return False;
|
||||||
|
end "<";
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(compilation
|
||||||
|
(compilation_unit
|
||||||
|
(proper_body
|
||||||
|
(subprogram_body
|
||||||
|
(overriding_indicator)
|
||||||
|
(subprogram_specification
|
||||||
|
(function_specification
|
||||||
|
(string_literal)
|
||||||
|
(parameter_and_result_profile
|
||||||
|
(formal_part
|
||||||
|
(parameter_specification_list
|
||||||
|
(parameter_specification
|
||||||
|
(defining_identifier_list
|
||||||
|
(identifier)
|
||||||
|
(identifier))
|
||||||
|
(name
|
||||||
|
(identifier)))))
|
||||||
|
(result_profile
|
||||||
|
(name
|
||||||
|
(identifier))))))
|
||||||
|
(handled_sequence_of_statements
|
||||||
|
(sequence_of_statements
|
||||||
|
(statement
|
||||||
|
(simple_statement
|
||||||
|
(simple_return_statement
|
||||||
|
(expression
|
||||||
|
(relation
|
||||||
|
(simple_expression
|
||||||
|
(term
|
||||||
|
(factor
|
||||||
|
(primary
|
||||||
|
(name
|
||||||
|
(identifier)))))))))))))
|
||||||
|
(string_literal)))))
|
||||||
|
|
|
||||||
10
grammar.js
10
grammar.js
|
|
@ -382,7 +382,10 @@ module.exports = grammar({
|
||||||
reservedWord('begin'),
|
reservedWord('begin'),
|
||||||
$.handled_sequence_of_statements,
|
$.handled_sequence_of_statements,
|
||||||
reservedWord('end'),
|
reservedWord('end'),
|
||||||
optional($.name),
|
optional(choice(
|
||||||
|
$.name,
|
||||||
|
$.string_literal, // for operators
|
||||||
|
)),
|
||||||
';'
|
';'
|
||||||
),
|
),
|
||||||
package_body: $ => seq(
|
package_body: $ => seq(
|
||||||
|
|
@ -1257,7 +1260,10 @@ module.exports = grammar({
|
||||||
),
|
),
|
||||||
function_specification: $ => seq(
|
function_specification: $ => seq(
|
||||||
reservedWord('function'),
|
reservedWord('function'),
|
||||||
$.name,
|
choice(
|
||||||
|
$.name,
|
||||||
|
$.string_literal, // for operators
|
||||||
|
),
|
||||||
$.parameter_and_result_profile,
|
$.parameter_and_result_profile,
|
||||||
),
|
),
|
||||||
generic_declaration: $ => choice(
|
generic_declaration: $ => choice(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user