Changeset 59c7e3e for src


Ignore:
Timestamp:
Oct 14, 2022, 2:25:32 PM (19 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, master
Children:
4465777
Parents:
05d499ac
Message:

parge va_arg as special case function

Location:
src/Parser
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/lex.ll

    r05d499ac r59c7e3e  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Tue Sep 20 21:18:55 2022
    13  * Update Count     : 762
     12 * Last Modified On : Thu Oct 13 20:46:04 2022
     13 * Update Count     : 764
    1414 */
    1515
     
    331331__uint128_t             { KEYWORD_RETURN(UINT128); }                    // GCC
    332332unsigned                { KEYWORD_RETURN(UNSIGNED); }
    333 __builtin_va_list { KEYWORD_RETURN(VALIST); }                   // GCC
     333__builtin_va_arg { KEYWORD_RETURN(VA_ARG); }                    // GCC
     334__builtin_va_list { KEYWORD_RETURN(VA_LIST); }                  // GCC
    334335virtual                 { KEYWORD_RETURN(VIRTUAL); }                    // CFA
    335336void                    { KEYWORD_RETURN(VOID); }
  • src/Parser/parser.yy

    r05d499ac r59c7e3e  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Oct  8 08:21:18 2022
    13 // Update Count     : 5709
     12// Last Modified On : Fri Oct 14 14:04:43 2022
     13// Update Count     : 5751
    1414//
    1515
     
    305305%token TYPEDEF
    306306%token EXTERN STATIC AUTO REGISTER
    307 %token THREADLOCALGCC THREADLOCALC11                                            // GCC, C11
     307%token THREADLOCALGCC THREADLOCALC11                                    // GCC, C11
    308308%token INLINE FORTRAN                                                                   // C99, extension ISO/IEC 9899:1999 Section J.5.9(1)
    309309%token NORETURN                                                                                 // C11
     
    318318%token DECIMAL32 DECIMAL64 DECIMAL128                                   // GCC
    319319%token ZERO_T ONE_T                                                                             // CFA
    320 %token SIZEOF TYPEOF VALIST AUTO_TYPE                                   // GCC
     320%token SIZEOF TYPEOF VA_LIST VA_ARG AUTO_TYPE                   // GCC
    321321%token OFFSETOF BASETYPEOF TYPEID                                               // CFA
    322322%token ENUM STRUCT UNION
     
    409409// declarations
    410410%type<decl> abstract_declarator abstract_ptr abstract_array abstract_function array_dimension multi_array_dimension
    411 %type<decl> abstract_parameter_declarator abstract_parameter_ptr abstract_parameter_array abstract_parameter_function array_parameter_dimension array_parameter_1st_dimension
     411%type<decl> abstract_parameter_declarator_opt abstract_parameter_declarator abstract_parameter_ptr abstract_parameter_array abstract_parameter_function array_parameter_dimension array_parameter_1st_dimension
    412412%type<decl> abstract_parameter_declaration
    413413
     
    698698        primary_expression
    699699        | postfix_expression '[' assignment_expression ',' tuple_expression_list ']'
    700                         // Historic, transitional: Disallow commas in subscripts.
    701                         // Switching to this behaviour may help check if a C compatibilty case uses comma-exprs in subscripts.
    702                         // Current: Commas in subscripts make tuples.
     700                // Historic, transitional: Disallow commas in subscripts.
     701                // Switching to this behaviour may help check if a C compatibilty case uses comma-exprs in subscripts.
     702                // Current: Commas in subscripts make tuples.
    703703                { $$ = new ExpressionNode( build_binary_val( OperKinds::Index, $1, new ExpressionNode( build_tuple( (ExpressionNode *)($3->set_last( $5 ) ) )) ) ); }
    704704        | postfix_expression '[' assignment_expression ']'
     
    720720        | postfix_expression '(' argument_expression_list_opt ')'
    721721                { $$ = new ExpressionNode( build_func( $1, $3 ) ); }
     722        | VA_ARG '(' primary_expression ',' declaration_specifier_nobody abstract_parameter_declarator_opt ')'
     723                // { SemanticError( yylloc, "va_arg is currently unimplemented." ); $$ = nullptr; }
     724                { $$ = new ExpressionNode( build_func( new ExpressionNode( build_varref( new string( "__builtin_va_arg") ) ),
     725                                                                                           (ExpressionNode *)($3->set_last( (ExpressionNode *)($6 ? $6->addType( $5 ) : $5) )) ) ); }
    722726        | postfix_expression '`' identifier                                     // CFA, postfix call
    723727                { $$ = new ExpressionNode( build_func( new ExpressionNode( build_varref( build_postfix_name( $3 ) ) ), $1 ) ); }
     
    21562160        | LONG
    21572161                { $$ = DeclarationNode::newLength( DeclarationNode::Long ); }
    2158         | VALIST                                                                                        // GCC, __builtin_va_list
     2162        | VA_LIST                                                                                       // GCC, __builtin_va_list
    21592163                { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Valist ); }
    21602164        | AUTO_TYPE
     
    36763680// functions.
    36773681
     3682abstract_parameter_declarator_opt:
     3683        // empty
     3684                { $$ = nullptr; }
     3685        | abstract_parameter_declarator
     3686        ;
     3687
    36783688abstract_parameter_declarator:
    36793689        abstract_parameter_ptr
Note: See TracChangeset for help on using the changeset viewer.