@@ -10,13 +10,18 @@ abstract class BaseTokenizer
1010
1111 private const SPACE_REPLACER = '&!@ ' ;
1212 private const SINGLE_QUOTE_REPLACER = '!*@ ' ;
13+ private const EMPTY_STRING_REPLACER = '$$EMPTY_STRING ' ;
1314
1415 public function __construct (string $ value )
1516 {
1617 $ this ->value = $ value ;
1718 $ prune = false ;
1819 $ pruneSingleQuotes = false ;
1920
21+ if (preg_match ("/(DEFAULT|COMMENT) ''/ " , $ value , $ matches )) {
22+ $ value = str_replace ($ matches [1 ] . ' \'\'' , $ matches [1 ] . ' ' . self ::EMPTY_STRING_REPLACER , $ value );
23+ }
24+
2025 //first get rid of any single quoted stuff with '' around it
2126 if (preg_match_all ('/ \'\'(.+?) \'\'/ ' , $ value , $ matches )) {
2227 foreach ($ matches [0 ] as $ key => $ singleQuoted ) {
@@ -25,9 +30,6 @@ public function __construct(string $value)
2530 $ pruneSingleQuotes = true ;
2631 }
2732 }
28- if (preg_match ('/ \'\'/ ' , $ value )) {
29- $ value = str_replace ('\'\'' , '$$EMPTY_STRING ' , $ value );
30- }
3133
3234 if (preg_match_all ("/'(.+?)'/ " , $ value , $ matches )) {
3335 foreach ($ matches [0 ] as $ quoteWithSpace ) {
@@ -38,7 +40,7 @@ public function __construct(string $value)
3840 $ prune = true ;
3941 }
4042 }
41- $ value = str_replace (' $$EMPTY_STRING ' , '\'\'' , $ value );
43+ $ value = str_replace (self :: EMPTY_STRING_REPLACER , '\'\'' , $ value );
4244 $ this ->tokens = array_map (function ($ item ) {
4345 return trim ($ item , ', ' );
4446 }, str_getcsv ($ value , ' ' , "' " ));
0 commit comments