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
e2021333
Commit
e2021333
authored
May 23, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Getting the pegs to fit into the holes.
parent
ea68a55e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
30 additions
and
26 deletions
+30
-26
context.hpp
context.hpp
+2
-1
document.cpp
document.cpp
+4
-3
document.hpp
document.hpp
+4
-14
document_parser.cpp
document_parser.cpp
+0
-0
node.hpp
node.hpp
+3
-3
node_factory.cpp
node_factory.cpp
+13
-3
node_factory.hpp
node_factory.hpp
+4
-2
No files found.
context.hpp
View file @
e2021333
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#include <utility>
#include <utility>
#include <map>
#include <map>
#include "node_factory.hpp"
#include "functions.hpp"
#include "functions.hpp"
namespace
Sass
{
namespace
Sass
{
...
@@ -45,7 +46,7 @@ namespace Sass {
...
@@ -45,7 +46,7 @@ namespace Sass {
vector
<
char
*>
source_refs
;
// all the source c-strings
vector
<
char
*>
source_refs
;
// all the source c-strings
vector
<
vector
<
Node
>*>
registry
;
// all the child vectors
vector
<
vector
<
Node
>*>
registry
;
// all the child vectors
vector
<
string
>
include_paths
;
vector
<
string
>
include_paths
;
Node_Factory
new_
n
ode
;
Node_Factory
new_
N
ode
;
size_t
ref_count
;
size_t
ref_count
;
string
sass_path
;
string
sass_path
;
string
css_path
;
string
css_path
;
...
...
document.cpp
View file @
e2021333
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
#include "eval_apply.hpp"
#include "eval_apply.hpp"
#include "error.hpp"
#include "error.hpp"
#include <iostream>
#include <iostream>
#include <sstream>
namespace
Sass
{
namespace
Sass
{
...
@@ -25,7 +26,7 @@ namespace Sass {
...
@@ -25,7 +26,7 @@ namespace Sass {
Document
::~
Document
()
Document
::~
Document
()
{
--
context
.
ref_count
;
}
{
--
context
.
ref_count
;
}
static
Document
Document
::
make_from_file
(
Context
&
ctx
,
string
path
)
Document
Document
::
make_from_file
(
Context
&
ctx
,
string
path
)
{
{
std
::
FILE
*
f
;
std
::
FILE
*
f
;
f
=
std
::
fopen
(
path
.
c_str
(),
"rb"
);
f
=
std
::
fopen
(
path
.
c_str
(),
"rb"
);
...
@@ -55,7 +56,7 @@ namespace Sass {
...
@@ -55,7 +56,7 @@ namespace Sass {
return
doc
;
return
doc
;
}
}
static
Document
Document
::
make_from_source_chars
(
Context
&
ctx
,
char
*
src
,
string
path
)
Document
Document
::
make_from_source_chars
(
Context
&
ctx
,
char
*
src
,
string
path
)
{
{
Document
doc
(
ctx
);
Document
doc
(
ctx
);
doc
.
path
=
path
;
doc
.
path
=
path
;
...
@@ -70,7 +71,7 @@ namespace Sass {
...
@@ -70,7 +71,7 @@ namespace Sass {
return
doc
;
return
doc
;
}
}
static
Document
Document
::
make_from_token
(
Context
&
ctx
,
Token
t
,
string
path
,
size_t
line_number
)
Document
Document
::
make_from_token
(
Context
&
ctx
,
Token
t
,
string
path
,
size_t
line_number
)
{
{
Document
doc
(
ctx
);
Document
doc
(
ctx
);
doc
.
path
=
path
;
doc
.
path
=
path
;
...
...
document.hpp
View file @
e2021333
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
#include "node.hpp"
#include "node.hpp"
#endif
#endif
#include "prelexer.hpp"
#include "context.hpp"
#include "context.hpp"
namespace
Sass
{
namespace
Sass
{
...
@@ -32,6 +33,7 @@ namespace Sass {
...
@@ -32,6 +33,7 @@ namespace Sass {
Document
(
Context
&
ctx
);
Document
(
Context
&
ctx
);
~
Document
();
~
Document
();
public
:
public
:
Document
(
const
Document
&
doc
);
static
Document
make_from_file
(
Context
&
ctx
,
string
path
);
static
Document
make_from_file
(
Context
&
ctx
,
string
path
);
static
Document
make_from_source_chars
(
Context
&
ctx
,
char
*
src
,
string
path
=
""
);
static
Document
make_from_source_chars
(
Context
&
ctx
,
char
*
src
,
string
path
=
""
);
...
@@ -144,26 +146,14 @@ namespace Sass {
...
@@ -144,26 +146,14 @@ namespace Sass {
Node
parse_term
();
Node
parse_term
();
Node
parse_factor
();
Node
parse_factor
();
Node
parse_value
();
Node
parse_value
();
Node
parse_identifier
();
Node
parse_variable
();
Node
parse_function_call
();
Node
parse_function_call
();
Node
parse_string
();
Node
parse_string
();
Node
parse_value_schema
();
Node
parse_value_schema
();
const
char
*
lookahead_for_selector
(
const
char
*
start
=
0
);
const
char
*
lookahead_for_selector
(
const
char
*
start
=
0
);
const
char
*
look_for_rule
(
const
char
*
start
=
0
);
void
throw_syntax_error
(
string
message
,
size_t
ln
=
0
);
const
char
*
look_for_values
(
const
char
*
start
=
0
);
void
throw_read_error
(
string
message
,
size_t
ln
=
0
);
const
char
*
look_for_selector_group
(
const
char
*
start
=
0
);
const
char
*
look_for_selector
(
const
char
*
start
=
0
);
const
char
*
look_for_simple_selector_sequence
(
const
char
*
start
=
0
);
const
char
*
look_for_simple_selector
(
const
char
*
start
=
0
);
const
char
*
look_for_pseudo
(
const
char
*
start
=
0
);
const
char
*
look_for_attrib
(
const
char
*
start
=
0
);
void
syntax_error
(
string
message
,
size_t
ln
=
0
);
void
read_error
(
string
message
,
size_t
ln
=
0
);
string
emit_css
(
CSS_Style
style
);
string
emit_css
(
CSS_Style
style
);
...
...
document_parser.cpp
View file @
e2021333
This diff is collapsed.
Click to expand it.
node.hpp
View file @
e2021333
...
@@ -176,7 +176,7 @@ namespace Sass {
...
@@ -176,7 +176,7 @@ namespace Sass {
Node
&
operator
<<
(
Node
n
);
Node
&
operator
<<
(
Node
n
);
Node
&
operator
+=
(
Node
n
);
Node
&
operator
+=
(
Node
n
);
bool
boolean_value
()
const
;
bool
&
boolean_value
()
const
;
double
numeric_value
()
const
;
double
numeric_value
()
const
;
Token
token
()
const
;
Token
token
()
const
;
Token
unit
()
const
;
Token
unit
()
const
;
...
@@ -268,7 +268,7 @@ namespace Sass {
...
@@ -268,7 +268,7 @@ namespace Sass {
void
pop_back
()
void
pop_back
()
{
children
.
pop_back
();
}
{
children
.
pop_back
();
}
bool
boolean_value
()
bool
&
boolean_value
()
{
return
value
.
boolean
;
}
{
return
value
.
boolean
;
}
double
numeric_value
();
double
numeric_value
();
...
@@ -320,7 +320,7 @@ namespace Sass {
...
@@ -320,7 +320,7 @@ namespace Sass {
for
(
size_t
i
=
0
,
L
=
n
.
size
();
i
<
L
;
++
i
)
push_back
(
n
[
i
]);
for
(
size_t
i
=
0
,
L
=
n
.
size
();
i
<
L
;
++
i
)
push_back
(
n
[
i
]);
return
*
this
;
return
*
this
;
}
}
inline
bool
Node
::
boolean_value
()
const
{
return
ip_
->
boolean_value
();
}
inline
bool
&
Node
::
boolean_value
()
const
{
return
ip_
->
boolean_value
();
}
inline
double
Node
::
numeric_value
()
const
{
return
ip_
->
numeric_value
();
}
inline
double
Node
::
numeric_value
()
const
{
return
ip_
->
numeric_value
();
}
inline
Token
Node
::
token
()
const
{
return
ip_
->
value
.
token
;
}
inline
Token
Node
::
token
()
const
{
return
ip_
->
value
.
token
;
}
inline
Token
Node
::
unit
()
const
{
return
ip_
->
unit
();
}
inline
Token
Node
::
unit
()
const
{
return
ip_
->
unit
();
}
...
...
node_factory.cpp
View file @
e2021333
...
@@ -35,21 +35,31 @@ namespace Sass {
...
@@ -35,21 +35,31 @@ namespace Sass {
}
}
// for making leaf nodes out of terminals/tokens
// for making leaf nodes out of terminals/tokens
Node
Node_Factory
::
operator
()(
Node
::
Type
type
,
string
file
,
size_t
line
,
const
Token
&
t
)
Node
Node_Factory
::
operator
()(
Node
::
Type
type
,
string
file
,
size_t
line
,
Token
&
t
)
{
{
Node_Impl
*
ip
=
alloc_Node_Impl
(
type
,
file
,
line
);
Node_Impl
*
ip
=
alloc_Node_Impl
(
type
,
file
,
line
);
ip
->
value
.
token
=
t
;
ip
->
value
.
token
=
t
;
return
Node
(
ip
);
return
Node
(
ip
);
}
}
// for making interior nodes that have children
// 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
file
,
size_t
line
,
size_t
size
)
{
{
Node_Impl
*
ip
=
alloc_Node_Impl
(
type
,
file
,
line
);
Node_Impl
*
ip
=
alloc_Node_Impl
(
type
,
file
,
line
);
ip
->
children
.
reserve
(
size
);
if
(
type
==
Node
::
boolean
)
ip
->
value
.
boolean
=
size
;
else
ip
->
children
.
reserve
(
size
);
return
Node
(
ip
);
return
Node
(
ip
);
}
}
// Node Node_Factory::operator()(Node::Type type, string file, size_t line, bool b)
// {
// Node_Impl* ip = alloc_Node_Impl(type, file, line);
// ip->content.boolean_value = b;
// return Node(ip);
// }
// for making nodes representing numbers
// for making nodes representing numbers
Node
Node_Factory
::
operator
()(
string
file
,
size_t
line
,
double
v
)
Node
Node_Factory
::
operator
()(
string
file
,
size_t
line
,
double
v
)
{
{
...
...
node_factory.hpp
View file @
e2021333
...
@@ -19,9 +19,11 @@ namespace Sass {
...
@@ -19,9 +19,11 @@ namespace Sass {
// for cloning nodes
// for cloning nodes
Node
operator
()(
const
Node
&
n1
);
Node
operator
()(
const
Node
&
n1
);
// for making leaf nodes out of terminals/tokens
// for making leaf nodes out of terminals/tokens
Node
operator
()(
Node
::
Type
type
,
string
file
,
size_t
line
,
const
Token
&
t
);
Node
operator
()(
Node
::
Type
type
,
string
file
,
size_t
line
,
Token
&
t
);
// for making interior nodes that have children
// for making
boolean values or
interior nodes that have children
Node
operator
()(
Node
::
Type
type
,
string
file
,
size_t
line
,
size_t
size
);
Node
operator
()(
Node
::
Type
type
,
string
file
,
size_t
line
,
size_t
size
);
// // for making nodes representing boolean values
// Node operator()(Node::Type type, string file, size_t line, bool b);
// for making nodes representing numbers
// for making nodes representing numbers
Node
operator
()(
string
file
,
size_t
line
,
double
v
);
Node
operator
()(
string
file
,
size_t
line
,
double
v
);
// for making nodes representing numeric dimensions (e.g. 5px, 3em)
// for making nodes representing numeric dimensions (e.g. 5px, 3em)
...
...
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