@@ -641,17 +641,15 @@ namespace Sass {
641641 std::string value (str->value ());
642642 const char * start = value.c_str ();
643643 if (Prelexer::sequence < Prelexer::dimension, Prelexer::end_of_file >(start) != 0 ) {
644- Textual_Obj l = SASS_MEMORY_NEW (Textual, b->pstate (), Textual::DIMENSION, str->value ());
645- lhs = l->perform (this );
644+ lhs = Parser::lexed_dimension (b->pstate (), str->value ());
646645 }
647646 }
648647 // If possible upgrade RHS to a number (for string to number compare)
649648 if (String_Constant_Ptr str = Cast<String_Constant>(rhs)) {
650649 std::string value (str->value ());
651650 const char * start = value.c_str ();
652651 if (Prelexer::sequence < Prelexer::dimension, Prelexer::number >(start) != 0 ) {
653- Textual_Obj r = SASS_MEMORY_NEW (Textual, b->pstate (), Textual::DIMENSION, str->value ());
654- rhs = r->perform (this );
652+ rhs = Parser::lexed_dimension (b->pstate (), str->value ());
655653 }
656654 }
657655 }
@@ -660,16 +658,6 @@ namespace Sass {
660658 Value_Obj v_l = Cast<Value>(lhs->perform (&to_value));
661659 Value_Obj v_r = Cast<Value>(rhs->perform (&to_value));
662660
663- if (s2 && s2->has_interpolants () && s2->length ()) {
664- Textual_Obj front = Cast<Textual>(s2->elements ().front ());
665- if (front && !front->is_interpolant ())
666- {
667- // XXX: this is never hit via spec tests
668- schema_op = true ;
669- rhs = front->perform (this );
670- }
671- }
672-
673661 if (force_delay) {
674662 std::string str (" " );
675663 str += v_l->to_string (ctx.c_options );
@@ -1025,81 +1013,6 @@ namespace Sass {
10251013 return value.detach ();
10261014 }
10271015
1028- Expression_Ptr Eval::operator ()(Textual_Ptr t)
1029- {
1030- using Prelexer::number;
1031- Expression_Obj result = 0 ;
1032- size_t L = t->value ().length ();
1033- bool zero = !( (L > 0 && t->value ().substr (0 , 1 ) == " ." ) ||
1034- (L > 1 && t->value ().substr (0 , 2 ) == " 0." ) ||
1035- (L > 1 && t->value ().substr (0 , 2 ) == " -." ) ||
1036- (L > 2 && t->value ().substr (0 , 3 ) == " -0." )
1037- );
1038-
1039- const std::string& text = t->value ();
1040- size_t num_pos = text.find_first_not_of (" \n\r\t " );
1041- if (num_pos == std::string::npos) num_pos = text.length ();
1042- size_t unit_pos = text.find_first_not_of (" -+0123456789." , num_pos);
1043- if (unit_pos == std::string::npos) unit_pos = text.length ();
1044- const std::string& num = text.substr (num_pos, unit_pos - num_pos);
1045-
1046- switch (t->valtype ())
1047- {
1048- case Textual::NUMBER:
1049- result = SASS_MEMORY_NEW (Number,
1050- t->pstate (),
1051- sass_atof (num.c_str ()),
1052- " " ,
1053- zero);
1054- break ;
1055- case Textual::PERCENTAGE:
1056- result = SASS_MEMORY_NEW (Number,
1057- t->pstate (),
1058- sass_atof (num.c_str ()),
1059- " %" ,
1060- true );
1061- break ;
1062- case Textual::DIMENSION:
1063- result = SASS_MEMORY_NEW (Number,
1064- t->pstate (),
1065- sass_atof (num.c_str ()),
1066- Token (number (text.c_str ())),
1067- zero);
1068- break ;
1069- case Textual::HEX: {
1070- if (t->value ().substr (0 , 1 ) != " #" ) {
1071- result = SASS_MEMORY_NEW (String_Quoted, t->pstate (), t->value ());
1072- break ;
1073- }
1074- std::string hext (t->value ().substr (1 )); // chop off the '#'
1075- if (hext.length () == 6 ) {
1076- std::string r (hext.substr (0 ,2 ));
1077- std::string g (hext.substr (2 ,2 ));
1078- std::string b (hext.substr (4 ,2 ));
1079- result = SASS_MEMORY_NEW (Color,
1080- t->pstate (),
1081- static_cast <double >(strtol (r.c_str (), NULL , 16 )),
1082- static_cast <double >(strtol (g.c_str (), NULL , 16 )),
1083- static_cast <double >(strtol (b.c_str (), NULL , 16 )),
1084- 1 , // alpha channel
1085- t->value ());
1086- }
1087- else {
1088- result = SASS_MEMORY_NEW (Color,
1089- t->pstate (),
1090- static_cast <double >(strtol (std::string (2 ,hext[0 ]).c_str (), NULL , 16 )),
1091- static_cast <double >(strtol (std::string (2 ,hext[1 ]).c_str (), NULL , 16 )),
1092- static_cast <double >(strtol (std::string (2 ,hext[2 ]).c_str (), NULL , 16 )),
1093- 1 , // alpha channel
1094- t->value ());
1095- }
1096- } break ;
1097- default : break ;
1098- }
1099- result->is_interpolant (t->is_interpolant ());
1100- return result.detach ();
1101- }
1102-
11031016 Expression_Ptr Eval::operator ()(Color_Ptr c)
11041017 {
11051018 return c;
@@ -1177,7 +1090,6 @@ namespace Sass {
11771090 }
11781091
11791092 // Value
1180- // Textual
11811093 // Function_Call
11821094 // Selector_List
11831095 // String_Quoted
0 commit comments