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
64488fd5
Commit
64488fd5
authored
Mar 23, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handling decimal rgb triples.
parent
f5dfac98
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
51 additions
and
11 deletions
+51
-11
document_parser.cpp
document_parser.cpp
+23
-0
hex_math.scss
hex_math.scss
+3
-0
node.cpp
node.cpp
+8
-8
prelexer.cpp
prelexer.cpp
+9
-2
prelexer.hpp
prelexer.hpp
+2
-0
input.scss
spec/basic/16_hex_arithmetic/input.scss
+3
-0
output.css
spec/basic/16_hex_arithmetic/output.css
+3
-1
No files found.
document_parser.cpp
View file @
64488fd5
...
@@ -438,6 +438,29 @@ namespace Sass {
...
@@ -438,6 +438,29 @@ namespace Sass {
Node
Document
::
parse_value
()
Node
Document
::
parse_value
()
{
{
if
(
lex
<
uri_prefix
>
())
{
lex
<
string_constant
>
();
Node
result
(
line_number
,
Node
::
uri
,
lexed
);
lex
<
exactly
<
')'
>
>
();
return
result
;
}
if
(
lex
<
rgb_prefix
>
())
{
Node
result
(
line_number
,
Node
::
hex_triple
,
3
);
lex
<
number
>
();
result
<<
Node
(
line_number
,
std
::
atof
(
lexed
.
begin
));
lex
<
exactly
<
','
>
>
();
lex
<
number
>
();
result
<<
Node
(
line_number
,
std
::
atof
(
lexed
.
begin
));
lex
<
exactly
<
','
>
>
();
lex
<
number
>
();
result
<<
Node
(
line_number
,
std
::
atof
(
lexed
.
begin
));
lex
<
exactly
<
')'
>
>
();
return
result
;
}
if
(
lex
<
identifier
>
())
if
(
lex
<
identifier
>
())
{
return
Node
(
line_number
,
Node
::
identifier
,
lexed
);
}
{
return
Node
(
line_number
,
Node
::
identifier
,
lexed
);
}
...
...
hex_math.scss
View file @
64488fd5
...
@@ -18,4 +18,6 @@ div {
...
@@ -18,4 +18,6 @@ div {
p17
:
#f0f
+
#101
;
p17
:
#f0f
+
#101
;
p18
:
10
#222
+
1
;
p18
:
10
#222
+
1
;
p19
:
(
10
/
#222
);
p19
:
(
10
/
#222
);
p20
:
rgb
(
10
,
10
,
10
)
+
#010001
;
p21
:
#010000
+
rgb
(
255
,
255
,
255
);
}
}
\ No newline at end of file
node.cpp
View file @
64488fd5
...
@@ -152,19 +152,19 @@ namespace Sass {
...
@@ -152,19 +152,19 @@ namespace Sass {
double
a
=
children
->
at
(
0
).
numeric_value
;
double
a
=
children
->
at
(
0
).
numeric_value
;
double
b
=
children
->
at
(
1
).
numeric_value
;
double
b
=
children
->
at
(
1
).
numeric_value
;
double
c
=
children
->
at
(
2
).
numeric_value
;
double
c
=
children
->
at
(
2
).
numeric_value
;
if
(
a
>
0xff
&&
b
>
0xff
&&
c
>
0xff
)
if
(
a
>
=
0xff
&&
b
>=
0xff
&&
c
>=
0xff
)
{
return
"white"
;
}
{
return
"white"
;
}
else
if
(
a
>
0xff
&&
b
>
0xff
&&
c
==
0
)
else
if
(
a
>
=
0xff
&&
b
>=
0xff
&&
c
==
0
)
{
return
"yellow"
;
}
{
return
"yellow"
;
}
else
if
(
a
==
0
&&
b
>
0xff
&&
c
>
0xff
)
else
if
(
a
==
0
&&
b
>
=
0xff
&&
c
>=
0xff
)
{
return
"aqua"
;
}
{
return
"aqua"
;
}
else
if
(
a
>
0xff
&&
b
==
0
&&
c
>
0xff
)
else
if
(
a
>
=
0xff
&&
b
==
0
&&
c
>=
0xff
)
{
return
"fuchsia"
;
}
{
return
"fuchsia"
;
}
else
if
(
a
>
0xff
&&
b
==
0
&&
c
==
0
)
else
if
(
a
>
=
0xff
&&
b
==
0
&&
c
==
0
)
{
return
"red"
;
}
{
return
"red"
;
}
else
if
(
a
==
0
&&
b
>
0xff
&&
c
==
0
)
else
if
(
a
==
0
&&
b
>
=
0xff
&&
c
==
0
)
{
return
"
green
"
;
}
{
return
"
lime
"
;
}
else
if
(
a
==
0
&&
b
==
0
&&
c
>
0xff
)
else
if
(
a
==
0
&&
b
==
0
&&
c
>
=
0xff
)
{
return
"blue"
;
}
{
return
"blue"
;
}
else
if
(
a
<=
0
&&
b
<=
0
&&
c
<=
0
)
else
if
(
a
<=
0
&&
b
<=
0
&&
c
<=
0
)
{
return
"black"
;
}
{
return
"black"
;
}
...
...
prelexer.cpp
View file @
64488fd5
...
@@ -166,10 +166,17 @@ namespace Sass {
...
@@ -166,10 +166,17 @@ namespace Sass {
int
len
=
p
-
src
;
int
len
=
p
-
src
;
return
(
len
!=
4
&&
len
!=
7
)
?
0
:
p
;
return
(
len
!=
4
&&
len
!=
7
)
?
0
:
p
;
}
}
extern
const
char
rgb_kwd
[]
=
"rgb("
;
const
char
*
rgb_prefix
(
const
char
*
src
)
{
return
exactly
<
rgb_kwd
>
(
src
);
}
// Match CSS uri specifiers.
// Match CSS uri specifiers.
extern
const
char
url_call
[]
=
"url("
;
extern
const
char
url_kwd
[]
=
"url("
;
const
char
*
uri_prefix
(
const
char
*
src
)
{
return
exactly
<
url_kwd
>
(
src
);
}
const
char
*
uri
(
const
char
*
src
)
{
const
char
*
uri
(
const
char
*
src
)
{
return
sequence
<
exactly
<
url_
call
>
,
return
sequence
<
exactly
<
url_
kwd
>
,
optional
<
spaces
>
,
optional
<
spaces
>
,
string_constant
,
string_constant
,
optional
<
spaces
>
,
optional
<
spaces
>
,
...
...
prelexer.hpp
View file @
64488fd5
...
@@ -292,7 +292,9 @@ namespace Sass {
...
@@ -292,7 +292,9 @@ namespace Sass {
const
char
*
percentage
(
const
char
*
src
);
const
char
*
percentage
(
const
char
*
src
);
const
char
*
dimension
(
const
char
*
src
);
const
char
*
dimension
(
const
char
*
src
);
const
char
*
hex
(
const
char
*
src
);
const
char
*
hex
(
const
char
*
src
);
const
char
*
rgb_prefix
(
const
char
*
src
);
// Match CSS uri specifiers.
// Match CSS uri specifiers.
const
char
*
uri_prefix
(
const
char
*
src
);
const
char
*
uri
(
const
char
*
src
);
const
char
*
uri
(
const
char
*
src
);
// Match CSS "!important" keyword.
// Match CSS "!important" keyword.
const
char
*
important
(
const
char
*
src
);
const
char
*
important
(
const
char
*
src
);
...
...
spec/basic/16_hex_arithmetic/input.scss
View file @
64488fd5
...
@@ -18,4 +18,6 @@ div {
...
@@ -18,4 +18,6 @@ div {
p17
:
#f0f
+
#101
;
p17
:
#f0f
+
#101
;
p18
:
10
#222
+
1
;
p18
:
10
#222
+
1
;
p19
:
(
10
/
#222
);
p19
:
(
10
/
#222
);
p20
:
rgb
(
10
,
10
,
10
)
+
#010001
;
p21
:
#010000
+
rgb
(
255
,
255
,
255
);
}
}
\ No newline at end of file
spec/basic/16_hex_arithmetic/output.css
View file @
64488fd5
...
@@ -17,4 +17,6 @@ div {
...
@@ -17,4 +17,6 @@ div {
p16
:
black
;
p16
:
black
;
p17
:
fuchsia
;
p17
:
fuchsia
;
p18
:
10
#232323
;
p18
:
10
#232323
;
p19
:
10
/
#222222
;
}
p19
:
10
/
#222222
;
p20
:
#0b0a0b
;
p21
:
white
;
}
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