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
b47fadb1
Commit
b47fadb1
authored
Feb 28, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Successfully parsing and saving statement-level comments. More to come.
parent
3945804b
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
0 deletions
+44
-0
comments.scss
src/comments.scss
+3
-0
document.cpp
src/document.cpp
+19
-0
document.hpp
src/document.hpp
+7
-0
unit-test-document.cpp
src/unit-test-document.cpp
+15
-0
No files found.
src/comments.scss
0 → 100644
View file @
b47fadb1
/* hey, a comment */
/* hey, another comment */
/* and another */
/* all of these should be kept */
src/document.cpp
View file @
b47fadb1
...
...
@@ -30,4 +30,22 @@ namespace Sass {
delete
[]
source
;
}
void
Document
::
parse_stylesheet
()
{
printf
(
"ABOUT TO MUNCH LEADING SPACES
\n
"
);
try_munching
<
optional_spaces
>
();
while
(
*
position
)
{
printf
(
"LOOPING OVER STATEMENTS
\n
"
);
statements
.
push_back
(
parse_statement
());
try_munching
<
optional_spaces
>
();
}
}
Node
Document
::
parse_statement
()
{
if
(
try_munching
<
block_comment
>
())
{
printf
(
"MUNCHING A COMMENT
\n
"
);
return
Node
(
Node
::
comment
,
top
);
}
else
return
Node
();
}
}
\ No newline at end of file
src/document.hpp
View file @
b47fadb1
...
...
@@ -36,6 +36,9 @@ namespace Sass {
return
last_munch_succeeded
=
false
;
}
}
else
if
(
mx
==
optional_spaces
)
{
after_whitespace
=
optional_spaces
(
position
);
}
else
{
after_whitespace
=
spaces_and_comments
(
position
);
}
...
...
@@ -51,5 +54,8 @@ namespace Sass {
}
}
void
parse_stylesheet
();
Node
parse_statement
();
};
}
\ No newline at end of file
src/unit-test-document.cpp
View file @
b47fadb1
#include <cstdio>
#include <iostream>
#include "document.hpp"
using
namespace
Sass
;
...
...
@@ -38,6 +39,20 @@ int main(int argc, char* argv[]) {
printf
(
"sizeof node object is %ld
\n
"
,
sizeof
(
Node
));
printf
(
"sizeof Node vector object is %ld
\n
"
,
sizeof
(
std
::
vector
<
Node
>
));
printf
(
"sizeof pointer to Node vector is %ld
\n
"
,
sizeof
(
std
::
vector
<
Node
>*
));
printf
(
"GOING TO TRY PARSING NOW
\n
"
);
doc
.
position
=
doc
.
source
;
std
::
cout
<<
doc
.
position
<<
std
::
endl
;
if
(
*
(
doc
.
position
))
std
::
cout
<<
"position has content!"
<<
std
::
endl
;
doc
.
parse_stylesheet
();
int
i
;
int
j
=
doc
.
statements
.
size
();
printf
(
"%d
\n
"
,
j
);
for
(
i
=
0
;
i
<
j
;
++
i
)
{
print_slice
(
doc
.
statements
[
i
].
token
.
begin
,
doc
.
statements
[
i
].
token
.
end
);
}
}
return
0
;
...
...
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