Implement .max and .min type properties
This commit is contained in:
@ -89,12 +89,6 @@ const {
|
||||
var {
|
||||
return yy::parser::make_VAR(this->location);
|
||||
}
|
||||
array {
|
||||
return yy::parser::make_ARRAY(this->location);
|
||||
}
|
||||
of {
|
||||
return yy::parser::make_OF(this->location);
|
||||
}
|
||||
type {
|
||||
return yy::parser::make_TYPE(this->location);
|
||||
}
|
||||
@ -104,12 +98,6 @@ record {
|
||||
union {
|
||||
return yy::parser::make_UNION(this->location);
|
||||
}
|
||||
pointer {
|
||||
return yy::parser::make_POINTER(this->location);
|
||||
}
|
||||
to {
|
||||
return yy::parser::make_TO(this->location);
|
||||
}
|
||||
true {
|
||||
return yy::parser::make_BOOLEAN(true, this->location);
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ along with GCC; see the file COPYING3. If not see
|
||||
%token <std::string> STRING "string"
|
||||
%token <bool> BOOLEAN
|
||||
%token IF WHILE DO THEN ELSE ELSIF RETURN
|
||||
%token CONST VAR PROCEDURE ARRAY OF TYPE RECORD POINTER TO UNION
|
||||
%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
|
||||
@ -118,7 +118,7 @@ along with GCC; see the file COPYING3. If not see
|
||||
%type <std::vector<elna::boot::type_definition *>> type_definitions type_part;
|
||||
%type <elna::boot::block *> block;
|
||||
%type <elna::boot::field_t> field_declaration;
|
||||
%type <std::vector<std::pair<std::string, std::shared_ptr<elna::boot::top_type>>>> field_list;
|
||||
%type <std::vector<std::pair<std::string, std::shared_ptr<elna::boot::top_type>>>> optional_fields fields;
|
||||
%type <std::vector<elna::boot::conditional_statements *>> elsif_statement_list;
|
||||
%type <elna::boot::cast_expression *> cast_expression;
|
||||
%type <elna::boot::defer_statement *> defer_statement;
|
||||
@ -414,9 +414,9 @@ statement:
|
||||
}
|
||||
| defer_statement { $$ = $1; }
|
||||
statements:
|
||||
statement SEMICOLON statements
|
||||
statement statements
|
||||
{
|
||||
std::swap($$, $3);
|
||||
std::swap($$, $2);
|
||||
$$.emplace($$.cbegin(), $1);
|
||||
}
|
||||
| statement { $$.push_back($1); }
|
||||
@ -425,27 +425,30 @@ optional_statements:
|
||||
| /* no statements */ {}
|
||||
field_declaration:
|
||||
IDENTIFIER COLON type_expression { $$ = std::make_pair($1, $3); }
|
||||
field_list:
|
||||
field_declaration field_list
|
||||
fields:
|
||||
field_declaration fields
|
||||
{
|
||||
std::swap($$, $2);
|
||||
$$.emplace($$.cbegin(), $1);
|
||||
}
|
||||
| field_declaration { $$.emplace_back($1); }
|
||||
optional_fields:
|
||||
fields { std::swap($$, $1); }
|
||||
| /* no fields */ {}
|
||||
type_expression:
|
||||
ARRAY INTEGER OF type_expression
|
||||
LEFT_SQUARE INTEGER RIGHT_SQUARE type_expression
|
||||
{
|
||||
$$ = std::make_shared<elna::boot::array_type>(elna::boot::make_position(@1), $4, $2);
|
||||
}
|
||||
| POINTER TO type_expression
|
||||
| HAT type_expression
|
||||
{
|
||||
$$ = std::make_shared<elna::boot::pointer_type>(elna::boot::make_position(@1), $3);
|
||||
$$ = std::make_shared<elna::boot::pointer_type>(elna::boot::make_position(@1), $2);
|
||||
}
|
||||
| RECORD field_list END_BLOCK
|
||||
| RECORD optional_fields END_BLOCK
|
||||
{
|
||||
$$ = std::make_shared<elna::boot::record_type>(elna::boot::make_position(@1), std::move($2));
|
||||
}
|
||||
| UNION field_list END_BLOCK
|
||||
| UNION fields END_BLOCK
|
||||
{
|
||||
$$ = std::make_shared<elna::boot::union_type>(elna::boot::make_position(@1), std::move($2));
|
||||
}
|
||||
|
Reference in New Issue
Block a user