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
c7f07857
Commit
c7f07857
authored
Apr 27, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented string interpolation.
parent
d1dd655c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
4 deletions
+16
-4
document_parser.cpp
document_parser.cpp
+7
-3
node.cpp
node.cpp
+9
-1
No files found.
document_parser.cpp
View file @
c7f07857
...
@@ -848,15 +848,19 @@ namespace Sass {
...
@@ -848,15 +848,19 @@ namespace Sass {
while
(
i
<
str
.
end
)
{
while
(
i
<
str
.
end
)
{
p
=
find_first_in_interval
<
sequence
<
negate
<
exactly
<
'\\'
>
>
,
exactly
<
hash_lbrace
>
>
>
(
i
,
str
.
end
);
p
=
find_first_in_interval
<
sequence
<
negate
<
exactly
<
'\\'
>
>
,
exactly
<
hash_lbrace
>
>
>
(
i
,
str
.
end
);
if
(
p
)
{
if
(
p
)
{
if
(
i
<
p
)
schema
<<
Node
(
Node
::
identifier
,
line_number
,
Token
::
make
(
i
,
p
));
// accumulate the preceding segment if it's nonempty
if
(
i
<
p
)
{
schema
<<
Node
(
Node
::
identifier
,
line_number
,
Token
::
make
(
i
,
p
-
2
));
// accumulate the preceding segment if it's nonempty
// cerr << '[' << Token::make(i,p-2).to_string() << ']' << endl;
}
const
char
*
j
=
find_first_in_interval
<
exactly
<
rbrace
>
>
(
p
,
str
.
end
);
// find the closing brace
const
char
*
j
=
find_first_in_interval
<
exactly
<
rbrace
>
>
(
p
,
str
.
end
);
// find the closing brace
if
(
j
)
{
if
(
j
)
{
// parse the interpolant and accumulate it
// parse the interpolant and accumulate it
Document
interp_doc
(
path
,
line_number
,
Token
::
make
(
p
+
2
,
j
-
1
),
context
);
// cerr << '[' << Token::make(p, j-1).to_string() << ']' << endl;
Document
interp_doc
(
path
,
line_number
,
Token
::
make
(
p
,
j
-
1
),
context
);
Node
interp_node
(
interp_doc
.
parse_list
());
Node
interp_node
(
interp_doc
.
parse_list
());
interp_node
.
eval_me
=
true
;
interp_node
.
eval_me
=
true
;
schema
<<
interp_node
;
schema
<<
interp_node
;
i
=
j
+
1
;
i
=
j
;
}
}
else
{
else
{
// throw an error if the interpolant is unterminated
// throw an error if the interpolant is unterminated
...
...
node.cpp
View file @
c7f07857
...
@@ -325,7 +325,15 @@ namespace Sass {
...
@@ -325,7 +325,15 @@ namespace Sass {
case
string_schema
:
{
case
string_schema
:
{
string
result
;
string
result
;
for
(
size_t
i
=
0
;
i
<
size
();
++
i
)
result
+=
at
(
i
).
to_string
(
""
);
for
(
size_t
i
=
0
;
i
<
size
();
++
i
)
{
string
chunk
(
at
(
i
).
to_string
(
""
));
if
(
at
(
i
).
type
==
string_constant
)
{
result
+=
chunk
.
substr
(
1
,
chunk
.
size
()
-
2
);
}
else
{
result
+=
chunk
;
}
}
return
result
;
return
result
;
}
break
;
}
break
;
...
...
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