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
f5290379
Commit
f5290379
authored
Mar 27, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor tweaks.
parent
bfb7afa2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
22 deletions
+20
-22
document.hpp
document.hpp
+2
-2
document_evaluator.cpp
document_evaluator.cpp
+4
-0
document_parser.cpp
document_parser.cpp
+10
-16
node.cpp
node.cpp
+3
-3
node.hpp
node.hpp
+1
-1
No files found.
document.hpp
View file @
f5290379
...
...
@@ -109,8 +109,8 @@ namespace Sass {
}
}
void
parse_scss
(
bool
definition
=
false
);
Node
parse_import
(
bool
definition
=
false
);
void
parse_scss
();
Node
parse_import
();
Node
parse_include
();
Node
parse_mixin_definition
();
Node
parse_mixin_parameters
();
...
...
document_evaluator.cpp
View file @
f5290379
...
...
@@ -34,6 +34,10 @@ namespace Sass {
n
[
1
]
=
eval
(
n
[
1
],
context
.
environment
);
}
}
break
;
case
Node
:
:
expansion
:
{
}
break
;
}
}
}
...
...
document_parser.cpp
View file @
f5290379
...
...
@@ -5,7 +5,7 @@
namespace
Sass
{
using
namespace
std
;
void
Document
::
parse_scss
(
bool
definition
)
void
Document
::
parse_scss
()
{
lex
<
optional_spaces
>
();
while
(
*
position
)
{
...
...
@@ -13,13 +13,11 @@ namespace Sass {
root
<<
Node
(
line_number
,
Node
::
comment
,
lexed
);
}
else
if
(
peek
<
import
>
(
position
))
{
root
+=
parse_import
(
definition
);
root
+=
parse_import
();
lex
<
exactly
<
';'
>
>
();
}
else
if
(
peek
<
mixin
>
(
position
))
{
// TO DO: check to see if we're already inside a definition in order
// to disallow definitions that are sneakily nested via imports.
if
(
!
definition
)
context
.
pending
.
push_back
(
parse_mixin_definition
());
context
.
pending
.
push_back
(
parse_mixin_definition
());
}
else
if
(
peek
<
include
>
(
position
))
{
Node
call
(
parse_mixin_call
());
...
...
@@ -28,26 +26,21 @@ namespace Sass {
root
.
has_rulesets
|=
call
.
has_rulesets
;
root
.
has_propsets
|=
call
.
has_propsets
;
lex
<
exactly
<
';'
>
>
();
if
(
!
definition
)
context
.
pending
.
push_back
(
call
);
context
.
pending
.
push_back
(
call
);
}
else
if
(
peek
<
variable
>
(
position
))
{
Node
assn
(
parse_assignment
());
lex
<
exactly
<
';'
>
>
();
if
(
!
definition
)
{
context
.
pending
.
push_back
(
assn
);
}
else
{
root
<<
assn
;
}
context
.
pending
.
push_back
(
assn
);
}
else
{
root
<<
parse_ruleset
(
definition
);
root
<<
parse_ruleset
();
}
lex
<
optional_spaces
>
();
}
}
Node
Document
::
parse_import
(
bool
definition
)
Node
Document
::
parse_import
()
{
lex
<
import
>
();
lex
<
string_constant
>
();
...
...
@@ -56,7 +49,7 @@ namespace Sass {
const
char
*
curr_path_end
=
folders
(
curr_path_start
);
string
current_path
(
curr_path_start
,
curr_path_end
-
curr_path_start
);
Document
importee
(
current_path
+
import_path
,
context
);
importee
.
parse_scss
(
definition
);
importee
.
parse_scss
();
return
importee
.
root
;
}
...
...
@@ -117,7 +110,7 @@ namespace Sass {
lex
<
identifier
>
();
Node
name
(
line_number
,
Node
::
identifier
,
lexed
);
Node
args
(
parse_mixin_arguments
());
Node
call
(
line_number
,
Node
::
mixin_
expansion
,
2
);
Node
call
(
line_number
,
Node
::
expansion
,
2
);
call
<<
name
<<
args
;
return
call
;
}
...
...
@@ -325,6 +318,7 @@ namespace Sass {
semicolon
=
true
;
}
else
if
(
peek
<
import
>
(
position
))
{
// TO DO: disallow imports inside of definitions
Node
imported_tree
(
parse_import
());
for
(
int
i
=
0
;
i
<
imported_tree
.
size
();
++
i
)
{
if
(
imported_tree
[
i
].
type
==
Node
::
comment
||
...
...
node.cpp
View file @
f5290379
...
...
@@ -213,8 +213,8 @@ namespace Sass {
return
result
;
}
break
;
case
mixin_
expansion
:
{
string
result
(
"MIXIN: "
);
case
expansion
:
{
string
result
(
"MIXIN
CALL
: "
);
return
result
;
}
break
;
...
...
@@ -325,7 +325,7 @@ namespace Sass {
if
(
stm_type
==
comment
||
stm_type
==
rule
)
{
block
[
i
].
emit_nested_css
(
buf
,
depth
+
1
);
// NEED OVERLOADED VERSION FOR COMMENTS AND RULES
}
else
if
(
stm_type
==
mixin_
expansion
)
{
else
if
(
stm_type
==
expansion
)
{
buf
<<
endl
<<
string
(
2
*
(
depth
+
1
),
' '
)
<<
block
[
i
].
to_string
(
""
);
// TEMPORARY
for
(
int
j
=
0
;
j
<
block
[
i
].
size
();
++
j
)
{
block
[
i
][
j
].
emit_nested_css
(
buf
,
depth
+
1
);
...
...
node.hpp
View file @
f5290379
...
...
@@ -64,7 +64,7 @@ namespace Sass {
mixin
,
parameters
,
mixin_
expansion
,
expansion
,
arguments
,
variable
,
...
...
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