@@ -37,20 +37,6 @@ namespace Sass {
37
37
return p;
38
38
}
39
39
40
- Parser Parser::from_c_str (const char * beg, const char * end, Context& ctx, Backtraces traces, SourceSpan pstate, const char * source, bool allow_parent)
41
- {
42
- pstate.offset .column = 0 ;
43
- pstate.offset .line = 0 ;
44
- Parser p (ctx, pstate, traces, allow_parent);
45
- p.source = source ? source : beg;
46
- p.position = beg ? beg : p.source ;
47
- p.end = end ? end : p.position + strlen (p.position );
48
- Block_Obj root = SASS_MEMORY_NEW (Block, pstate);
49
- p.block_stack .push_back (root);
50
- root->is_root (true );
51
- return p;
52
- }
53
-
54
40
void Parser::advanceToNextToken () {
55
41
lex < css_comments >(false );
56
42
// advance to position
@@ -72,18 +58,6 @@ namespace Sass {
72
58
&& ! peek_css<exactly<' {' >>(start);
73
59
}
74
60
75
- Parser Parser::from_token (Token t, Context& ctx, Backtraces traces, SourceSpan pstate, const char * source)
76
- {
77
- Parser p (ctx, pstate, traces);
78
- p.source = source ? source : t.begin ;
79
- p.position = t.begin ? t.begin : p.source ;
80
- p.end = t.end ? t.end : p.position + strlen (p.position );
81
- Block_Obj root = SASS_MEMORY_NEW (Block, pstate);
82
- p.block_stack .push_back (root);
83
- root->is_root (true );
84
- return p;
85
- }
86
-
87
61
/* main entry point to parse root block */
88
62
Block_Obj Parser::parse ()
89
63
{
@@ -584,8 +558,9 @@ namespace Sass {
584
558
css_error (" Invalid CSS" , " after " , " : expected expression (e.g. 1px, bold), was " );
585
559
}
586
560
// pass inner expression to the parser to resolve nested interpolations
587
- pstate.add (p, p+2 );
588
- ExpressionObj interpolant = Parser::from_c_str (p+2 , j, ctx, traces, pstate).parse_list ();
561
+ LocalOption<const char *> partEnd (end, j);
562
+ LocalOption<const char *> partBeg (position, p + 2 );
563
+ ExpressionObj interpolant = parse_list ();
589
564
// set status on the list expression
590
565
interpolant->is_interpolant (true );
591
566
// schema->has_interpolants(true);
@@ -1583,7 +1558,9 @@ namespace Sass {
1583
1558
const char * j = skip_over_scopes< exactly<hash_lbrace>, exactly<rbrace> >(p + 2 , chunk.end ); // find the closing brace
1584
1559
if (j) { --j;
1585
1560
// parse the interpolant and accumulate it
1586
- ExpressionObj interp_node = Parser::from_token (Token (p+2 , j), ctx, traces, pstate, source).parse_list ();
1561
+ LocalOption<const char *> partEnd (end, j);
1562
+ LocalOption<const char *> partBeg (position, p + 2 );
1563
+ ExpressionObj interp_node = parse_list ();
1587
1564
interp_node->is_interpolant (true );
1588
1565
schema->append (interp_node);
1589
1566
i = j;
@@ -1706,7 +1683,9 @@ namespace Sass {
1706
1683
const char * j = skip_over_scopes< exactly<hash_lbrace>, exactly<rbrace> >(p+2 , str.end ); // find the closing brace
1707
1684
if (j) {
1708
1685
// parse the interpolant and accumulate it
1709
- ExpressionObj interp_node = Parser::from_token (Token (p+2 , j), ctx, traces, pstate, source).parse_list ();
1686
+ LocalOption<const char *> partEnd (end, j);
1687
+ LocalOption<const char *> partBeg (position, p + 2 );
1688
+ ExpressionObj interp_node = parse_list ();
1710
1689
interp_node->is_interpolant (true );
1711
1690
schema->append (interp_node);
1712
1691
i = j;
@@ -1884,7 +1863,9 @@ namespace Sass {
1884
1863
const char * j = skip_over_scopes< exactly<hash_lbrace>, exactly<rbrace> >(p+2 , id.end ); // find the closing brace
1885
1864
if (j) {
1886
1865
// parse the interpolant and accumulate it
1887
- ExpressionObj interp_node = Parser::from_token (Token (p+2 , j), ctx, traces, pstate, source).parse_list (DELAYED);
1866
+ LocalOption<const char *> partEnd (end, j);
1867
+ LocalOption<const char *> partBeg (position, p + 2 );
1868
+ ExpressionObj interp_node = parse_list (DELAYED);
1888
1869
interp_node->is_interpolant (true );
1889
1870
schema->append (interp_node);
1890
1871
// schema->has_interpolants(true);
@@ -2072,7 +2053,7 @@ namespace Sass {
2072
2053
css_error (" Invalid CSS" , " after " , " : expected identifier, was " );
2073
2054
}
2074
2055
// return object
2075
- return token ;
2056
+ return lexed ;
2076
2057
}
2077
2058
// helper to parse identifier
2078
2059
Token Parser::lex_identifier ()
@@ -2082,7 +2063,7 @@ namespace Sass {
2082
2063
css_error (" Invalid CSS" , " after " , " : expected identifier, was " );
2083
2064
}
2084
2065
// return object
2085
- return token ;
2066
+ return lexed ;
2086
2067
}
2087
2068
2088
2069
EachRuleObj Parser::parse_each_directive ()
0 commit comments