diff options
Diffstat (limited to 'boot/parser.yy')
| -rw-r--r-- | boot/parser.yy | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/boot/parser.yy b/boot/parser.yy index 855cc76..9628443 100644 --- a/boot/parser.yy +++ b/boot/parser.yy @@ -95,7 +95,6 @@ along with GCC; see the file COPYING3. If not see COLON ":" SEMICOLON ";" DOT "." COMMA "," %token PROGRAM "program" MODULE "module" CAST "cast" - NIL "nil" CONST "const" VAR "var" THREADVAR "threadvar" PROCEDURE "proc" @@ -156,8 +155,8 @@ along with GCC; see the file COPYING3. If not see %type <std::vector<elna::boot::conditional_statements>> elsif_then_statements elsif_do_statements;; %type <std::unique_ptr<elna::boot::block>> else_statements block; %type <std::unique_ptr<elna::boot::identifier>> identifier with_counter; -%type <std::unique_ptr<elna::boot::identifier_definition>> identifier_definition attributed_identifier; -%type <std::vector<elna::boot::identifier_definition>> identifier_definitions; +%type <std::unique_ptr<elna::boot::identifier_definition>> identifier_definition attributed_identifier field_identifier; +%type <std::vector<elna::boot::identifier_definition>> identifier_definitions field_identifiers; %type <std::unique_ptr<elna::boot::attribute>> attribute; %type <std::vector<elna::boot::attribute>> attributes; %type <std::pair<std::vector<std::string>, bool>> import_declaration; @@ -406,11 +405,6 @@ literal: $$ = new boot::literal<std::uint32_t>(boot::make_position(@$), $1, boot::integer_sign::_unsigned); } - | "nil" - { - $$ = new boot::literal<std::nullptr_t>(boot::make_position(@$), - nullptr, boot::integer_sign::_unsigned); - } | STRING { $$ = new boot::literal<std::string>(boot::make_position(@$), @@ -631,8 +625,21 @@ statements: $$.insert($$.cend(), $3); } | statement { $$.push_back($1); } +field_identifier: + IDENTIFIER attributes + { + $$ = std::make_unique<boot::identifier_definition>($1, boot::make_position(@1), + false, std::vector<boot::identifier>{}, std::move($2)); + } +field_identifiers: + field_identifier "," field_identifiers + { + $$ = $3; + $$.emplace($$.cbegin(), std::move(*$1)); + } + | field_identifier { $$.emplace_back(std::move(*$1)); } field_declaration: - identifier_definitions ":" type_expression + field_identifiers ":" type_expression { $$ = std::make_pair($1, std::shared_ptr<boot::type_expression>($3)); } field_declarations: field_declaration ";" field_declarations |
