@@ -715,6 +715,7 @@ protected function pushBlock($selectors, $pos = 0)
715715 $ b ->selectors = $ selectors ;
716716 $ b ->comments = [];
717717 $ b ->parent = $ this ->env ;
718+ $ b ->atrootParent = $ this ->env ;
718719
719720 if (! $ this ->env ) {
720721 $ b ->children = [];
@@ -762,7 +763,9 @@ protected function popBlock()
762763 if (empty ($ block ->parent )) {
763764 $ this ->throwParseError ('unexpected } ' );
764765 }
765-
766+ // if ($block->type == Type::T_AT_ROOT || $block->type == Type::T_MIXIN || $block->type == Type::T_INCLUDE) {
767+ // $block->atrootParent = $block->parent;
768+ // }
766769 $ this ->env = $ block ->parent ;
767770 unset($ block ->parent );
768771
@@ -1897,18 +1900,35 @@ protected function interpolation(&$out, $lookWhite = true)
18971900 {
18981901 $ oldWhite = $ this ->eatWhiteDefault ;
18991902 $ this ->eatWhiteDefault = true ;
1903+ $ selector = false ;
19001904
19011905 $ s = $ this ->seek ();
19021906
19031907 if ($ this ->literal ('#{ ' ) && $ this ->valueList ($ value ) && $ this ->literal ('} ' , false )) {
1908+
19041909 if ($ lookWhite ) {
19051910 $ left = preg_match ('/\s/ ' , $ this ->buffer [$ s - 1 ]) ? ' ' : '' ;
1906- $ right = preg_match ('/\s/ ' , $ this ->buffer [$ this ->count ]) ? ' ' : '' ;
1911+ $ right = preg_match ('/\s/ ' , $ this ->buffer [$ this ->count ]) ? ' ' : '' ;
19071912 } else {
19081913 $ left = $ right = false ;
19091914 }
1910-
19111915 $ out = [Type::T_INTERPOLATE , $ value , $ left , $ right ];
1916+
1917+ $ this ->eatWhiteDefault = $ oldWhite ;
1918+
1919+ if ($ this ->eatWhiteDefault ) {
1920+ $ this ->whitespace ();
1921+ }
1922+
1923+ return true ;
1924+ }
1925+
1926+ $ this ->seek ($ s );
1927+
1928+ if ($ this ->literal ('#{ ' ) && $ selector = $ this ->selectorSingle ($ sel ) && $ this ->literal ('} ' , false )) {
1929+
1930+ $ out = $ sel [0 ];
1931+
19121932 $ this ->eatWhiteDefault = $ oldWhite ;
19131933
19141934 if ($ this ->eatWhiteDefault ) {
@@ -2095,6 +2115,11 @@ protected function selectorSingle(&$out)
20952115 $ parts [] = Compiler::$ selfSelector ;
20962116 continue ;
20972117 }
2118+ // self
2119+ // if ($this->literal('#{&}', true)) {
2120+ // $parts[] = Compiler::$selfSelector;
2121+ // continue;
2122+ // }
20982123
20992124 if ($ this ->literal ('. ' , false )) {
21002125 $ parts [] = '. ' ;
0 commit comments