Changeset ea0c5e3
- Timestamp:
- Sep 11, 2017, 8:45:54 PM (7 years ago)
- 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
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
rcd218e8 rea0c5e3 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Sep 11 08:22:25201713 // Update Count : 278 312 // Last Modified On : Mon Sep 11 18:12:00 2017 13 // Update Count : 2787 14 14 // 15 15 … … 65 65 bool appendStr( string & to, string & from ) { 66 66 // 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 3because "escape sequences are converted into single members of67 // "\x12" "3" is treated as 2 characters versus 1 because "escape sequences are converted into single members of 68 68 // the execution character set just prior to adjacent string literal concatenation" (C11, Section 6.4.5-8). It is 69 69 // easier to let the C compiler handle this case. … … 75 75 if ( from[0] != '"' ) { // encoding ? 76 76 if ( to[0] != '"' ) { // encoding ? 77 if ( to[0] != from[0] ) {// different encodings ?77 if ( to[0] != from[0] || to[1] != from[1] ) { // different encodings ? 78 78 yyerror( "non-matching string encodings for string-literal concatenation" ); 79 79 return false; // parse error, must call YYERROR in action 80 } else if ( from[1] == '8' ) { 81 from.erase( 0, 1 ); // remove 2nd encoding 80 82 } // if 81 83 } 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 83 90 } // if 84 91 from.erase( 0, 1 ); // remove 2nd encoding -
src/tests/.expect/literals.txt
rcd218e8 rea0c5e3 1803 1803 ((void)L"\xFFFFFFFF"); 1804 1804 ((void)"\x12" "3"); 1805 ((void)L"abc"); 1805 ((void)u8"a" "b" "c"); 1806 ((void)u8"a" "b" "c"); 1807 ((void)u8"a" "b" "c"); 1808 ((void)u8"a" "b" "c"); 1809 ((void)u8"a" "b" "c"); 1810 ((void)u"a" "b" "c"); 1811 ((void)u"a" "b" "c"); 1812 ((void)u"a" "b" "c"); 1813 ((void)u"a" "b" "c"); 1814 ((void)u"a" "b" "c"); 1815 ((void)U"a" "b" "c"); 1816 ((void)U"a" "b" "c"); 1817 ((void)U"a" "b" "c"); 1818 ((void)U"a" "b" "c"); 1819 ((void)U"a" "b" "c"); 1806 1820 ((void)L"a" "b" "c"); 1807 1821 ((void)L"a" "b" "c"); 1808 1822 ((void)L"a" "b" "c"); 1809 1823 ((void)L"a" "b" "c"); 1810 ((void)u"abc"); 1811 ((void)u"a" "b" "c"); 1812 ((void)u"a" "b" "c"); 1813 ((void)u"a" "b" "c"); 1814 ((void)u"a" "b" "c"); 1824 ((void)L"a" "b" "c"); 1815 1825 ((void)(___retval_main__i_1=0) /* ?{} */); 1816 1826 return ((signed int )___retval_main__i_1); -
src/tests/literals.c
rcd218e8 rea0c5e3 10 10 // Created On : Sat Sep 9 16:34:38 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Sep 11 1 2:52:11201713 // Update Count : 8 312 // Last Modified On : Mon Sep 11 18:08:46 2017 13 // Update Count : 85 14 14 // 15 15 … … 206 206 // concatenation 207 207 208 "\x12" "3"; // 2 characters not 3! 209 210 L"abc"; 208 "\x12" "3"; // 2 characters not 1! 209 210 "a" "b" u8"c"; 211 "a" u8"b" "c"; 212 "a" u8"b" u8"c"; 213 u8"a" "b" u8"c"; 214 u8"a" u8"b" u8"c"; 215 216 "a" "b" u"c"; 217 "a" u"b" "c"; 218 "a" u"b" u"c"; 219 u"a" "b" u"c"; 220 u"a" u"b" u"c"; 221 222 "a" "b" U"c"; 223 "a" U"b" "c"; 224 "a" U"b" U"c"; 225 U"a" "b" U"c"; 226 U"a" U"b" U"c"; 227 211 228 "a" "b" L"c"; 212 229 "a" L"b" "c"; 230 "a" L"b" L"c"; 213 231 L"a" "b" L"c"; 214 232 L"a" L"b" L"c"; 215 216 u"abc";217 "a" "b" u"c";218 "a" u"b" "c";219 u"a" "b" u"c";220 u"a" u"b" u"c";221 233 222 234 // warnings/errors
Note: See TracChangeset
for help on using the changeset viewer.