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
38b47f2f
Commit
38b47f2f
authored
Apr 04, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removing log messages and adding a test case for builtin functions.
parent
d008daf9
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
7 deletions
+20
-7
context.cpp
context.cpp
+3
-5
eval_apply.cpp
eval_apply.cpp
+0
-1
functions.cpp
functions.cpp
+7
-1
functions.hpp
functions.hpp
+3
-0
input.scss
spec/basic/21_one_builtin_function/input.scss
+4
-0
output.css
spec/basic/21_one_builtin_function/output.css
+3
-0
No files found.
context.cpp
View file @
38b47f2f
...
...
@@ -21,17 +21,14 @@ namespace Sass {
}
inline
void
Context
::
register_function
(
Function_Descriptor
d
,
Implementation
ip
)
{
function_env
[
d
[
0
]]
=
Function
(
d
,
ip
);
cerr
<<
"Registered function: "
<<
d
[
0
]
<<
endl
;
cerr
<<
"Verifying "
<<
function_env
[
string
(
d
[
0
])].
name
<<
endl
;
}
{
function_env
[
d
[
0
]]
=
Function
(
d
,
ip
);
}
void
Context
::
register_functions
()
{
using
namespace
Functions
;
register_function
(
rgb_descriptor
,
rgb
);
register_function
(
rgba_descriptor
,
rgba
);
register_function
(
curse_descriptor
,
curse
);
}
}
\ No newline at end of file
eval_apply.cpp
View file @
38b47f2f
...
...
@@ -148,7 +148,6 @@ namespace Sass {
case
Node
:
:
function_call
:
{
// TO DO: default-constructed Function should be a generic callback
cerr
<<
"about to apply "
<<
expr
[
0
].
content
.
token
.
to_string
()
<<
endl
;
return
apply_function
(
f_env
[
expr
[
0
].
content
.
token
.
to_string
()],
expr
[
1
],
env
,
f_env
);
}
break
;
...
...
functions.cpp
View file @
38b47f2f
#include "functions.hpp"
#include <iostream>
#
using
std
::
cerr
;
using
std
::
endl
;
namespace
Sass
{
...
...
@@ -10,7 +11,6 @@ namespace Sass {
Function_Descriptor
rgb_descriptor
=
{
"rgb"
,
"$red"
,
"$green"
,
"$blue"
,
0
};
Node
rgb
(
const
vector
<
Token
>&
parameters
,
map
<
Token
,
Node
>&
bindings
)
{
cerr
<<
"rgb arg count: "
<<
bindings
.
size
()
<<
endl
;
Node
color
(
Node
::
numeric_color
,
0
,
3
);
color
<<
bindings
[
parameters
[
0
]]
<<
bindings
[
parameters
[
1
]]
...
...
@@ -29,5 +29,10 @@ namespace Sass {
return
color
;
}
extern
const
char
*
the_curse
=
"Damn!"
;
Function_Descriptor
curse_descriptor
=
{
"curse"
,
0
};
Node
curse
(
const
vector
<
Token
>&
parameters
,
map
<
Token
,
Node
>&
bindings
)
{
return
Node
(
Node
::
identifier
,
0
,
Token
::
make
(
the_curse
,
the_curse
+
std
::
strlen
(
the_curse
)));
}
}
}
\ No newline at end of file
functions.hpp
View file @
38b47f2f
...
...
@@ -48,6 +48,9 @@ namespace Sass {
extern
Function_Descriptor
rgba_descriptor
;
Node
rgba
(
const
vector
<
Token
>&
parameters
,
map
<
Token
,
Node
>&
bindings
);
extern
Function_Descriptor
curse_descriptor
;
Node
curse
(
const
vector
<
Token
>&
parameters
,
map
<
Token
,
Node
>&
bindings
);
}
}
spec/basic/21_one_builtin_function/input.scss
0 → 100644
View file @
38b47f2f
div
{
color
:
rgb
(
255
,
$blue
:
0
,
$green
:
255
);
background
:
rgb
(
123
,
45
,
6
);
}
spec/basic/21_one_builtin_function/output.css
0 → 100644
View file @
38b47f2f
div
{
color
:
yellow
;
background
:
#7b2d06
;
}
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