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
909199cf
Commit
909199cf
authored
May 23, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renaming a variable/method.
parent
e2021333
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
43 additions
and
42 deletions
+43
-42
document.cpp
document.cpp
+6
-6
document.hpp
document.hpp
+3
-3
document_parser.cpp
document_parser.cpp
+0
-0
eval_apply.cpp
eval_apply.cpp
+1
-1
eval_apply.hpp
eval_apply.hpp
+5
-4
node.cpp
node.cpp
+2
-2
node.hpp
node.hpp
+6
-6
node_factory.cpp
node_factory.cpp
+19
-19
sass_interface.cpp
sass_interface.cpp
+1
-1
No files found.
document.cpp
View file @
909199cf
...
...
@@ -16,7 +16,7 @@ namespace Sass {
source
(
doc
.
source
),
position
(
doc
.
position
),
end
(
doc
.
end
),
line
_number
(
doc
.
line_number
),
line
(
doc
.
line
),
own_source
(
doc
.
own_source
),
context
(
doc
.
context
),
root
(
doc
.
root
),
...
...
@@ -44,7 +44,7 @@ namespace Sass {
Document
doc
(
ctx
);
doc
.
path
=
path
;
doc
.
line
_number
=
1
;
doc
.
line
=
1
;
doc
.
root
=
ctx
.
new_Node
(
Node
::
root
,
path
,
1
,
0
);
doc
.
lexed
=
Token
::
make
();
doc
.
own_source
=
true
;
...
...
@@ -60,7 +60,7 @@ namespace Sass {
{
Document
doc
(
ctx
);
doc
.
path
=
path
;
doc
.
line
_number
=
1
;
doc
.
line
=
1
;
doc
.
root
=
ctx
.
new_Node
(
Node
::
root
,
path
,
1
,
0
);
doc
.
lexed
=
Token
::
make
();
doc
.
own_source
=
false
;
...
...
@@ -75,7 +75,7 @@ namespace Sass {
{
Document
doc
(
ctx
);
doc
.
path
=
path
;
doc
.
line
_number
=
line_number
;
doc
.
line
=
line_number
;
doc
.
root
=
ctx
.
new_Node
(
Node
::
root
,
path
,
1
,
0
);
doc
.
lexed
=
Token
::
make
();
doc
.
own_source
=
false
;
...
...
@@ -87,10 +87,10 @@ namespace Sass {
}
void
Document
::
throw_syntax_error
(
string
message
,
size_t
ln
)
{
throw
Error
(
Error
::
syntax
,
ln
?
ln
:
line
_number
,
path
,
message
);
}
{
throw
Error
(
Error
::
syntax
,
ln
?
ln
:
line
,
path
,
message
);
}
void
Document
::
throw_read_error
(
string
message
,
size_t
ln
)
{
throw
Error
(
Error
::
read
,
ln
?
ln
:
line
_number
,
path
,
message
);
}
{
throw
Error
(
Error
::
read
,
ln
?
ln
:
line
,
path
,
message
);
}
using
std
::
string
;
using
std
::
stringstream
;
...
...
document.hpp
View file @
909199cf
...
...
@@ -20,7 +20,7 @@ namespace Sass {
char
*
source
;
const
char
*
position
;
const
char
*
end
;
size_t
line
_number
;
size_t
line
;
bool
own_source
;
Context
&
context
;
...
...
@@ -89,7 +89,7 @@ namespace Sass {
else
if
(
mx
==
spaces
)
{
after_whitespace
=
spaces
(
position
);
if
(
after_whitespace
)
{
line
_number
+=
count_interval
<
'\n'
>
(
position
,
after_whitespace
);
line
+=
count_interval
<
'\n'
>
(
position
,
after_whitespace
);
lexed
=
Token
::
make
(
position
,
after_whitespace
);
return
position
=
after_whitespace
;
}
...
...
@@ -105,7 +105,7 @@ namespace Sass {
}
const
char
*
after_token
=
mx
(
after_whitespace
);
if
(
after_token
)
{
line
_number
+=
count_interval
<
'\n'
>
(
position
,
after_token
);
line
+=
count_interval
<
'\n'
>
(
position
,
after_token
);
lexed
=
Token
::
make
(
after_whitespace
,
after_token
);
return
position
=
after_token
;
}
...
...
document_parser.cpp
View file @
909199cf
This diff is collapsed.
Click to expand it.
eval_apply.cpp
View file @
909199cf
...
...
@@ -6,7 +6,7 @@
namespace
Sass
{
using
std
::
cerr
;
using
std
::
endl
;
static
void
eval_error
(
string
message
,
size_t
line_number
,
const
char
*
file_name
)
static
void
throw_
eval_error
(
string
message
,
size_t
line_number
,
const
char
*
file_name
)
{
string
fn
;
if
(
file_name
)
{
...
...
eval_apply.hpp
View file @
909199cf
...
...
@@ -11,10 +11,10 @@
namespace
Sass
{
using
std
::
map
;
Node
eval
(
Node
&
expr
,
Environment
&
env
,
map
<
pair
<
string
,
size_t
>
,
Function
>&
f_env
,
vector
<
vector
<
Node
>*>&
registry
);
Node
accumulate
(
Node
::
Type
op
,
Node
&
acc
,
Node
&
rhs
,
vector
<
vector
<
Node
>*>&
registry
);
Node
eval
(
Node
&
expr
,
Environment
&
env
,
map
<
pair
<
string
,
size_t
>
,
Function
>&
f_env
,
Node_Factory
&
new_Node
);
Node
accumulate
(
Node
::
Type
op
,
Node
&
acc
,
Node
&
rhs
,
Node_Factory
&
new_Node
);
double
operate
(
Node
::
Type
op
,
double
lhs
,
double
rhs
);
Node
apply_mixin
(
Node
&
mixin
,
const
Node
&
args
,
Environment
&
env
,
map
<
pair
<
string
,
size_t
>
,
Function
>&
f_env
,
vector
<
vector
<
Node
>*>&
registry
);
Node
apply_function
(
const
Function
&
f
,
const
Node
&
args
,
Environment
&
env
,
map
<
pair
<
string
,
size_t
>
,
Function
>&
f_env
,
vector
<
vector
<
Node
>*>&
registry
);
Node
apply_mixin
(
Node
&
mixin
,
const
Node
&
args
,
Environment
&
env
,
map
<
pair
<
string
,
size_t
>
,
Function
>&
f_env
,
Node_Factory
&
new_Node
);
Node
apply_function
(
const
Function
&
f
,
const
Node
&
args
,
Environment
&
env
,
map
<
pair
<
string
,
size_t
>
,
Function
>&
f_env
,
Node_Factory
&
new_Node
);
}
\ No newline at end of file
node.cpp
View file @
909199cf
...
...
@@ -82,11 +82,11 @@ namespace Sass {
return
numeric_value
()
<
rhs
.
numeric_value
();
}
else
{
throw
Error
(
Error
::
evaluation
,
line
_number
(),
file_name
(),
"incompatible units"
);
throw
Error
(
Error
::
evaluation
,
line
(),
path
(),
"incompatible units"
);
}
}
else
{
throw
Error
(
Error
::
evaluation
,
line
_number
(),
file_name
(),
"incomparable types"
);
throw
Error
(
Error
::
evaluation
,
line
(),
path
(),
"incomparable types"
);
}
}
...
...
node.hpp
View file @
909199cf
...
...
@@ -163,8 +163,8 @@ namespace Sass {
bool
is_unquoted
()
const
;
bool
is_numeric
()
const
;
string
&
file_name
()
const
;
size_t
line
_number
()
const
;
string
&
path
()
const
;
size_t
line
()
const
;
size_t
size
()
const
;
bool
empty
()
const
;
...
...
@@ -200,8 +200,8 @@ namespace Sass {
// TO DO: look into using a custom allocator in the Node_Factory class
vector
<
Node
>
children
;
// Can't be in the union because it has non-trivial constructors!
string
file_name
;
size_t
line
_number
;
string
path
;
size_t
line
;
Node
::
Type
type
;
...
...
@@ -296,8 +296,8 @@ namespace Sass {
inline
bool
Node
::
is_unquoted
()
const
{
return
ip_
->
is_unquoted
;
}
inline
bool
Node
::
is_numeric
()
const
{
return
ip_
->
is_numeric
();
}
inline
string
&
Node
::
file_name
()
const
{
return
ip_
->
file_name
;
}
inline
size_t
Node
::
line
_number
()
const
{
return
ip_
->
line_number
;
}
inline
string
&
Node
::
path
()
const
{
return
ip_
->
path
;
}
inline
size_t
Node
::
line
()
const
{
return
ip_
->
line
;
}
inline
size_t
Node
::
size
()
const
{
return
ip_
->
size
();
}
inline
bool
Node
::
empty
()
const
{
return
ip_
->
empty
();
}
...
...
node_factory.cpp
View file @
909199cf
...
...
@@ -2,13 +2,13 @@
namespace
Sass
{
Node_Impl
*
Node_Factory
::
alloc_Node_Impl
(
Node
::
Type
type
,
string
file
,
size_t
line
)
Node_Impl
*
Node_Factory
::
alloc_Node_Impl
(
Node
::
Type
type
,
string
path
,
size_t
line
)
{
Node_Impl
*
ip
=
new
Node_Impl
();
ip
->
type
=
type
;
if
(
type
==
Node
::
backref
)
ip
->
has_backref
=
true
;
ip
->
file_name
=
file
;
ip
->
line
_number
=
line
;
ip
->
path
=
path
;
ip
->
line
=
line
;
pool_
.
push_back
(
ip
);
return
ip
;
}
...
...
@@ -35,17 +35,17 @@ namespace Sass {
}
// for making leaf nodes out of terminals/tokens
Node
Node_Factory
::
operator
()(
Node
::
Type
type
,
string
file
,
size_t
line
,
Token
&
t
)
Node
Node_Factory
::
operator
()(
Node
::
Type
type
,
string
path
,
size_t
line
,
Token
&
t
)
{
Node_Impl
*
ip
=
alloc_Node_Impl
(
type
,
file
,
line
);
Node_Impl
*
ip
=
alloc_Node_Impl
(
type
,
path
,
line
);
ip
->
value
.
token
=
t
;
return
Node
(
ip
);
}
// for making boolean values or interior nodes that have children
Node
Node_Factory
::
operator
()(
Node
::
Type
type
,
string
file
,
size_t
line
,
size_t
size
)
Node
Node_Factory
::
operator
()(
Node
::
Type
type
,
string
path
,
size_t
line
,
size_t
size
)
{
Node_Impl
*
ip
=
alloc_Node_Impl
(
type
,
file
,
line
);
Node_Impl
*
ip
=
alloc_Node_Impl
(
type
,
path
,
line
);
if
(
type
==
Node
::
boolean
)
ip
->
value
.
boolean
=
size
;
else
ip
->
children
.
reserve
(
size
);
...
...
@@ -53,38 +53,38 @@ namespace Sass {
return
Node
(
ip
);
}
// Node Node_Factory::operator()(Node::Type type, string
file
, size_t line, bool b)
// Node Node_Factory::operator()(Node::Type type, string
path
, size_t line, bool b)
// {
// Node_Impl* ip = alloc_Node_Impl(type,
file
, line);
// Node_Impl* ip = alloc_Node_Impl(type,
path
, line);
// ip->content.boolean_value = b;
// return Node(ip);
// }
// for making nodes representing numbers
Node
Node_Factory
::
operator
()(
string
file
,
size_t
line
,
double
v
)
Node
Node_Factory
::
operator
()(
string
path
,
size_t
line
,
double
v
)
{
Node_Impl
*
ip
=
alloc_Node_Impl
(
Node
::
number
,
file
,
line
);
Node_Impl
*
ip
=
alloc_Node_Impl
(
Node
::
number
,
path
,
line
);
ip
->
value
.
numeric
=
v
;
return
Node
(
ip
);
}
// for making nodes representing numeric dimensions (e.g. 5px, 3em)
Node
Node_Factory
::
operator
()(
string
file
,
size_t
line
,
double
v
,
const
Token
&
t
)
Node
Node_Factory
::
operator
()(
string
path
,
size_t
line
,
double
v
,
const
Token
&
t
)
{
Node_Impl
*
ip
=
alloc_Node_Impl
(
Node
::
numeric_dimension
,
file
,
line
);
Node_Impl
*
ip
=
alloc_Node_Impl
(
Node
::
numeric_dimension
,
path
,
line
);
ip
->
value
.
dimension
.
numeric
=
v
;
ip
->
value
.
dimension
.
unit
=
t
;
return
Node
(
ip
);
}
// for making nodes representing rgba color quads
Node
Node_Factory
::
operator
()(
string
file
,
size_t
line
,
double
r
,
double
g
,
double
b
,
double
a
)
Node
Node_Factory
::
operator
()(
string
path
,
size_t
line
,
double
r
,
double
g
,
double
b
,
double
a
)
{
Node
color
((
*
this
)(
Node
::
numeric_color
,
file
,
line
,
4
));
color
<<
(
*
this
)(
file
,
line
,
r
)
<<
(
*
this
)(
file
,
line
,
g
)
<<
(
*
this
)(
file
,
line
,
b
)
<<
(
*
this
)(
file
,
line
,
a
);
Node
color
((
*
this
)(
Node
::
numeric_color
,
path
,
line
,
4
));
color
<<
(
*
this
)(
path
,
line
,
r
)
<<
(
*
this
)(
path
,
line
,
g
)
<<
(
*
this
)(
path
,
line
,
b
)
<<
(
*
this
)(
path
,
line
,
a
);
return
color
;
}
...
...
sass_interface.cpp
View file @
909199cf
...
...
@@ -40,7 +40,7 @@ extern "C" {
using
namespace
Sass
;
doc
.
parse_scss
();
// cerr << "PARSED" << endl;
eval
(
doc
.
root
,
doc
.
context
.
global_env
,
doc
.
context
.
function_env
,
doc
.
context
.
registry
);
eval
(
doc
.
root
,
doc
.
context
.
global_env
,
doc
.
context
.
function_env
,
doc
.
context
.
new_Node
);
// cerr << "EVALUATED" << endl;
string
output
(
doc
.
emit_css
(
static_cast
<
Document
::
CSS_Style
>
(
style
)));
// cerr << "EMITTED" << endl;
...
...
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