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
7d3d0fc5
Commit
7d3d0fc5
authored
Apr 24, 2012
by
Andrew Nesbitt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated libsass
parent
c5f0294f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
21 deletions
+38
-21
document_parser.cpp
libsass/document_parser.cpp
+24
-4
eval_apply.cpp
libsass/eval_apply.cpp
+1
-0
node.cpp
libsass/node.cpp
+13
-17
No files found.
libsass/document_parser.cpp
View file @
7d3d0fc5
...
@@ -49,6 +49,10 @@ namespace Sass {
...
@@ -49,6 +49,10 @@ namespace Sass {
root
[
0
].
has_expansions
=
true
;
root
[
0
].
has_expansions
=
true
;
if
(
!
lex
<
exactly
<
';'
>
>
())
syntax_error
(
"top-level @include directive must be terminated by ';'"
);
if
(
!
lex
<
exactly
<
';'
>
>
())
syntax_error
(
"top-level @include directive must be terminated by ';'"
);
}
}
else
{
lex
<
spaces_and_comments
>
();
syntax_error
(
"invalid top-level expression"
);
}
lex
<
optional_spaces
>
();
lex
<
optional_spaces
>
();
}
}
}
}
...
@@ -518,10 +522,23 @@ namespace Sass {
...
@@ -518,10 +522,23 @@ namespace Sass {
semicolon
=
true
;
semicolon
=
true
;
}
}
else
if
(
!
peek
<
exactly
<
';'
>
>
())
{
else
if
(
!
peek
<
exactly
<
';'
>
>
())
{
block
<<
parse_rule
();
Node
rule
(
parse_rule
());
// check for lbrace; if it's there, we have a namespace property with a value
if
(
peek
<
exactly
<
'{'
>
>
())
{
Node
inner
(
parse_block
());
Node
propset
(
Node
::
propset
,
context
.
registry
,
line_number
,
2
);
propset
<<
rule
[
0
];
rule
[
0
]
=
Node
(
Node
::
property
,
line_number
,
Token
::
make
());
inner
[
0
]
=
rule
;
propset
<<
inner
;
block
<<
propset
;
// cerr << block[block.size()-1][0].content.token.to_string() << endl;
}
else
{
block
<<
rule
;
semicolon
=
true
;
}
block
[
0
].
has_statements
=
true
;
block
[
0
].
has_statements
=
true
;
semicolon
=
true
;
//lex< exactly<';'> >(); // TO DO: clean up the semicolon handling stuff
}
}
else
lex
<
exactly
<
';'
>
>
();
else
lex
<
exactly
<
';'
>
>
();
while
(
lex
<
block_comment
>
())
{
while
(
lex
<
block_comment
>
())
{
...
@@ -534,7 +551,10 @@ namespace Sass {
...
@@ -534,7 +551,10 @@ namespace Sass {
Node
Document
::
parse_rule
()
{
Node
Document
::
parse_rule
()
{
Node
rule
(
Node
::
rule
,
context
.
registry
,
line_number
,
2
);
Node
rule
(
Node
::
rule
,
context
.
registry
,
line_number
,
2
);
if
(
!
lex
<
sequence
<
optional
<
exactly
<
'*'
>
>
,
identifier
>
>
())
syntax_error
(
"invalid property name"
);
if
(
!
lex
<
sequence
<
optional
<
exactly
<
'*'
>
>
,
identifier
>
>
())
{
lex
<
spaces_and_comments
>
();
// get the line number right
syntax_error
(
"invalid property name"
);
}
rule
<<
Node
(
Node
::
property
,
line_number
,
lexed
);
rule
<<
Node
(
Node
::
property
,
line_number
,
lexed
);
if
(
!
lex
<
exactly
<
':'
>
>
())
syntax_error
(
"property
\"
"
+
lexed
.
to_string
()
+
"
\"
must be followed by a ':'"
);
if
(
!
lex
<
exactly
<
':'
>
>
())
syntax_error
(
"property
\"
"
+
lexed
.
to_string
()
+
"
\"
must be followed by a ':'"
);
rule
<<
parse_list
();
rule
<<
parse_list
();
...
...
libsass/eval_apply.cpp
View file @
7d3d0fc5
...
@@ -38,6 +38,7 @@ namespace Sass {
...
@@ -38,6 +38,7 @@ namespace Sass {
return
expr
;
return
expr
;
}
break
;
}
break
;
case
Node
:
:
propset
:
case
Node
:
:
ruleset
:
{
case
Node
:
:
ruleset
:
{
eval
(
expr
[
1
],
env
,
f_env
,
registry
);
eval
(
expr
[
1
],
env
,
f_env
,
registry
);
return
expr
;
return
expr
;
...
...
libsass/node.cpp
View file @
7d3d0fc5
...
@@ -476,19 +476,6 @@ namespace Sass {
...
@@ -476,19 +476,6 @@ namespace Sass {
{
{
case
propset
:
{
case
propset
:
{
emit_propset
(
buf
,
depth
,
""
);
emit_propset
(
buf
,
depth
,
""
);
// string prefix(string(2*depth, ' ') + at(0).content.token.to_string() + "-");
// Node rules(at(1));
// for (int i = 0; i < rules.size(); ++i) {
// buf << prefix;
// if (rules[i].type == propset) {
// rules[i].emit_nested_css(buf, depth+1);
// }
// else {
// rules[i][0].emit_nested_css(buf, depth);
// rules[i][1].emit_nested_css(buf, depth);
// buf << ';';
// }
// }
}
break
;
}
break
;
case
rule
:
case
rule
:
...
@@ -528,16 +515,25 @@ namespace Sass {
...
@@ -528,16 +515,25 @@ namespace Sass {
void
Node
::
emit_propset
(
stringstream
&
buf
,
size_t
depth
,
const
string
&
prefix
)
{
void
Node
::
emit_propset
(
stringstream
&
buf
,
size_t
depth
,
const
string
&
prefix
)
{
string
new_prefix
(
prefix
);
string
new_prefix
(
prefix
);
if
(
new_prefix
.
empty
())
new_prefix
+=
"
\n
"
;
bool
has_prefix
=
false
;
else
new_prefix
+=
"-"
;
if
(
new_prefix
.
empty
())
{
new_prefix
+=
at
(
0
).
content
.
token
.
to_string
();
new_prefix
+=
"
\n
"
;
new_prefix
+=
string
(
2
*
depth
,
' '
);
new_prefix
+=
at
(
0
).
content
.
token
.
to_string
();
}
else
{
new_prefix
+=
"-"
;
new_prefix
+=
at
(
0
).
content
.
token
.
to_string
();
has_prefix
=
true
;
}
Node
rules
(
at
(
1
));
Node
rules
(
at
(
1
));
for
(
int
i
=
0
;
i
<
rules
.
size
();
++
i
)
{
for
(
int
i
=
0
;
i
<
rules
.
size
();
++
i
)
{
buf
<<
new_prefix
;
if
(
rules
[
i
].
type
==
propset
)
{
if
(
rules
[
i
].
type
==
propset
)
{
rules
[
i
].
emit_propset
(
buf
,
depth
+
1
,
new_prefix
);
rules
[
i
].
emit_propset
(
buf
,
depth
+
1
,
new_prefix
);
}
}
else
{
else
{
buf
<<
new_prefix
;
if
(
rules
[
i
][
0
].
content
.
token
.
to_string
()
!=
""
)
buf
<<
'-'
;
rules
[
i
][
0
].
emit_nested_css
(
buf
,
depth
);
rules
[
i
][
0
].
emit_nested_css
(
buf
,
depth
);
rules
[
i
][
1
].
emit_nested_css
(
buf
,
depth
);
rules
[
i
][
1
].
emit_nested_css
(
buf
,
depth
);
buf
<<
';'
;
buf
<<
';'
;
...
...
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