Ignore:
Timestamp:
Feb 17, 2021, 12:45:36 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
e7c077a
Parents:
5e99a9a (diff), 9fb1367 (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' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r5e99a9a r95b3a9c  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jan 27 08:58:56 2021
    13 // Update Count     : 4680
     12// Last Modified On : Wed Feb 17 09:03:07 2021
     13// Update Count     : 4722
    1414//
    1515
     
    282282%token ATTRIBUTE EXTENSION                                                              // GCC
    283283%token IF ELSE SWITCH CASE DEFAULT DO WHILE FOR BREAK CONTINUE GOTO RETURN
    284 %token CHOOSE DISABLE ENABLE FALLTHRU FALLTHROUGH TRY CATCH CATCHRESUME FINALLY THROW THROWRESUME AT WITH WHEN WAITFOR // CFA
     284%token CHOOSE DISABLE ENABLE FALLTHRU FALLTHROUGH TRY THROW THROWRESUME AT WITH WHEN WAITFOR // CFA
    285285%token ASM                                                                                              // C99, extension ISO/IEC 9899:1999 Section J.5.10(1)
    286286%token ALIGNAS ALIGNOF GENERIC STATICASSERT                             // C11
    287287
    288288// names and constants: lexer differentiates between identifier and typedef names
    289 %token<tok> IDENTIFIER                  QUOTED_IDENTIFIER               TYPEDEFname                             TYPEGENname
    290 %token<tok> TIMEOUT                             WOR
    291 %token<tok> INTEGERconstant             CHARACTERconstant               STRINGliteral
     289%token<tok> IDENTIFIER          QUOTED_IDENTIFIER       TYPEDEFname             TYPEGENname
     290%token<tok> TIMEOUT                     WOR                                     CATCH                   RECOVER                 CATCHRESUME             FIXUP           FINALLY         // CFA
     291%token<tok> INTEGERconstant     CHARACTERconstant       STRINGliteral
    292292%token<tok> DIRECTIVE
    293293// Floating point constant is broken into three kinds of tokens because of the ambiguity with tuple indexing and
     
    462462// Order of these lines matters (low-to-high precedence). THEN is left associative over WOR/TIMEOUT/ELSE, WOR is left
    463463// associative over TIMEOUT/ELSE, and TIMEOUT is left associative over ELSE.
    464 %precedence THEN        // rule precedence for IF/WAITFOR statement
    465 %precedence WOR         // token precedence for start of WOR in WAITFOR statement
    466 %precedence TIMEOUT     // token precedence for start of TIMEOUT in WAITFOR statement
    467 %precedence ELSE        // token precedence for start of else clause in IF/WAITFOR statement
     464%precedence THEN                // rule precedence for IF/WAITFOR statement
     465%precedence WOR                 // token precedence for start of WOR in WAITFOR statement
     466%precedence TIMEOUT             // token precedence for start of TIMEOUT in WAITFOR statement
     467%precedence CATCH               // token precedence for start of TIMEOUT in WAITFOR statement
     468%precedence RECOVER             // token precedence for start of TIMEOUT in WAITFOR statement
     469%precedence CATCHRESUME // token precedence for start of TIMEOUT in WAITFOR statement
     470%precedence FIXUP               // token precedence for start of TIMEOUT in WAITFOR statement
     471%precedence FINALLY             // token precedence for start of TIMEOUT in WAITFOR statement
     472%precedence ELSE                // token precedence for start of else clause in IF/WAITFOR statement
     473
    468474
    469475// Handle shift/reduce conflict for generic type by shifting the '(' token. For example, this string is ambiguous:
     
    544550        TIMEOUT
    545551        | WOR
     552        | CATCH
     553        | RECOVER
     554        | CATCHRESUME
     555        | FIXUP
     556        | FINALLY
    546557        ;
    547558
     
    618629postfix_expression:
    619630        primary_expression
     631        | postfix_expression '[' assignment_expression ',' comma_expression ']'
     632                // { $$ = new ExpressionNode( build_binary_val( OperKinds::Index, $1, new ExpressionNode( build_binary_val( OperKinds::Index, $3, $5 ) ) ) ); }
     633                { SemanticError( yylloc, "New array subscript is currently unimplemented." ); $$ = nullptr; }
    620634        | postfix_expression '[' assignment_expression ']'
    621635                // CFA, comma_expression disallowed in this context because it results in a common user error: subscripting a
     
    13631377
    13641378exception_statement:
    1365         TRY compound_statement handler_clause
     1379        TRY compound_statement handler_clause                                   %prec THEN
    13661380                { $$ = new StatementNode( build_try( $2, $3, 0 ) ); }
    13671381        | TRY compound_statement finally_clause
     
    13861400handler_key:
    13871401        CATCH                                                                           { $$ = CatchStmt::Terminate; }
     1402        | RECOVER                                                                       { $$ = CatchStmt::Terminate; }
    13881403        | CATCHRESUME                                                           { $$ = CatchStmt::Resume; }
     1404        | FIXUP                                                                         { $$ = CatchStmt::Resume; }
    13891405        ;
    13901406
     
    31873203        | '[' ']' multi_array_dimension
    31883204                { $$ = DeclarationNode::newArray( 0, 0, false )->addArray( $3 ); }
     3205        | '[' push assignment_expression pop ',' comma_expression ']'
     3206                { $$ = DeclarationNode::newArray( $3, 0, false )->addArray( DeclarationNode::newArray( $6, 0, false ) ); }
     3207                // { SemanticError( yylloc, "New array dimension is currently unimplemented." ); $$ = nullptr; }
    31893208        | multi_array_dimension
    31903209        ;
Note: See TracChangeset for help on using the changeset viewer.