Changeset 948fdef


Ignore:
Timestamp:
Feb 1, 2020, 1:27:09 PM (4 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
33a484f
Parents:
c334ecd
Message:

change backquotes identifiers to xxx syntax, change priority of postfix function call

Files:
9 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/stdhdr/bfdlink.h

    rc334ecd r948fdef  
    1010// Created On       : Tue Jul 18 07:26:04 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Jul 22 13:49:30 2018
    13 // Update Count     : 4
     12// Last Modified On : Sat Feb  1 07:15:29 2020
     13// Update Count     : 5
    1414//
    1515
    1616// include file uses the CFA keyword "with".
    1717#if ! defined( with )                                                                   // nesting ?
    18 #define with `with`                                                                             // make keyword an identifier
     18#define with ``with``                                                                   // make keyword an identifier
    1919#define __CFA_BFDLINK_H__
    2020#endif
  • libcfa/src/stdhdr/hwloc.h

    rc334ecd r948fdef  
    1010// Created On       : Tue Jul 18 07:45:00 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Jul 22 13:49:58 2018
    13 // Update Count     : 4
     12// Last Modified On : Sat Feb  1 07:15:39 2020
     13// Update Count     : 5
    1414//
    1515
    1616// include file uses the CFA keyword "thread".
    1717#if ! defined( thread )                                                                 // nesting ?
    18 #define thread `thread`                                                                 // make keyword an identifier
     18#define thread ``thread``                                                               // make keyword an identifier
    1919#define __CFA_HWLOC_H__
    2020#endif
  • libcfa/src/stdhdr/krb5.h

    rc334ecd r948fdef  
    1010// Created On       : Tue Jul 18 07:55:44 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Jul 22 13:50:24 2018
    13 // Update Count     : 4
     12// Last Modified On : Sat Feb  1 07:15:47 2020
     13// Update Count     : 5
    1414//
    1515
    1616// include file uses the CFA keyword "enable".
    1717#if ! defined( enable )                                                                 // nesting ?
    18 #define enable `enable`                                                                 // make keyword an identifier
     18#define enable ``enable``                                                               // make keyword an identifier
    1919#define __CFA_KRB5_H__
    2020#endif
  • libcfa/src/stdhdr/math.h

    rc334ecd r948fdef  
    1010// Created On       : Mon Jul  4 23:25:26 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb 22 18:16:07 2018
    13 // Update Count     : 13
     12// Last Modified On : Sat Feb  1 07:15:58 2020
     13// Update Count     : 14
    1414//
    1515
    1616extern "C" {
    1717#if ! defined( exception )                                                              // nesting ?
    18 #define exception `exception`                                                   // make keyword an identifier
     18#define exception ``exception``                                                 // make keyword an identifier
    1919#define __CFA_MATH_H__
    2020#endif
  • libcfa/src/stdhdr/sys/ucontext.h

    rc334ecd r948fdef  
    1010// Created On       : Thu Feb  8 23:48:16 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb  8 23:50:44 2018
    13 // Update Count     : 4
     12// Last Modified On : Sat Feb  1 07:16:05 2020
     13// Update Count     : 5
    1414//
    1515
    1616#if ! defined( ftype )                                                                  // nesting ?
    17 #define ftype `ftype`                                                                   // make keyword an identifier
     17#define ftype ``ftype``                                                                 // make keyword an identifier
    1818#define __CFA_UCONTEXT_H__
    1919#endif
  • src/Parser/lex.ll

    rc334ecd r948fdef  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Sun Aug  4 20:53:47 2019
    13  * Update Count     : 719
     12 * Last Modified On : Sat Feb  1 07:16:44 2020
     13 * Update Count     : 724
    1414 */
    1515
     
    330330                                /* identifier */
    331331{identifier}    { IDENTIFIER_RETURN(); }
    332 "`"{identifier}"`" {                                                                    // CFA
    333         yytext[yyleng - 1] = '\0'; yytext += 1;                         // SKULLDUGGERY: remove backquotes (ok to shorten?)
     332"``"{identifier}"``" {                                                                  // CFA
     333        yytext[yyleng - 2] = '\0'; yytext += 2;                         // SKULLDUGGERY: remove backquotes (ok to shorten?)
    334334        IDENTIFIER_RETURN();
    335335}
  • src/Parser/parser.yy

    rc334ecd r948fdef  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jan 17 14:54:55 2020
    13 // Update Count     : 4426
     12// Last Modified On : Sat Feb  1 10:04:40 2020
     13// Update Count     : 4440
    1414//
    1515
     
    579579        | '(' compound_statement ')'                                            // GCC, lambda expression
    580580                { $$ = 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 ) ); }
    591581        | type_name '.' identifier                                                      // CFA, nested type
    592582                { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; }
     
    642632        | postfix_expression '(' argument_expression_list ')'
    643633                { $$ = new ExpressionNode( build_func( $1, $3 ) ); }
     634        | postfix_expression '`' identifier                                     // CFA, postfix call
     635                { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), $1 ) ); }
     636        | constant '`' identifier                                                       // CFA, postfix call
     637                { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), $1 ) ); }
     638        | string_literal '`' identifier                                         // CFA, postfix call
     639                { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), new ExpressionNode( $1 ) ) ); }
    644640        | postfix_expression '.' identifier
    645641                { $$ = new ExpressionNode( build_fieldSel( $1, build_varref( $3 ) ) ); }
     
    666662        | '(' type_no_function ')' '@' '{' initializer_list_opt comma_opt '}' // CFA, explicit C compound-literal
    667663                { $$ = new ExpressionNode( build_compoundLiteral( $2, (new InitializerNode( $6, true ))->set_maybeConstructed( false ) ) ); }
    668         | '^' primary_expression '{' argument_expression_list '}' // CFA
     664        | '^' primary_expression '{' argument_expression_list '}' // CFA, destructor call
    669665                {
    670666                        Token fn;
  • tests/expression.cfa

    rc334ecd r948fdef  
     1struct S { int i; };
     2void ?{}( S & s, int i ) {}
     3int ?`mary( int );
     4int ?`mary( S );
     5[int] ?`mary( [int, int] );
     6int jack( int );
     7
    18int main() {
    2     struct s { int i; } x, *p = &x;
    3     int i = 3;
     9    int a[3] = { 0, 0, 0 };
     10    S s = { 3 }, * ps = &s;
     11    [int] t;
     12    * [int] pt = &t;
     13    int i = 3, j = 4;
    414
    515    // operators
     
    919    +i;
    1020    -i;
    11     *p;
    12     ++p;
    13     --p;
    14     p++;
    15     p--;
     21    *ps;
     22    ++ps;
     23    --ps;
     24    ps++;
     25    ps--;
    1626
    17     i+i;
    18     i-i;
    19     i*i;
     27    i+j;
     28    i-j;
     29    i*j;
    2030
    21     i/i;
    22     i%i;
    23     i^i;
    24     i&i;
    25     i|i;
    26     i<i;
    27     i>i;
    28     i=i;
     31    i/j;
     32    i%j;
     33    i^j;
     34    i&j;
     35    i|j;
     36    i<j;
     37    i>j;
     38    i=j;
    2939
    30     i==i;
    31     i!=i;
    32     i<<i;
    33     i>>i;
    34     i<=i;
    35     i>=i;
    36     i&&i;
    37     i||i;
    38     p->i;
    39     i*=i;
    40     i/=i;
    41     i%=i;
    42     i+=i;
    43     i-=i;
    44     i&=i;
    45     i|=i;
    46     i^=i;
    47     i<<=i;
    48     i>>=i;
     40    i==j;
     41    i!=j;
     42    i<<j;
     43    i>>j;
     44    i<=j;
     45    i>=j;
     46    i&&j;
     47    i||j;
     48    ps->i;
    4949
    50     i?i:i;
     50    i*=j;
     51    i/=j;
     52    i%=j;
     53    i+=j;
     54    i-=j;
     55    i&=j;
     56    i|=j;
     57    i^=j;
     58    i<<=j;
     59    i>>=j;
     60
     61    i?i:j;
     62
     63    // postfix function call
     64
     65    (3 + 4)`mary;
     66    ({3 + 4;})`mary;
     67    [3, 4]`mary;
     68    3`mary;
     69    a[0]`mary;
     70    a[0]`mary`mary;
     71    s{0}`mary;
     72    jack(3)`mary;
     73    s.i`mary;
     74    t.0`mary;
     75    s.[i]`mary;
     76    ps->i`mary;
     77    pt->0`mary;
     78    ps->[i]`mary;
     79    i++`mary;
     80    i--`mary;
     81    (S){2}`mary;
     82    (S)@{2}`mary;
    5183} // main
  • tests/quotedKeyword.cfa

    rc334ecd r948fdef  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Dec  4 21:45:53 2018
    13 // Update Count     : 23
     12// Last Modified On : Sat Feb  1 00:02:22 2020
     13// Update Count     : 24
    1414//
    1515
     
    1717
    1818struct {
    19         int `otype`;
    20         int `struct`;
     19        int ``otype``;
     20        int ``struct``;
    2121} st = { 10, 10 };
    2222
    23 typedef int `forall`;
    24 `forall` xxx = 10;
     23typedef int ``forall``;
     24``forall`` xxx = 10;
    2525
    26 int `_Alignas`, `_Alignof`, `__alignof`, `__alignof__`, `asm`, `__asm`, `__asm__`, `_At`, `_Atomic`, `__attribute`,
    27         `__attribute__`, `auto`, `_Bool`, `break`, `case`, `catch`, `catchResume`, `char`, `choose`, `_Complex`, `__complex`,
    28         `__complex__`, `const`, `__const`, `__const__`, `continue`, `default`, `disable`, `do`, `double`, `dtype`, `else`,
    29         `enable`, `enum`, `__extension__`, `extern`, `fallthru`, `finally`, `float`, `__float128`, `for`, `forall`, `fortran`,
    30         `ftype`, `_Generic`, `goto`, `if`, `_Imaginary`, `__imag`, `__imag__`, `inline`, `__inline`, `__inline__`, `int`,
    31         `__int128`, `__label__`, `long`, `lvalue`, `_Noreturn`, `__builtin_offsetof`, `otype`, `register`, `restrict`,
    32         `__restrict`, `__restrict__`, `return`, `short`, `signed`, `__signed`, `__signed__`, `sizeof`, `static`,
    33         `_Static_assert`, `struct`, `switch`, `_Thread_local`, `throw`, `throwResume`, `trait`, `try`, `typedef`,
    34         `typeof`, `__typeof`, `__typeof__`, `union`, `unsigned`, `__builtin_va_list`, `void`, `volatile`, `__volatile`,
    35         `__volatile__`, `while`;
     26int ``_Alignas``, ``_Alignof``, ``__alignof``, ``__alignof__``, ``asm``, ``__asm``, ``__asm__``, ``_At``, ``_Atomic``, ``__attribute``,
     27        ``__attribute__``, ``auto``, ``_Bool``, ``break``, ``case``, ``catch``, ``catchResume``, ``char``, ``choose``, ``_Complex``, ``__complex``,
     28        ``__complex__``, ``const``, ``__const``, ``__const__``, ``continue``, ``default``, ``disable``, ``do``, ``double``, ``dtype``, ``else``,
     29        ``enable``, ``enum``, ``__extension__``, ``extern``, ``fallthru``, ``finally``, ``float``, ``__float128``, ``for``, ``forall``, ``fortran``,
     30        ``ftype``, ``_Generic``, ``goto``, ``if``, ``_Imaginary``, ``__imag``, ``__imag__``, ``inline``, ``__inline``, ``__inline__``, ``int``,
     31        ``__int128``, ``__label__``, ``long``, ``lvalue``, ``_Noreturn``, ``__builtin_offsetof``, ``otype``, ``register``, ``restrict``,
     32        ``__restrict``, ``__restrict__``, ``return``, ``short``, ``signed``, ``__signed``, ``__signed__``, ``sizeof``, ``static``,
     33        ``_Static_assert``, ``struct``, ``switch``, ``_Thread_local``, ``throw``, ``throwResume``, ``trait``, ``try``, ``typedef``,
     34        ``typeof``, ``__typeof``, ``__typeof__``, ``union``, ``unsigned``, ``__builtin_va_list``, ``void``, ``volatile``, ``__volatile``,
     35        ``__volatile__``, ``while``;
    3636
    3737int main() {
    38         int `if` = 0;
    39         `catch` = 1;
    40         st.`otype` = 2;
    41         st.`struct` = 3;
    42         `throw` = 4;
    43         sout | `catch` + st.`otype` + st.`struct` + `throw`;
     38        int ``if`` = 0;
     39        ``catch`` = 1;
     40        st.``otype`` = 2;
     41        st.``struct`` = 3;
     42        ``throw`` = 4;
     43        sout | ``catch`` + st.``otype`` + st.``struct`` + ``throw``;
    4444}
    4545
Note: See TracChangeset for help on using the changeset viewer.