diff --git a/corpus/subprograms.txt b/corpus/subprograms.txt index a12ff52..8f65196 100644 --- a/corpus/subprograms.txt +++ b/corpus/subprograms.txt @@ -660,3 +660,49 @@ function F (A : My_Array) return Boolean (factor (primary (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))))) diff --git a/grammar.js b/grammar.js index 9167c6f..14d9bcd 100644 --- a/grammar.js +++ b/grammar.js @@ -382,7 +382,10 @@ module.exports = grammar({ reservedWord('begin'), $.handled_sequence_of_statements, reservedWord('end'), - optional($.name), + optional(choice( + $.name, + $.string_literal, // for operators + )), ';' ), package_body: $ => seq( @@ -1257,7 +1260,10 @@ module.exports = grammar({ ), function_specification: $ => seq( reservedWord('function'), - $.name, + choice( + $.name, + $.string_literal, // for operators + ), $.parameter_and_result_profile, ), generic_declaration: $ => choice(