Implement noreturn procedure declarations
This commit is contained in:
@ -419,7 +419,13 @@ namespace boot
|
||||
|
||||
procedure_definition::procedure_definition(const struct position position, const std::string& identifier,
|
||||
const bool exported, std::shared_ptr<top_type> return_type)
|
||||
: definition(position, identifier, exported), m_return_type(return_type)
|
||||
: definition(position, identifier, exported), m_return_type(return_type), no_return{ false }
|
||||
{
|
||||
}
|
||||
|
||||
procedure_definition::procedure_definition(const struct position position, const std::string& identifier,
|
||||
const bool exported, no_return_t)
|
||||
: definition(position, identifier, exported), m_return_type(nullptr), no_return{ true }
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -280,6 +280,9 @@ defer {
|
||||
@ {
|
||||
return yy::parser::make_AT(this->location);
|
||||
}
|
||||
! {
|
||||
return yy::parser::make_EXCLAMATION(this->location);
|
||||
}
|
||||
. {
|
||||
std::stringstream ss;
|
||||
|
||||
|
@ -85,13 +85,12 @@ along with GCC; see the file COPYING3. If not see
|
||||
%token CONST VAR PROCEDURE TYPE RECORD UNION
|
||||
%token BEGIN_BLOCK END_BLOCK EXTERN DEFER
|
||||
%token LEFT_PAREN RIGHT_PAREN LEFT_SQUARE RIGHT_SQUARE SEMICOLON DOT COMMA
|
||||
%token AND OR NOT CAST SHIFT_LEFT SHIFT_RIGHT
|
||||
%token GREATER_EQUAL LESS_EQUAL LESS_THAN GREATER_THAN NOT_EQUAL EQUALS
|
||||
%token PLUS MINUS MULTIPLICATION DIVISION REMAINDER
|
||||
%token NOT CAST EXCLAMATION
|
||||
%token ASSIGNMENT COLON HAT AT NIL ARROW
|
||||
|
||||
%left OR AND XOR
|
||||
%left EQUALS NOT_EQUAL LESS_THAN GREATER_THAN LESS_EQUAL GREATER_EQUAL
|
||||
%left SHIFT_LEFT SHIFT_RIGHT
|
||||
%left PLUS MINUS
|
||||
%left MULTIPLICATION DIVISION REMAINDER
|
||||
|
||||
@ -169,6 +168,12 @@ procedure_heading:
|
||||
$2.first, $2.second);
|
||||
std::swap($3, $$->parameters);
|
||||
}
|
||||
| PROCEDURE identifier_definition formal_parameter_list ARROW EXCLAMATION SEMICOLON
|
||||
{
|
||||
$$ = new elna::boot::procedure_definition(elna::boot::make_position(@1),
|
||||
$2.first, $2.second, elna::boot::procedure_definition::no_return_t{});
|
||||
std::swap($3, $$->parameters);
|
||||
}
|
||||
| PROCEDURE identifier_definition formal_parameter_list ARROW type_expression SEMICOLON
|
||||
{
|
||||
$$ = new elna::boot::procedure_definition(elna::boot::make_position(@1),
|
||||
|
Reference in New Issue
Block a user