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
2ee9fce3
Commit
2ee9fce3
authored
Feb 29, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implementing string unquoting.
parent
40050f5a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
4 deletions
+57
-4
node.cpp
node.cpp
+4
-2
test.scss
test.scss
+5
-0
token.cpp
token.cpp
+37
-0
token.hpp
token.hpp
+11
-2
No files found.
node.cpp
View file @
2ee9fce3
...
@@ -83,8 +83,10 @@ namespace Sass {
...
@@ -83,8 +83,10 @@ namespace Sass {
buf
<<
string
(
token
)
<<
":"
;
buf
<<
string
(
token
)
<<
":"
;
break
;
break
;
case
values
:
case
values
:
for
(
int
i
=
0
;
i
<
children
.
size
();
++
i
)
for
(
int
i
=
0
;
i
<
children
.
size
();
++
i
)
{
buf
<<
" "
<<
string
(
children
[
i
].
token
);
buf
<<
" "
;
children
[
i
].
token
.
stream_unquoted
(
buf
);
}
break
;
break
;
case
rule
:
case
rule
:
buf
<<
" "
;
buf
<<
" "
;
...
...
test.scss
View file @
2ee9fce3
$blah
:
bloo
blee
;
$blah
:
bloo
blee
;
$blip
:
"a 'red' and \"blue\" value"
;
/* top level comment -- should preserved */
/* top level comment -- should preserved */
div
{
div
{
...
@@ -21,6 +22,9 @@ div {
...
@@ -21,6 +22,9 @@ div {
-webkit-box-sizing
:
$blux
;
-webkit-box-sizing
:
$blux
;
}
}
margin
:
10px
5px
;
margin
:
10px
5px
;
h1
{
color
:
$blip
;
}
}
}
/* last comment, top level again --
/* last comment, top level again --
compare the indentation! */
compare the indentation! */
\ No newline at end of file
token.cpp
View file @
2ee9fce3
...
@@ -4,4 +4,40 @@ namespace Sass {
...
@@ -4,4 +4,40 @@ namespace Sass {
Token
::
Token
()
:
begin
(
0
),
end
(
0
)
{
}
Token
::
Token
()
:
begin
(
0
),
end
(
0
)
{
}
Token
::
Token
(
const
char
*
_begin
,
const
char
*
_end
)
Token
::
Token
(
const
char
*
_begin
,
const
char
*
_end
)
:
begin
(
_begin
),
end
(
_end
)
{
}
:
begin
(
_begin
),
end
(
_end
)
{
}
void
Token
::
stream_unquoted
(
std
::
stringstream
&
buf
)
const
{
const
char
*
p
=
begin
;
if
(
*
begin
==
'\''
||
*
begin
==
'"'
)
{
++
p
;
while
(
p
<
end
)
{
if
(
*
p
==
'\\'
)
{
switch
(
*
(
++
p
))
{
case
'n'
:
buf
<<
'\n'
;
break
;
case
't'
:
buf
<<
'\t'
;
break
;
case
'b'
:
buf
<<
'\b'
;
break
;
case
'r'
:
buf
<<
'\r'
;
break
;
case
'f'
:
buf
<<
'\f'
;
break
;
case
'v'
:
buf
<<
'\v'
;
break
;
case
'a'
:
buf
<<
'\a'
;
break
;
case
'\\'
:
buf
<<
'\\'
;
break
;
default
:
buf
<<
*
p
;
break
;
}
}
else
if
(
p
==
end
-
1
)
{
return
;
}
else
{
buf
<<
*
p
;
}
++
p
;
}
return
;
}
else
{
while
(
p
<
end
)
{
buf
<<
*
(
p
++
);
}
return
;
}
}
}
}
\ No newline at end of file
token.hpp
View file @
2ee9fce3
#include <string>
#include <string>
#include <sstream>
#include "prelexer.hpp"
#include "prelexer.hpp"
namespace
Sass
{
namespace
Sass
{
...
@@ -11,7 +12,14 @@ namespace Sass {
...
@@ -11,7 +12,14 @@ namespace Sass {
Token
();
Token
();
Token
(
const
char
*
_begin
,
const
char
*
_end
);
Token
(
const
char
*
_begin
,
const
char
*
_end
);
inline
bool
is_null
()
{
return
begin
==
0
||
end
==
0
;
}
inline
bool
is_null
()
const
{
inline
operator
string
()
const
{
return
string
(
begin
,
end
-
begin
);
}
return
begin
==
0
||
end
==
0
||
begin
>=
end
;
}
inline
operator
string
()
const
{
return
string
(
begin
,
end
-
begin
);
}
void
stream_unquoted
(
std
::
stringstream
&
buf
)
const
;
};
};
}
}
\ No newline at end of file
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