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
b1580330
Commit
b1580330
authored
Apr 19, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Still working on interpolation. Don't try it yet.
parent
260bdb9c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
79 additions
and
24 deletions
+79
-24
document.hpp
document.hpp
+1
-0
document_parser.cpp
document_parser.cpp
+59
-24
eval_apply.cpp
eval_apply.cpp
+7
-0
interpolation.scss
interpolation.scss
+4
-0
node.cpp
node.cpp
+6
-0
node.hpp
node.hpp
+2
-0
No files found.
document.hpp
View file @
b1580330
...
@@ -142,6 +142,7 @@ namespace Sass {
...
@@ -142,6 +142,7 @@ namespace Sass {
Node
parse_identifier
();
Node
parse_identifier
();
Node
parse_variable
();
Node
parse_variable
();
Node
parse_function_call
();
Node
parse_function_call
();
Node
parse_value_schema
();
const
char
*
look_for_rule
(
const
char
*
start
=
0
);
const
char
*
look_for_rule
(
const
char
*
start
=
0
);
const
char
*
look_for_values
(
const
char
*
start
=
0
);
const
char
*
look_for_values
(
const
char
*
start
=
0
);
...
...
document_parser.cpp
View file @
b1580330
...
@@ -734,30 +734,65 @@ namespace Sass {
...
@@ -734,30 +734,65 @@ namespace Sass {
syntax_error
(
"error reading values after "
+
lexed
.
to_string
());
syntax_error
(
"error reading values after "
+
lexed
.
to_string
());
}
}
// Node Document::parse_value_schema()
Node
Document
::
parse_value_schema
()
// {
{
// // just an interpolant
Node
schema
;
// if (lex< interpolant >()) {
// just an interpolant
// Token insides(Token::make(lexed.begin + 2, lexed.end - 1));
if
(
lex
<
interpolant
>
())
{
// Document interp_doc(path, line_number, insides, context);
Token
insides
(
Token
::
make
(
lexed
.
begin
+
2
,
lexed
.
end
-
1
));
// Node interp_node(interp_doc.parse_list());
Document
interp_doc
(
path
,
line_number
,
insides
,
context
);
// if (peek< alternatives< spaces, block_comment, line_comment
Node
interp_node
(
interp_doc
.
parse_list
());
// exactly<';'>, exactly<','>,
if
(
peek
<
alternatives
<
spaces
,
comment
,
// exactly<'('>, exactly<')'> > >()) {
exactly
<
';'
>
,
exactly
<
','
>
,
// return interp_node;
exactly
<
'('
>
,
exactly
<
')'
>
>
>
())
{
// }
return
interp_node
;
//
}
//
// interpolant with stuff immediately behind it
// Node schema(Node::value_schema, context.registry, 2);
else
{
//
schema
=
Node
(
Node
::
value_schema
,
context
.
registry
,
line_number
,
2
);
// while (true) {
schema
<<
interp_node
;
// if (lex< interpolant
}
//
}
//
//
while
(
true
)
{
//
if
(
lex
<
interpolant
>
())
{
//
Token
insides
(
Token
::
make
(
lexed
.
begin
+
2
,
lexed
.
end
-
1
));
// }
Document
interp_doc
(
path
,
line_number
,
insides
,
context
);
Node
interp_node
(
interp_doc
.
parse_list
());
schema
<<
interp_node
;
}
else
if
(
lex
<
identifier
>
())
{
schema
<<
Node
(
Node
::
identifier
,
line_number
,
lexed
);
}
else
if
(
lex
<
percentage
>
())
{
schema
<<
Node
(
Node
::
textual_percentage
,
line_number
,
lexed
);
}
else
if
(
lex
<
dimension
>
())
{
schema
<<
Node
(
Node
::
textual_dimension
,
line_number
,
lexed
);
}
else
if
(
lex
<
number
>
())
{
schema
<<
Node
(
Node
::
textual_number
,
line_number
,
lexed
);
}
else
if
(
lex
<
hex
>
())
{
schema
<<
Node
(
Node
::
textual_hex
,
line_number
,
lexed
);
}
else
if
(
lex
<
string_constant
>
())
{
schema
<<
Node
(
Node
::
string_constant
,
line_number
,
lexed
);
}
else
if
(
lex
<
variable
>
())
{
schema
<<
Node
(
Node
::
variable
,
line_number
,
lexed
);
}
else
{
syntax_error
(
"error parsing interpolated value"
);
}
if
(
peek
<
alternatives
<
spaces
,
comment
,
exactly
<
';'
>
,
exactly
<
','
>
,
exactly
<
'('
>
,
exactly
<
')'
>
>
>
())
{
break
;
}
}
return
schema
;
}
Node
Document
::
parse_function_call
()
Node
Document
::
parse_function_call
()
{
{
...
...
eval_apply.cpp
View file @
b1580330
...
@@ -220,6 +220,13 @@ namespace Sass {
...
@@ -220,6 +220,13 @@ namespace Sass {
return
apply_function
(
f_env
[
sig
],
expr
[
1
],
env
,
f_env
,
registry
);
return
apply_function
(
f_env
[
sig
],
expr
[
1
],
env
,
f_env
,
registry
);
}
break
;
}
break
;
case
Node
:
:
value_schema
:
{
for
(
int
i
=
0
;
i
<
expr
.
size
();
++
i
)
{
expr
[
i
]
=
eval
(
expr
[
i
],
env
,
f_env
,
registry
);
}
return
expr
;
}
break
;
default:
{
default:
{
return
expr
;
return
expr
;
}
}
...
...
interpolation.scss
View file @
b1580330
$x
:
bar
;
$x
:
bar
;
$blux
:
inside
blux
;
div
{
div
{
a
:
blah
foo
#{
$x
}
;
a
:
blah
foo
#{
$x
}
;
...
@@ -10,4 +11,6 @@ div {
...
@@ -10,4 +11,6 @@ div {
e
:
12fa
#{
lse
}
345
;
e
:
12fa
#{
lse
}
345
;
f
:
12
+
#{
3
}
,
12
(
#{
3
}
);
f
:
12
+
#{
3
}
,
12
(
#{
3
}
);
g
:
(
12
)
34
,
12
(
34
);
g
:
(
12
)
34
,
12
(
34
);
h
:
#fff
#{
f
}
;
j
:
$bl
#{
ux
}
;
}
}
\ No newline at end of file
node.cpp
View file @
b1580330
...
@@ -272,6 +272,12 @@ namespace Sass {
...
@@ -272,6 +272,12 @@ namespace Sass {
return
"!important"
;
return
"!important"
;
}
break
;
}
break
;
case
value_schema
:
{
string
result
;
for
(
int
i
=
0
;
i
<
size
();
++
i
)
result
+=
at
(
i
).
to_string
(
""
);
return
result
;
}
break
;
default
:
{
default
:
{
// return content.token.to_string();
// return content.token.to_string();
if
(
!
has_children
&&
type
!=
flags
)
return
content
.
token
.
to_string
();
if
(
!
has_children
&&
type
!=
flags
)
return
content
.
token
.
to_string
();
...
...
node.hpp
View file @
b1580330
...
@@ -76,6 +76,8 @@ namespace Sass {
...
@@ -76,6 +76,8 @@ namespace Sass {
boolean
,
boolean
,
important
,
important
,
value_schema
,
function_call
,
function_call
,
mixin
,
mixin
,
parameters
,
parameters
,
...
...
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