Ignore:
Timestamp:
Jun 6, 2015, 11:38:58 PM (9 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
cd623a4
Parents:
a65d92e
Message:

constant types, first attempt

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    ra65d92e r59db689  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jun  4 21:38:06 2015
    13 // Update Count     : 1021
     12// Last Modified On : Sat Jun  6 20:18:36 2015
     13// Update Count     : 1026
    1414//
    1515
     
    295295                // ENUMERATIONconstant is not included here; it is treated as a variable with type
    296296                // "enumeration constant".
    297         INTEGERconstant                                                         { $$ = new ConstantNode(ConstantNode::Integer, $1); }
    298         | FLOATINGconstant                                                      { $$ = new ConstantNode(ConstantNode::Float, $1); }
    299         | CHARACTERconstant                                                     { $$ = new ConstantNode(ConstantNode::Character, $1); }
     297        INTEGERconstant                                                         { $$ = new ConstantNode( ConstantNode::Integer, $1 ); }
     298        | FLOATINGconstant                                                      { $$ = new ConstantNode( ConstantNode::Float, $1 ); }
     299        | CHARACTERconstant                                                     { $$ = new ConstantNode( ConstantNode::Character, $1 ); }
    300300        ;
    301301
     
    321321
    322322string_literal_list:                                                                    // juxtaposed strings are concatenated
    323         STRINGliteral                                                           { $$ = new ConstantNode(ConstantNode::String, $1); }
    324         | string_literal_list STRINGliteral                     { $$ = $1->append( $2 ); }
     323        STRINGliteral                                                           { $$ = new ConstantNode( ConstantNode::String, $1 ); }
     324        | string_literal_list STRINGliteral                     { $$ = $1->appendstr( $2 ); }
    325325        ;
    326326
     
    536536        logical_OR_expression
    537537        | logical_OR_expression '?' comma_expression ':' conditional_expression
    538                 { $$ = new CompositeExprNode(new OperatorNode(OperatorNode::Cond), (ExpressionNode *)mkList((*$1,*$3,*$5))); }
     538                { $$ = new CompositeExprNode( new OperatorNode(OperatorNode::Cond), (ExpressionNode *)mkList( (*$1, *$3, *$5) ) ); }
    539539        | logical_OR_expression '?' /* empty */ ':' conditional_expression // GCC, omitted first operand
    540540                { $$=new CompositeExprNode(new OperatorNode(OperatorNode::NCond),$1,$4); }
    541541        | logical_OR_expression '?' comma_expression ':' tuple // CFA, tuple expression
    542                 { $$ = new CompositeExprNode(new OperatorNode(OperatorNode::Cond), (ExpressionNode *)mkList(( *$1, *$3, *$5 ))); }
     542                { $$ = new CompositeExprNode( new OperatorNode(OperatorNode::Cond), (ExpressionNode *)mkList( (*$1, *$3, *$5) ) ); }
    543543        ;
    544544
Note: See TracChangeset for help on using the changeset viewer.