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
2dbc45a0
Commit
2dbc45a0
authored
Oct 03, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More fixes for evaluation edge-cases.
parent
f25d02b2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
65 deletions
+59
-65
document_parser.cpp
document_parser.cpp
+59
-65
eval_apply.cpp
eval_apply.cpp
+0
-0
No files found.
document_parser.cpp
View file @
2dbc45a0
...
@@ -215,12 +215,10 @@ namespace Sass {
...
@@ -215,12 +215,10 @@ namespace Sass {
if
(
lex
<
exactly
<
'('
>
>
())
{
if
(
lex
<
exactly
<
'('
>
>
())
{
if
(
!
peek
<
exactly
<
')'
>
>
(
position
))
{
if
(
!
peek
<
exactly
<
')'
>
>
(
position
))
{
Node
arg
(
parse_argument
(
Node
::
none
));
Node
arg
(
parse_argument
(
Node
::
none
));
arg
.
should_eval
()
=
true
;
args
<<
arg
;
args
<<
arg
;
if
(
arg
.
type
()
==
Node
::
assignment
)
arg_type
=
Node
::
assignment
;
if
(
arg
.
type
()
==
Node
::
assignment
)
arg_type
=
Node
::
assignment
;
while
(
lex
<
exactly
<
','
>
>
())
{
while
(
lex
<
exactly
<
','
>
>
())
{
Node
arg
(
parse_argument
(
arg_type
));
Node
arg
(
parse_argument
(
arg_type
));
arg
.
should_eval
()
=
true
;
args
<<
arg
;
args
<<
arg
;
if
(
arg
.
type
()
==
Node
::
assignment
)
arg_type
=
Node
::
assignment
;
if
(
arg
.
type
()
==
Node
::
assignment
)
arg_type
=
Node
::
assignment
;
}
}
...
@@ -239,6 +237,7 @@ namespace Sass {
...
@@ -239,6 +237,7 @@ namespace Sass {
Node
var
(
context
.
new_Node
(
Node
::
variable
,
path
,
line
,
lexed
));
Node
var
(
context
.
new_Node
(
Node
::
variable
,
path
,
line
,
lexed
));
lex
<
exactly
<
':'
>
>
();
lex
<
exactly
<
':'
>
>
();
Node
val
(
parse_space_list
());
Node
val
(
parse_space_list
());
// val.should_eval() = true;
Node
assn
(
context
.
new_Node
(
Node
::
assignment
,
path
,
line
,
2
));
Node
assn
(
context
.
new_Node
(
Node
::
assignment
,
path
,
line
,
2
));
assn
<<
var
<<
val
;
assn
<<
var
<<
val
;
return
assn
;
return
assn
;
...
@@ -254,23 +253,14 @@ namespace Sass {
...
@@ -254,23 +253,14 @@ namespace Sass {
Node
var
(
context
.
new_Node
(
Node
::
variable
,
path
,
line
,
lexed
));
Node
var
(
context
.
new_Node
(
Node
::
variable
,
path
,
line
,
lexed
));
lex
<
exactly
<
':'
>
>
();
lex
<
exactly
<
':'
>
>
();
Node
val
(
parse_space_list
());
Node
val
(
parse_space_list
());
// val.should_eval() = true;
Node
assn
(
context
.
new_Node
(
Node
::
assignment
,
path
,
line
,
2
));
Node
assn
(
context
.
new_Node
(
Node
::
assignment
,
path
,
line
,
2
));
assn
<<
var
<<
val
;
assn
<<
var
<<
val
;
return
assn
;
return
assn
;
}
}
return
parse_space_list
();
Node
val
(
parse_space_list
());
// if (peek< sequence < variable, spaces_and_comments, exactly<':'> > >()) {
val
.
should_eval
()
=
true
;
// lex< variable >();
return
val
;
// Node var(context.new_Node(Node::variable, path, line, lexed));
// lex< exactly<':'> >();
// Node val(parse_space_list());
// Node assn(context.new_Node(Node::assignment, path, line, 2));
// assn << var << val;
// return assn;
// }
// else {
// return parse_space_list();
// }
}
}
Node
Document
::
parse_assignment
()
Node
Document
::
parse_assignment
()
...
@@ -909,45 +899,45 @@ namespace Sass {
...
@@ -909,45 +899,45 @@ namespace Sass {
if
(
lex
<
identifier
>
())
if
(
lex
<
identifier
>
())
{
return
context
.
new_Node
(
Node
::
identifier
,
path
,
line
,
lexed
);
}
{
return
context
.
new_Node
(
Node
::
identifier
,
path
,
line
,
lexed
);
}
//
if (lex< percentage >())
if
(
lex
<
percentage
>
())
//
{ return context.new_Node(Node::textual_percentage, path, line, lexed); }
{
return
context
.
new_Node
(
Node
::
textual_percentage
,
path
,
line
,
lexed
);
}
//
if (lex< dimension >())
if
(
lex
<
dimension
>
())
//
{ return context.new_Node(Node::textual_dimension, path, line, lexed); }
{
return
context
.
new_Node
(
Node
::
textual_dimension
,
path
,
line
,
lexed
);
}
//
if (lex< number >())
if
(
lex
<
number
>
())
//
{ return context.new_Node(Node::textual_number, path, line, lexed); }
{
return
context
.
new_Node
(
Node
::
textual_number
,
path
,
line
,
lexed
);
}
//
if (lex< hex >())
if
(
lex
<
hex
>
())
//
{ return context.new_Node(Node::textual_hex, path, line, lexed); }
{
return
context
.
new_Node
(
Node
::
textual_hex
,
path
,
line
,
lexed
);
}
if
(
lex
<
percentage
>
())
//
if (lex< percentage >())
{
return
context
.
new_Node
(
path
,
line
,
atof
(
lexed
.
begin
),
Node
::
numeric_percentage
);
}
//
{ return context.new_Node(path, line, atof(lexed.begin), Node::numeric_percentage); }
if
(
lex
<
dimension
>
())
{
//
if (lex< dimension >()) {
return
context
.
new_Node
(
path
,
line
,
atof
(
lexed
.
begin
),
//
return context.new_Node(path, line, atof(lexed.begin),
Token
::
make
(
Prelexer
::
number
(
lexed
.
begin
),
lexed
.
end
));
//
Token::make(Prelexer::number(lexed.begin), lexed.end));
}
//
}
if
(
lex
<
number
>
())
//
if (lex< number >())
{
return
context
.
new_Node
(
path
,
line
,
atof
(
lexed
.
begin
));
}
//
{ return context.new_Node(path, line, atof(lexed.begin)); }
if
(
lex
<
hex
>
())
{
//
if (lex< hex >()) {
Node
triple
(
context
.
new_Node
(
Node
::
numeric_color
,
path
,
line
,
4
));
//
Node triple(context.new_Node(Node::numeric_color, path, line, 4));
Token
hext
(
Token
::
make
(
lexed
.
begin
+
1
,
lexed
.
end
));
//
Token hext(Token::make(lexed.begin+1, lexed.end));
if
(
hext
.
length
()
==
6
)
{
//
if (hext.length() == 6) {
for
(
int
i
=
0
;
i
<
6
;
i
+=
2
)
{
//
for (int i = 0; i < 6; i += 2) {
triple
<<
context
.
new_Node
(
path
,
line
,
static_cast
<
double
>
(
strtol
(
string
(
hext
.
begin
+
i
,
2
).
c_str
(),
NULL
,
16
)));
//
triple << context.new_Node(path, line, static_cast<double>(strtol(string(hext.begin+i, 2).c_str(), NULL, 16)));
}
//
}
}
//
}
else
{
//
else {
for
(
int
i
=
0
;
i
<
3
;
++
i
)
{
//
for (int i = 0; i < 3; ++i) {
triple
<<
context
.
new_Node
(
path
,
line
,
static_cast
<
double
>
(
strtol
(
string
(
2
,
hext
.
begin
[
i
]).
c_str
(),
NULL
,
16
)));
//
triple << context.new_Node(path, line, static_cast<double>(strtol(string(2, hext.begin[i]).c_str(), NULL, 16)));
}
//
}
}
//
}
triple
<<
context
.
new_Node
(
path
,
line
,
1.0
);
//
triple << context.new_Node(path, line, 1.0);
return
triple
;
//
return triple;
}
//
}
if
(
peek
<
string_constant
>
())
if
(
peek
<
string_constant
>
())
{
return
parse_string
();
}
{
return
parse_string
();
}
...
@@ -1023,30 +1013,34 @@ namespace Sass {
...
@@ -1023,30 +1013,34 @@ namespace Sass {
schema
<<
context
.
new_Node
(
Node
::
identifier
,
path
,
line
,
lexed
);
schema
<<
context
.
new_Node
(
Node
::
identifier
,
path
,
line
,
lexed
);
}
}
else
if
(
lex
<
percentage
>
())
{
else
if
(
lex
<
percentage
>
())
{
schema
<<
context
.
new_Node
(
path
,
line
,
atof
(
lexed
.
begin
),
Node
::
numeric_percentage
);
schema
<<
context
.
new_Node
(
Node
::
textual_percentage
,
path
,
line
,
lexed
);
// schema << context.new_Node(path, line, atof(lexed.begin), Node::numeric_percentage);
}
}
else
if
(
lex
<
dimension
>
())
{
else
if
(
lex
<
dimension
>
())
{
schema
<<
context
.
new_Node
(
path
,
line
,
atof
(
lexed
.
begin
),
schema
<<
context
.
new_Node
(
Node
::
textual_dimension
,
path
,
line
,
lexed
);
Token
::
make
(
Prelexer
::
number
(
lexed
.
begin
),
lexed
.
end
));
// schema << context.new_Node(path, line, atof(lexed.begin),
// Token::make(Prelexer::number(lexed.begin), lexed.end));
}
}
else
if
(
lex
<
number
>
())
{
else
if
(
lex
<
number
>
())
{
schema
<<
context
.
new_Node
(
path
,
line
,
atof
(
lexed
.
begin
));
schema
<<
context
.
new_Node
(
Node
::
textual_number
,
path
,
line
,
lexed
);
// schema << context.new_Node(path, line, atof(lexed.begin));
}
}
else
if
(
lex
<
hex
>
())
{
else
if
(
lex
<
hex
>
())
{
Node
triple
(
context
.
new_Node
(
Node
::
numeric_color
,
path
,
line
,
4
));
schema
<<
context
.
new_Node
(
Node
::
textual_hex
,
path
,
line
,
lexed
);
Token
hext
(
Token
::
make
(
lexed
.
begin
+
1
,
lexed
.
end
));
// Node triple(context.new_Node(Node::numeric_color, path, line, 4));
if
(
hext
.
length
()
==
6
)
{
// Token hext(Token::make(lexed.begin+1, lexed.end));
for
(
int
i
=
0
;
i
<
6
;
i
+=
2
)
{
// if (hext.length() == 6) {
triple
<<
context
.
new_Node
(
path
,
line
,
static_cast
<
double
>
(
strtol
(
string
(
hext
.
begin
+
i
,
2
).
c_str
(),
NULL
,
16
)));
// for (int i = 0; i < 6; i += 2) {
}
// triple << context.new_Node(path, line, static_cast<double>(strtol(string(hext.begin+i, 2).c_str(), NULL, 16)));
}
// }
else
{
// }
for
(
int
i
=
0
;
i
<
3
;
++
i
)
{
// else {
triple
<<
context
.
new_Node
(
path
,
line
,
static_cast
<
double
>
(
strtol
(
string
(
2
,
hext
.
begin
[
i
]).
c_str
(),
NULL
,
16
)));
// for (int i = 0; i < 3; ++i) {
}
// triple << context.new_Node(path, line, static_cast<double>(strtol(string(2, hext.begin[i]).c_str(), NULL, 16)));
}
// }
triple
<<
context
.
new_Node
(
path
,
line
,
1.0
);
// }
schema
<<
triple
;
// triple << context.new_Node(path, line, 1.0);
// schema << triple;
}
}
else
if
(
lex
<
string_constant
>
())
{
else
if
(
lex
<
string_constant
>
())
{
Node
str
(
context
.
new_Node
(
Node
::
string_constant
,
path
,
line
,
lexed
));
Node
str
(
context
.
new_Node
(
Node
::
string_constant
,
path
,
line
,
lexed
));
...
...
eval_apply.cpp
View file @
2dbc45a0
This diff is collapsed.
Click to expand it.
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