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