Changeset ea0c5e3 for src/Parser


Ignore:
Timestamp:
Sep 11, 2017, 8:45:54 PM (7 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
a54840b, beec62c
Parents:
cd218e8
Message:

forgot to handle and test u8 concatenated strings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    rcd218e8 rea0c5e3  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep 11 08:22:25 2017
    13 // Update Count     : 2783
     12// Last Modified On : Mon Sep 11 18:12:00 2017
     13// Update Count     : 2787
    1414//
    1515
     
    6565bool appendStr( string & to, string & from ) {
    6666        // 1. Multiple strings are concatenated into a single string but not combined internally. The reason is that
    67         //    "\x12" "3" is treated as 2 characters versus 3 because "escape sequences are converted into single members of
     67        //    "\x12" "3" is treated as 2 characters versus 1 because "escape sequences are converted into single members of
    6868        //    the execution character set just prior to adjacent string literal concatenation" (C11, Section 6.4.5-8). It is
    6969        //    easier to let the C compiler handle this case.
     
    7575        if ( from[0] != '"' ) {                                                         // encoding ?
    7676                if ( to[0] != '"' ) {                                                   // encoding ?
    77                         if ( to[0] != from[0] ) {                                       // different encodings ?
     77                        if ( to[0] != from[0] || to[1] != from[1] ) { // different encodings ?
    7878                                yyerror( "non-matching string encodings for string-literal concatenation" );
    7979                                return false;                                                   // parse error, must call YYERROR in action
     80                        } else if ( from[1] == '8' ) {
     81                                from.erase( 0, 1 );                                             // remove 2nd encoding
    8082                        } // if
    8183                } else {
    82                         to = from[0] + to;                                                      // move encoding to start
     84                        if ( from[1] == '8' ) {                                         // move encoding to start
     85                                to = "u8" + to;
     86                                from.erase( 0, 1 );                                             // remove 2nd encoding
     87                        } else {
     88                                to = from[0] + to;
     89                        } // if
    8390                } // if
    8491                from.erase( 0, 1 );                                                             // remove 2nd encoding
Note: See TracChangeset for help on using the changeset viewer.