@@ -281,7 +281,47 @@ impl Executor {
281281 }
282282 }
283283 _ => {
284+ <<<<<<< HEAD
284285 buffer. push( c ) ;
286+ =======
287+ <<<<<<< HEAD
288+ if parentheses == 0 && brackets == 0 && !hash {
289+ if escape {
290+ <<<<<<< HEAD
291+ <<<<<<< HEAD
292+ =======
293+ >>>>>>> 416 f9ec ( Update main. rs)
294+ match c {
295+ 'n' => buffer. push_str( "\\ n" ) ,
296+ 't' => buffer. push_str( "\\ t" ) ,
297+ 'r' => buffer. push_str( "\\ r" ) ,
298+ _ => buffer. push ( c ) ,
299+ }
300+ <<<<<<< HEAD
301+ =======
302+ buffer. push( match c {
303+ 'n' => '\n' ,
304+ 't' => '\t' ,
305+ 'r' => '\r' ,
306+ _ => c,
307+ } )
308+ >>>>>>> e0ee7bf ( Add string escape)
309+ =======
310+ >>>>>>> 416 f9ec ( Update main. rs)
311+ } else {
312+ buffer. push( c) ;
313+ }
314+ } else {
315+ if escape {
316+ buffer. push( '\\' ) ;
317+ }
318+ buffer. push( c) ;
319+ }
320+ escape = false; // Reset escape flag for non-escape characters
321+ =======
322+ buffer. push( c) ;
323+ >>>>>>> 76 e82be ( git)
324+ >>>>>>> upstream-main
285325 }
286326 }
287327 }
@@ -314,8 +354,92 @@ impl Executor {
314354 self . stack. push( Type :: Bool ( token. parse( ) . unwrap_or( true ) ) ) ;
315355 } else if chars[ 0 ] == '(' && chars[ chars. len( ) - 1 ] == ')' {
316356 // Push string value on the stack
357+ <<<<<<< HEAD
317358 self. stack
318359 . push( Type :: String ( token[ 1 ..token. len( ) - 1 ] . to_string( ) ) ) ;
360+ =======
361+ <<<<<<< HEAD
362+ let string = {
363+ let mut buffer = String :: new ( ) ; // Temporary storage
364+ let mut brackets = 0 ; // String's nest structure
365+ let mut parentheses = 0 ; // List's nest structure
366+ let mut hash = false; // Is it Comment
367+ let mut escape = false; // Flag to indicate next character is escaped
368+
369+ for c in token[ 1 ..token. len( ) - 1 ] . to_string( ) . chars ( ) {
370+ match c {
371+ '\\' if ! escape => {
372+ escape = true ;
373+ }
374+ ' ( ' if !hash && !escape => {
375+ brackets += 1 ;
376+ buffer. push( '(' ) ;
377+ }
378+ ')' if !hash && ! escape => {
379+ brackets -= 1 ;
380+ buffer. push( ')' ) ;
381+ }
382+ '#' if !hash && ! escape => {
383+ hash = true ;
384+ buffer. push( '#' ) ;
385+ }
386+ '#' if hash && ! escape => {
387+ hash = false ;
388+ buffer. push( '#' ) ;
389+ }
390+ ' [ ' if !hash && brackets == 0 && !escape => {
391+ parentheses += 1 ;
392+ buffer. push( '[' ) ;
393+ }
394+ ']' if !hash && brackets == 0 && !escape => {
395+ parentheses -= 1 ;
396+ buffer. push( ']' ) ;
397+ }
398+ _ => {
399+ if parentheses == 0 && brackets == 0 && !hash {
400+ if escape {
401+ <<<<<<< HEAD
402+ <<<<<<< HEAD
403+ =======
404+ >>>>>>> 416 f9ec ( Update main. rs)
405+ match c {
406+ 'n' => buffer. push_str( "\\ n" ) ,
407+ 't' => buffer. push_str( "\\ t" ) ,
408+ 'r' => buffer. push_str( "\\ r" ) ,
409+ _ => buffer. push ( c ) ,
410+ }
411+ <<<<<<< HEAD
412+ =======
413+ buffer. push( match c {
414+ 'n' => '\n' ,
415+ 't' => '\t' ,
416+ 'r' => '\r' ,
417+ _ => c,
418+ } )
419+ >>>>>>> e0ee7bf ( Add string escape)
420+ =======
421+ >>>>>>> 416 f9ec ( Update main. rs)
422+ } else {
423+ buffer. push( c) ;
424+ }
425+ } else {
426+ if escape {
427+ buffer. push( '\\' ) ;
428+ }
429+ buffer. push( c) ;
430+ }
431+ escape = false; // Reset escape flag for non-escape characters
432+ }
433+ }
434+ }
435+ buffer
436+ } ;
437+ self . stack. push ( Type :: String ( string ) ) ;
438+ =======
439+ self . stack
440+ . push( Type :: String ( token[ 1 ..token. len( ) - 1 ] . to_string( ) ) ) ;
441+ >>>>>>> 76e82 be ( git)
442+ >>>>>>> upstream-main
319443 } else if chars[ 0 ] == '[' && chars[ chars . len( ) - 1 ] == ']' {
320444 // Push list value on the stack
321445 let old_len = self . stack. len( ) ; // length of old stack
@@ -783,8 +907,32 @@ impl Executor {
783907 return ;
784908 }
785909 }
910+ <<<<<<< HEAD
911+ <<<<<<< HEAD
912+ <<<<<<< HEAD
913+ <<<<<<< HEAD
914+ <<<<<<< HEAD
915+ =======
916+ >>>>>>> cdb5350 ( git )
917+
918+ self. log_print( String :: from( "Error! item not found in the list\n " ) ) ;
919+ =======
920+ self . log_print( String :: from( "Error! item not found in the list" ) . as_str( ) . to_owned ( ) + "\n " ) ;
921+ >>>>>>> ce3cc7e ( git)
922+ <<<<<<< HEAD
923+ =======
924+
925+ =======
926+
927+ >>>>>>> 61 ad1c1 ( Format )
928+ self. log_print( String :: from( "Error! item not found in the list\n " ) ) ;
929+ >>>>>>> 0 c174e6 ( Update main. rs)
930+ =======
931+ >>>>>>> cdb5350 ( git)
932+ =======
786933
787934 self . log_print( String :: from( "Error! item not found in the list\n " ) ) ;
935+ >>>>>>> 76e82 be ( git)
788936 self. stack. push( Type :: Error ( String :: from( "item-not-found" ) ) ) ;
789937 }
790938
@@ -1293,6 +1441,38 @@ impl Executor {
12931441 } )
12941442 }
12951443
1444+ <<<<<<< HEAD
1445+ =======
1446+ <<<<<<< HEAD
1447+ <<<<<<< HEAD
1448+ <<<<<<< HEAD
1449+ <<<<<<< HEAD
1450+ <<<<<<< HEAD
1451+ =======
1452+ =======
1453+ <<<<<<< HEAD
1454+ >>>>>>> ce3cc7e ( git )
1455+ =======
1456+ >>>>>>> ce80cb2 ( git )
1457+ >>>>>>> 74 bbfe3 ( git )
1458+ =======
1459+ =======
1460+ >>>>>>> 1843023 ( git)
1461+ =======
1462+ =======
1463+ =======
1464+ <<<<<<< HEAD
1465+ >>>>>>> ce3cc7e ( git )
1466+ <<<<<<< HEAD
1467+ >>>>>>> cdb5350 ( git )
1468+ =======
1469+ =======
1470+ >>>>>>> ce80cb2 ( git )
1471+ >>>>>>> 74 bbfe3 ( git )
1472+ >>>>>>> e1b0d54 ( git )
1473+ =======
1474+ >>>>>>> 76 e82be ( git )
1475+ >>>>>>> upstream-main
12961476 "index" => {
12971477 let findhint = self . pop_stack ( ) . get_string ( ) ;
12981478 let findtarget = self . pop_stack ( ) . get_list ( ) ;
@@ -1315,6 +1495,45 @@ impl Executor {
13151495 self . clearscreen ( ) ;
13161496 }
13171497
1498+ <<<<<<< HEAD
1499+ =======
1500+ <<<<<<< HEAD
1501+ <<<<<<< HEAD
1502+ <<<<<<< HEAD
1503+ <<<<<<< HEAD
1504+ <<<<<<< HEAD
1505+ <<<<<<< HEAD
1506+ =======
1507+ >>>>>>> cdb5350 ( git )
1508+ =======
1509+ >>>>>>> e1b0d54 ( git )
1510+ >>>>>>> 887510 b ( git )
1511+ =======
1512+ =======
1513+ >>>>>>> 1 d34bfe ( Refactoring )
1514+ >>>>>>> ce3cc7e ( git)
1515+ <<<<<<< HEAD
1516+ <<<<<<< HEAD
1517+ =======
1518+ >>>>>>> e1b0d54 ( git )
1519+ =======
1520+ =======
1521+ >>>>>>> 1 d34bfe ( Refactoring )
1522+ =======
1523+ >>>>>>> 887510 b ( git )
1524+ >>>>>>> ce80cb2 ( git )
1525+ >>>>>>> 74 bbfe3 ( git)
1526+ <<<<<<< HEAD
1527+ =======
1528+ >>>>>>> 887510 b ( git )
1529+ >>>>>>> 1843023 ( git )
1530+ =======
1531+ >>>>>>> cdb5350 ( git )
1532+ =======
1533+ >>>>>>> e1b0d54 ( git)
1534+ =======
1535+ >>>>>>> 76 e82be ( git )
1536+ >>>>>>> upstream-main
13181537 // If it is not recognized as a command, use it as a string.
13191538 _ => self . stack. push( Type :: String ( command ) ) ,
13201539 }
0 commit comments