Ignore:
Timestamp:
Feb 20, 2020, 4:15:51 PM (6 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
6a490b2
Parents:
dca5802 (diff), 2cbfe92 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into relaxed_ready

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    rdca5802 rb7d6a36  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Dec 10 23:07:17 2019
    13 // Update Count     : 4400
     12// Last Modified On : Sun Feb 16 08:22:14 2020
     13// Update Count     : 4461
    1414//
    1515
     
    5555#include "TypedefTable.h"
    5656#include "TypeData.h"
    57 #include "LinkageSpec.h"
     57#include "SynTree/LinkageSpec.h"
    5858#include "Common/SemanticError.h"                                               // error_str
    5959#include "Common/utility.h"                                                             // for maybeMoveBuild, maybeBuild, CodeLo...
     
    166166} // rebindForall
    167167
    168 NameExpr * build_postfix_name( const string * name ) {
    169         NameExpr * new_name = build_varref( new string( "?`" + *name ) );
    170         delete name;
    171         return new_name;
     168string * build_postfix_name( string * name ) {
     169        *name = string("__postfix_func_") + *name;
     170        return name;
    172171} // build_postfix_name
    173172
     
    238237        DeclarationNode * decl;
    239238        AggregateDecl::Aggregate aggKey;
    240         DeclarationNode::TypeClass tclass;
     239        TypeDecl::Kind tclass;
    241240        StatementNode * sn;
    242241        WaitForStmt * wfs;
     
    323322%type<op> ptrref_operator                               unary_operator                          assignment_operator
    324323%type<en> primary_expression                    postfix_expression                      unary_expression
    325 %type<en> cast_expression                               exponential_expression          multiplicative_expression       additive_expression
     324%type<en> cast_expression_list                  cast_expression                         exponential_expression          multiplicative_expression       additive_expression
    326325%type<en> shift_expression                              relational_expression           equality_expression
    327326%type<en> AND_expression                                exclusive_OR_expression         inclusive_OR_expression
     
    579578        | '(' compound_statement ')'                                            // GCC, lambda expression
    580579                { $$ = new ExpressionNode( new StmtExpr( dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >($2) ) ) ); }
    581         | constant '`' IDENTIFIER                                                       // CFA, postfix call
    582                 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), $1 ) ); }
    583         | string_literal '`' IDENTIFIER                                         // CFA, postfix call
    584                 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), new ExpressionNode( $1 ) ) ); }
    585         | IDENTIFIER '`' IDENTIFIER                                                     // CFA, postfix call
    586                 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), new ExpressionNode( build_varref( $1 ) ) ) ); }
    587         | tuple '`' IDENTIFIER                                                          // CFA, postfix call
    588                 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), $1 ) ); }
    589         | '(' comma_expression ')' '`' IDENTIFIER                       // CFA, postfix call
    590                 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $5 ) ), $2 ) ); }
    591580        | type_name '.' identifier                                                      // CFA, nested type
    592581                { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; }
     
    642631        | postfix_expression '(' argument_expression_list ')'
    643632                { $$ = new ExpressionNode( build_func( $1, $3 ) ); }
     633        | postfix_expression '`' identifier                                     // CFA, postfix call
     634                { $$ = new ExpressionNode( build_func( new ExpressionNode( build_varref( build_postfix_name( $3 ) ) ), $1 ) ); }
     635        | constant '`' identifier                                                       // CFA, postfix call
     636                { $$ = new ExpressionNode( build_func( new ExpressionNode( build_varref( build_postfix_name( $3 ) ) ), $1 ) ); }
     637        | string_literal '`' identifier                                         // CFA, postfix call
     638                { $$ = new ExpressionNode( build_func( new ExpressionNode( build_varref( build_postfix_name( $3 ) ) ), new ExpressionNode( $1 ) ) ); }
    644639        | postfix_expression '.' identifier
    645640                { $$ = new ExpressionNode( build_fieldSel( $1, build_varref( $3 ) ) ); }
     
    666661        | '(' type_no_function ')' '@' '{' initializer_list_opt comma_opt '}' // CFA, explicit C compound-literal
    667662                { $$ = new ExpressionNode( build_compoundLiteral( $2, (new InitializerNode( $6, true ))->set_maybeConstructed( false ) ) ); }
    668         | '^' primary_expression '{' argument_expression_list '}' // CFA
     663        | '^' primary_expression '{' argument_expression_list '}' // CFA, destructor call
    669664                {
    670665                        Token fn;
     
    679674        | argument_expression
    680675        | argument_expression_list ',' argument_expression
    681                 { $$ = (ExpressionNode *)( $1->set_last( $3 )); }
     676                { $$ = (ExpressionNode *)($1->set_last( $3 )); }
    682677        ;
    683678
     
    691686field_name_list:                                                                                // CFA, tuple field selector
    692687        field
    693         | field_name_list ',' field                                     { $$ = (ExpressionNode *)$1->set_last( $3 ); }
     688        | field_name_list ',' field                                     { $$ = (ExpressionNode *)($1->set_last( $3 )); }
    694689        ;
    695690
     
    960955                { $$ = new ExpressionNode( build_tuple( (ExpressionNode *)(new ExpressionNode( nullptr ) )->set_last( $3 ) ) ); }
    961956        | '[' push assignment_expression pop ',' tuple_expression_list ']'
    962                 { $$ = new ExpressionNode( build_tuple( (ExpressionNode *)$3->set_last( $6 ) ) ); }
     957                { $$ = new ExpressionNode( build_tuple( (ExpressionNode *)($3->set_last( $6 ) ) )); }
    963958        ;
    964959
     
    966961        assignment_expression_opt
    967962        | tuple_expression_list ',' assignment_expression_opt
    968                 { $$ = (ExpressionNode *)$1->set_last( $3 ); }
     963                { $$ = (ExpressionNode *)($1->set_last( $3 )); }
    969964        ;
    970965
     
    11901185                { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ),
    11911186                                                OperKinds::LThan, $1->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
     1187        | '=' comma_expression                                                                  // CFA
     1188                { $$ = forCtrl( $2, new string( DeclarationNode::anonymous.newName() ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ),
     1189                                                OperKinds::LEThan, $2->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
    11921190        | comma_expression inclexcl comma_expression            // CFA
    11931191                { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $2, $3, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
     
    11971195                { $$ = forCtrl( $3, $1, new ExpressionNode( build_constantInteger( *new string( "0" ) ) ),
    11981196                                                OperKinds::LThan, $3->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
     1197        | comma_expression ';' '=' comma_expression                             // CFA
     1198                { $$ = forCtrl( $4, $1, new ExpressionNode( build_constantInteger( *new string( "0" ) ) ),
     1199                                                OperKinds::LEThan, $4->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
    11991200        | comma_expression ';' comma_expression inclexcl comma_expression // CFA
    12001201                { $$ = forCtrl( $3, $1, $3->clone(), $4, $5, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
     
    13011302        WAITFOR '(' cast_expression ')'
    13021303                { $$ = $3; }
    1303         | WAITFOR '(' cast_expression ',' argument_expression_list ')'
    1304                 { $$ = (ExpressionNode *)$3->set_last( $5 ); }
     1304//      | WAITFOR '(' cast_expression ',' argument_expression_list ')'
     1305//              { $$ = (ExpressionNode *)$3->set_last( $5 ); }
     1306        | WAITFOR '(' cast_expression_list ':' argument_expression_list ')'
     1307                { $$ = (ExpressionNode *)($3->set_last( $5 )); }
     1308        ;
     1309
     1310cast_expression_list:
     1311        cast_expression
     1312        | cast_expression_list ',' cast_expression
     1313                { $$ = (ExpressionNode *)($1->set_last( $3 )); }
    13051314        ;
    13061315
     
    14131422        asm_operand
    14141423        | asm_operands_list ',' asm_operand
    1415                 { $$ = (ExpressionNode *)$1->set_last( $3 ); }
     1424                { $$ = (ExpressionNode *)($1->set_last( $3 )); }
    14161425        ;
    14171426
     
    14291438                { $$ = new ExpressionNode( $1 ); }
    14301439        | asm_clobbers_list_opt ',' string_literal
    1431                 // set_last returns ParseNode *
    1432                 { $$ = (ExpressionNode *)$1->set_last( new ExpressionNode( $3 ) ); }
     1440                { $$ = (ExpressionNode *)($1->set_last( new ExpressionNode( $3 ) )); }
    14331441        ;
    14341442
     
    23532361        | initializer_list_opt ',' initializer          { $$ = (InitializerNode *)( $1->set_last( $3 ) ); }
    23542362        | initializer_list_opt ',' designation initializer
    2355                 { $$ = (InitializerNode *)( $1->set_last( $4->set_designators( $3 ) ) ); }
     2363                { $$ = (InitializerNode *)($1->set_last( $4->set_designators( $3 ) )); }
    23562364        ;
    23572365
     
    23752383        designator
    23762384        | designator_list designator
    2377                 { $$ = (ExpressionNode *)( $1->set_last( $2 ) ); }
     2385                { $$ = (ExpressionNode *)($1->set_last( $2 )); }
    23782386        //| designator_list designator                                          { $$ = new ExpressionNode( $1, $2 ); }
    23792387        ;
     
    24312439        | type_specifier identifier_parameter_declarator
    24322440        | assertion_list
    2433                 { $$ = DeclarationNode::newTypeParam( DeclarationNode::Dtype, new string( DeclarationNode::anonymous.newName() ) )->addAssertions( $1 ); }
     2441                { $$ = DeclarationNode::newTypeParam( TypeDecl::Dtype, new string( DeclarationNode::anonymous.newName() ) )->addAssertions( $1 ); }
    24342442        ;
    24352443
    24362444type_class:                                                                                             // CFA
    24372445        OTYPE
    2438                 { $$ = DeclarationNode::Otype; }
     2446                { $$ = TypeDecl::Otype; }
    24392447        | DTYPE
    2440                 { $$ = DeclarationNode::Dtype; }
     2448                { $$ = TypeDecl::Dtype; }
    24412449        | FTYPE
    2442                 { $$ = DeclarationNode::Ftype; }
     2450                { $$ = TypeDecl::Ftype; }
    24432451        | TTYPE
    2444                 { $$ = DeclarationNode::Ttype; }
     2452                { $$ = TypeDecl::Ttype; }
    24452453        ;
    24462454
     
    24722480                { SemanticError( yylloc, toString("Expression generic parameters are currently unimplemented: ", $1->build()) ); $$ = nullptr; }
    24732481        | type_list ',' type
    2474                 { $$ = (ExpressionNode *)( $1->set_last( new ExpressionNode( new TypeExpr( maybeMoveBuildType( $3 ) ) ) ) ); }
     2482                { $$ = (ExpressionNode *)($1->set_last( new ExpressionNode( new TypeExpr( maybeMoveBuildType( $3 ) ) ) )); }
    24752483        | type_list ',' assignment_expression
    24762484                { SemanticError( yylloc, toString("Expression generic parameters are currently unimplemented: ", $3->build()) ); $$ = nullptr; }
     
    25832591                {
    25842592                        linkageStack.push( linkage );                           // handle nested extern "C"/"Cforall"
    2585                         linkage = LinkageSpec::linkageUpdate( yylloc, linkage, $2 );
     2593                        linkage = LinkageSpec::update( yylloc, linkage, $2 );
    25862594                }
    25872595          '{' up external_definition_list_opt down '}'
Note: See TracChangeset for help on using the changeset viewer.