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
b0693709
Commit
b0693709
authored
Apr 05, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented the "quote" and "unquote" builtins.
parent
ac99e122
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
4 deletions
+43
-4
context.cpp
context.cpp
+4
-0
functions.cpp
functions.cpp
+18
-3
functions.hpp
functions.hpp
+9
-0
node.cpp
node.cpp
+10
-1
node.hpp
node.hpp
+2
-0
No files found.
context.cpp
View file @
b0693709
...
...
@@ -41,6 +41,9 @@ namespace Sass {
register_function
(
mix_3_descriptor
,
mix_3
);
// HSL Functions
register_function
(
invert_descriptor
,
invert
);
// String Functions
register_function
(
unquote_descriptor
,
unquote
);
register_function
(
quote_descriptor
,
quote
);
}
}
\ No newline at end of file
functions.cpp
View file @
b0693709
...
...
@@ -102,10 +102,25 @@ namespace Sass {
orig
[
3
].
content
.
numeric_value
);
}
// String Functions ////////////////////////////////////////////////////
Function_Descriptor
unquote_descriptor
=
{
"unquote"
,
"$string"
,
0
};
Node
unquote
(
const
vector
<
Token
>&
parameters
,
map
<
Token
,
Node
>&
bindings
)
{
Node
cpy
(
bindings
[
parameters
[
0
]].
clone
());
cpy
.
unquoted
=
true
;
return
cpy
;
}
Function_Descriptor
quote_descriptor
=
{
"quote"
,
"$string"
,
0
};
Node
quote
(
const
vector
<
Token
>&
parameters
,
map
<
Token
,
Node
>&
bindings
)
{
Node
cpy
(
bindings
[
parameters
[
0
]].
clone
());
// check the types -- will probably be an identifier
cpy
.
type
=
Node
::
string_constant
;
cpy
.
unquoted
=
false
;
return
cpy
;
}
...
...
functions.hpp
View file @
b0693709
...
...
@@ -43,6 +43,7 @@ namespace Sass {
};
namespace
Functions
{
// RGB Functions ///////////////////////////////////////////////////////
extern
Function_Descriptor
rgb_descriptor
;
Node
rgb
(
const
vector
<
Token
>&
parameters
,
map
<
Token
,
Node
>&
bindings
);
...
...
@@ -67,8 +68,16 @@ namespace Sass {
extern
Function_Descriptor
mix_3_descriptor
;
Node
mix_3
(
const
vector
<
Token
>&
parameters
,
map
<
Token
,
Node
>&
bindings
);
// HSL Functions ///////////////////////////////////////////////////////
extern
Function_Descriptor
invert_descriptor
;
Node
invert
(
const
vector
<
Token
>&
parameters
,
map
<
Token
,
Node
>&
bindings
);
// String Functions ////////////////////////////////////////////////////
extern
Function_Descriptor
unquote_descriptor
;
Node
unquote
(
const
vector
<
Token
>&
parameters
,
map
<
Token
,
Node
>&
bindings
);
extern
Function_Descriptor
quote_descriptor
;
Node
quote
(
const
vector
<
Token
>&
parameters
,
map
<
Token
,
Node
>&
bindings
);
}
}
node.cpp
View file @
b0693709
...
...
@@ -220,7 +220,16 @@ namespace Sass {
// string result("MIXIN CALL: ");
// return result;
// } break;
case
string_constant
:
{
if
(
unquoted
)
return
content
.
token
.
unquote
();
else
{
string
result
(
content
.
token
.
to_string
());
if
(
result
[
0
]
!=
'"'
&&
result
[
0
]
!=
'\''
)
return
"
\"
"
+
result
+
"
\"
"
;
else
return
result
;
}
}
break
;
default
:
{
// return content.token.to_string();
if
(
!
has_children
&&
type
!=
flags
)
return
content
.
token
.
to_string
();
...
...
node.hpp
View file @
b0693709
...
...
@@ -87,6 +87,7 @@ namespace Sass {
bool
has_backref
;
bool
from_variable
;
bool
eval_me
;
bool
unquoted
;
union
{
Token
token
;
...
...
@@ -102,6 +103,7 @@ namespace Sass {
type
=
none
;
line_number
=
0
;
has_children
=
false
;
has_statements
=
false
;
has_blocks
=
false
;
has_expansions
=
false
;
has_backref
=
false
;
from_variable
=
false
;
eval_me
=
false
;
unquoted
=
false
;
}
size_t
size
()
const
...
...
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