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
a597ae8c
Commit
a597ae8c
authored
Sep 11, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Converting the quote and unquote built-ins.
parent
097c2a4c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
28 deletions
+29
-28
functions.cpp
functions.cpp
+26
-26
node.hpp
node.hpp
+3
-2
No files found.
functions.cpp
View file @
a597ae8c
...
...
@@ -80,6 +80,7 @@ namespace Sass {
return
number_name
;
}
break
;
case
Node
:
:
string_t
:
case
Node
:
:
identifier
:
case
Node
:
:
value_schema
:
case
Node
:
:
identifier_schema
:
...
...
@@ -124,6 +125,21 @@ namespace Sass {
if
(
the_arg
.
is_numeric
())
return
the_arg
;
}
break
;
case
Node
:
:
string_t
:
{
switch
(
arg_type
)
{
case
Node
:
:
identifier
:
case
Node
:
:
value_schema
:
case
Node
:
:
identifier_schema
:
case
Node
:
:
string_constant
:
case
Node
:
:
string_schema
:
case
Node
:
:
concatenation
:
return
the_arg
;
default:
break
;
}
break
;
}
break
;
case
Node
:
:
list
:
{
if
(
arg_type
==
Node
::
space_list
||
arg_type
==
Node
::
comma_list
)
return
the_arg
;
}
break
;
...
...
@@ -522,7 +538,8 @@ namespace Sass {
////////////////////////////////////////////////////////////////////////
// Other Color Functions ///////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
// not worth using the arg(...) functions
extern
Signature
adjust_color_sig
=
"adjust-color($color, $red: false, $green: false, $blue: false, $hue: false, $saturation: false, $lightness: false, $alpha: false)"
;
Node
adjust_color
(
const
Node
parameter_names
,
Environment
&
bindings
,
Node_Factory
&
new_Node
,
string
&
path
,
size_t
line
)
{
Node
color
(
bindings
[
parameter_names
[
0
].
token
()]);
...
...
@@ -651,36 +668,19 @@ namespace Sass {
extern
Signature
unquote_sig
=
"unquote($string)"
;
Node
unquote
(
const
Node
parameter_names
,
Environment
&
bindings
,
Node_Factory
&
new_Node
,
string
&
path
,
size_t
line
)
{
Node
cpy
(
new_Node
(
bindings
[
parameter_names
[
0
].
token
()]));
// if (cpy.type() != Node::string_constant /* && cpy.type() != Node::concatenation */) {
// throw_eval_error("argument to unquote must be a string", cpy.path(), cpy.line());
// }
cpy
.
is_unquoted
()
=
true
;
cpy
.
is_quoted
()
=
false
;
Node
cpy
(
new_Node
(
path
,
line
,
bindings
[
parameter_names
[
0
].
token
()]));
cpy
.
is_unquoted
()
=
true
;
// in case it happens to be a string
cpy
.
is_quoted
()
=
false
;
// in case it happens to be an identifier
return
cpy
;
}
extern
Signature
quote_sig
=
"quote($string)"
;
Node
quote
(
const
Node
parameter_names
,
Environment
&
bindings
,
Node_Factory
&
new_Node
,
string
&
path
,
size_t
line
)
{
Node
orig
(
bindings
[
parameter_names
[
0
].
token
()]);
switch
(
orig
.
type
())
{
default:
{
throw_eval_error
(
"argument to quote must be a string or identifier"
,
orig
.
path
(),
orig
.
line
());
}
break
;
case
Node
:
:
string_constant
:
case
Node
:
:
string_schema
:
case
Node
:
:
identifier
:
case
Node
:
:
identifier_schema
:
case
Node
:
:
concatenation
:
{
Node
cpy
(
new_Node
(
orig
));
cpy
.
is_unquoted
()
=
false
;
cpy
.
is_quoted
()
=
true
;
return
cpy
;
}
break
;
}
return
orig
;
Node
orig
(
arg
(
quote_sig
,
path
,
line
,
parameter_names
,
bindings
,
0
,
Node
::
string_t
));
Node
copy
(
new_Node
(
path
,
line
,
orig
));
copy
.
is_unquoted
()
=
false
;
// in case it happens to be a string
copy
.
is_quoted
()
=
true
;
// in case it happens to be an identifier
return
copy
;
}
////////////////////////////////////////////////////////////////////////
...
...
node.hpp
View file @
a597ae8c
...
...
@@ -72,8 +72,9 @@ namespace Sass {
enum
Type
{
none
,
any
,
list
,
// space_list or comma_list
numeric
,
// number, numeric_percentage, or numeric_dimension
numeric
,
// number, numeric_percentage, or numeric_dimension
string_t
,
// string_constant, identifier, concatenation, schemata
list
,
// space_list or comma_list
comment
,
root
,
...
...
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