Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
node-sass
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
楚学文
node-sass
Commits
df9b4e6a
Commit
df9b4e6a
authored
May 27, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Selector interpolation works robustly (sans a few special cases).
parent
bf146431
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
40 additions
and
42 deletions
+40
-42
document.cpp
document.cpp
+4
-3
document.hpp
document.hpp
+7
-2
document_parser.cpp
document_parser.cpp
+24
-20
eval_apply.cpp
eval_apply.cpp
+0
-0
eval_apply.hpp
eval_apply.hpp
+4
-3
sass_interface.cpp
sass_interface.cpp
+1
-14
No files found.
document.cpp
View file @
df9b4e6a
...
...
@@ -60,17 +60,18 @@ namespace Sass {
return
doc
;
}
Document
Document
::
make_from_source_chars
(
Context
&
ctx
,
char
*
src
,
string
path
)
Document
Document
::
make_from_source_chars
(
Context
&
ctx
,
char
*
src
,
string
path
,
bool
own_source
)
{
Document
doc
(
ctx
);
doc
.
path
=
path
;
doc
.
line
=
1
;
doc
.
root
=
ctx
.
new_Node
(
Node
::
root
,
path
,
1
,
0
);
doc
.
lexed
=
Token
::
make
();
doc
.
own_source
=
fals
e
;
doc
.
own_source
=
own_sourc
e
;
doc
.
source
=
src
;
doc
.
end
=
src
+
std
::
strlen
(
src
);
doc
.
position
=
doc
.
end
;
doc
.
position
=
src
;
if
(
own_source
)
doc
.
context
.
source_refs
.
push_back
(
src
);
return
doc
;
}
...
...
document.hpp
View file @
df9b4e6a
#include <map>
#ifndef SASS_PRELEXER_INCLUDED
#include "prelexer.hpp"
#endif
#ifndef SASS_NODE_INCLUDED
#include "node.hpp"
#endif
#i
nclude "prelexer.hpp"
#i
fndef SASS_CONTEXT_INCLUDED
#include "context.hpp"
#endif
struct
Selector_Lookahead
{
const
char
*
found
;
...
...
@@ -41,7 +46,7 @@ namespace Sass {
~
Document
();
static
Document
make_from_file
(
Context
&
ctx
,
string
path
);
static
Document
make_from_source_chars
(
Context
&
ctx
,
char
*
src
,
string
path
=
""
);
static
Document
make_from_source_chars
(
Context
&
ctx
,
char
*
src
,
string
path
=
""
,
bool
own_source
=
false
);
static
Document
make_from_token
(
Context
&
ctx
,
Token
t
,
string
path
=
""
,
size_t
line_number
=
1
);
template
<
prelexer
mx
>
...
...
document_parser.cpp
View file @
df9b4e6a
...
...
@@ -870,34 +870,38 @@ namespace Sass {
const
char
*
q
;
bool
saw_interpolant
=
false
;
while
((
q
=
peek
<
identifier
>
(
p
))
||
(
q
=
peek
<
id_name
>
(
p
))
||
(
q
=
peek
<
class_name
>
(
p
))
||
(
q
=
peek
<
sequence
<
pseudo_prefix
,
identifier
>
>
(
p
))
||
(
q
=
peek
<
string_constant
>
(
p
))
||
(
q
=
peek
<
exactly
<
'*'
>
>
(
p
))
||
(
q
=
peek
<
exactly
<
'('
>
>
(
p
))
||
(
q
=
peek
<
exactly
<
')'
>
>
(
p
))
||
(
q
=
peek
<
exactly
<
'['
>
>
(
p
))
||
(
q
=
peek
<
exactly
<
']'
>
>
(
p
))
||
(
q
=
peek
<
exactly
<
'+'
>
>
(
p
))
||
(
q
=
peek
<
exactly
<
'~'
>
>
(
p
))
||
(
q
=
peek
<
exactly
<
'>'
>
>
(
p
))
||
(
q
=
peek
<
exactly
<
','
>
>
(
p
))
||
(
q
=
peek
<
binomial
>
(
p
))
||
while
((
q
=
peek
<
identifier
>
(
p
))
||
(
q
=
peek
<
id_name
>
(
p
))
||
(
q
=
peek
<
class_name
>
(
p
))
||
(
q
=
peek
<
sequence
<
pseudo_prefix
,
identifier
>
>
(
p
))
||
(
q
=
peek
<
string_constant
>
(
p
))
||
(
q
=
peek
<
exactly
<
'*'
>
>
(
p
))
||
(
q
=
peek
<
exactly
<
'('
>
>
(
p
))
||
(
q
=
peek
<
exactly
<
')'
>
>
(
p
))
||
(
q
=
peek
<
exactly
<
'['
>
>
(
p
))
||
(
q
=
peek
<
exactly
<
']'
>
>
(
p
))
||
(
q
=
peek
<
exactly
<
'+'
>
>
(
p
))
||
(
q
=
peek
<
exactly
<
'~'
>
>
(
p
))
||
(
q
=
peek
<
exactly
<
'>'
>
>
(
p
))
||
(
q
=
peek
<
exactly
<
','
>
>
(
p
))
||
(
q
=
peek
<
binomial
>
(
p
))
||
(
q
=
peek
<
sequence
<
optional
<
sign
>
,
optional
<
digits
>
,
exactly
<
'n'
>
>
>
(
p
))
||
exactly
<
'n'
>
>
>
(
p
))
||
(
q
=
peek
<
sequence
<
optional
<
sign
>
,
digits
>
>
(
p
))
||
(
q
=
peek
<
number
>
(
p
))
||
(
q
=
peek
<
exactly
<
'&'
>
>
(
p
))
||
digits
>
>
(
p
))
||
(
q
=
peek
<
number
>
(
p
))
||
(
q
=
peek
<
exactly
<
'&'
>
>
(
p
))
||
(
q
=
peek
<
alternatives
<
exact_match
,
class_match
,
dash_match
,
prefix_match
,
suffix_match
,
substring_match
>
>
(
p
))
||
substring_match
>
>
(
p
))
||
(
q
=
peek
<
sequence
<
exactly
<
'.'
>
,
interpolant
>
>
(
p
))
||
(
q
=
peek
<
sequence
<
exactly
<
'#'
>
,
interpolant
>
>
(
p
))
||
(
q
=
peek
<
sequence
<
exactly
<
'-'
>
,
interpolant
>
>
(
p
))
||
(
q
=
peek
<
sequence
<
pseudo_prefix
,
interpolant
>
>
(
p
))
||
(
q
=
peek
<
interpolant
>
(
p
)))
{
p
=
q
;
if
(
*
(
p
-
1
)
==
'}'
)
saw_interpolant
=
true
;
...
...
eval_apply.cpp
View file @
df9b4e6a
This diff is collapsed.
Click to expand it.
eval_apply.hpp
View file @
df9b4e6a
...
...
@@ -11,10 +11,10 @@
namespace
Sass
{
using
std
::
map
;
Node
eval
(
Node
&
expr
,
Environment
&
env
,
map
<
pair
<
string
,
size_t
>
,
Function
>&
f_env
,
Node_Factory
&
new_Node
);
Node
eval
(
Node
&
expr
,
Environment
&
env
,
map
<
pair
<
string
,
size_t
>
,
Function
>&
f_env
,
Node_Factory
&
new_Node
,
Context
&
src_refs
);
Node
accumulate
(
Node
::
Type
op
,
Node
&
acc
,
Node
&
rhs
,
Node_Factory
&
new_Node
);
double
operate
(
Node
::
Type
op
,
double
lhs
,
double
rhs
);
Node
apply_mixin
(
Node
&
mixin
,
const
Node
&
args
,
Environment
&
env
,
map
<
pair
<
string
,
size_t
>
,
Function
>&
f_env
,
Node_Factory
&
new_Node
);
Node
apply_function
(
const
Function
&
f
,
const
Node
&
args
,
Environment
&
env
,
map
<
pair
<
string
,
size_t
>
,
Function
>&
f_env
,
Node_Factory
&
new_Node
);
Node
apply_mixin
(
Node
&
mixin
,
const
Node
&
args
,
Environment
&
env
,
map
<
pair
<
string
,
size_t
>
,
Function
>&
f_env
,
Node_Factory
&
new_Node
,
Context
&
src_refs
);
Node
apply_function
(
const
Function
&
f
,
const
Node
&
args
,
Environment
&
env
,
map
<
pair
<
string
,
size_t
>
,
Function
>&
f_env
,
Node_Factory
&
new_Node
,
Context
&
src_refs
);
}
\ No newline at end of file
sass_interface.cpp
View file @
df9b4e6a
...
...
@@ -39,21 +39,8 @@ extern "C" {
{
using
namespace
Sass
;
doc
.
parse_scss
();
// cerr << "PARSED" << endl;
eval
(
doc
.
root
,
doc
.
context
.
global_env
,
doc
.
context
.
function_env
,
doc
.
context
.
new_Node
);
// cerr << "EVALUATED" << endl;
eval
(
doc
.
root
,
doc
.
context
.
global_env
,
doc
.
context
.
function_env
,
doc
.
context
.
new_Node
,
doc
.
context
);
string
output
(
doc
.
emit_css
(
static_cast
<
Document
::
CSS_Style
>
(
style
)));
// cerr << "EMITTED" << endl;
// cerr << "Allocations:\t" << Node::allocations << endl;
// cerr << "Destructions:\t" << Node::destructed << endl;
// cerr << "Registry size:\t" << doc.context.registry.size() << endl;
// for (size_t i = 0; i < doc.context.registry.size(); ++i) {
// delete doc.context.registry[i];
// }
// cerr << "Deallocations:\t" << i << endl;
char
*
c_output
=
(
char
*
)
malloc
(
output
.
size
()
+
1
);
strcpy
(
c_output
,
output
.
c_str
());
return
c_output
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment