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
eb1eae78
Commit
eb1eae78
authored
Jun 01, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handling guarded assignments.
parent
75d1174f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
2 deletions
+18
-2
document_parser.cpp
document_parser.cpp
+5
-2
eval_apply.cpp
eval_apply.cpp
+2
-0
node.hpp
node.hpp
+2
-0
prelexer.cpp
prelexer.cpp
+7
-0
prelexer.hpp
prelexer.hpp
+2
-0
No files found.
document_parser.cpp
View file @
eb1eae78
...
...
@@ -218,6 +218,7 @@ namespace Sass {
Node
val
(
parse_list
());
Node
assn
(
context
.
new_Node
(
Node
::
assignment
,
path
,
line
,
2
));
assn
<<
var
<<
val
;
if
(
lex
<
default_flag
>
())
assn
<<
context
.
new_Node
(
Node
::
none
,
path
,
line
,
0
);
return
assn
;
}
...
...
@@ -609,7 +610,8 @@ namespace Sass {
peek
<
exactly
<
'}'
>
>
(
position
)
||
peek
<
exactly
<
'{'
>
>
(
position
)
||
peek
<
exactly
<
')'
>
>
(
position
)
||
peek
<
exactly
<
','
>
>
(
position
))
peek
<
exactly
<
','
>
>
(
position
)
||
peek
<
default_flag
>
(
position
))
{
return
disj1
;
}
Node
space_list
(
context
.
new_Node
(
Node
::
space_list
,
path
,
line
,
2
));
...
...
@@ -620,7 +622,8 @@ namespace Sass {
peek
<
exactly
<
'}'
>
>
(
position
)
||
peek
<
exactly
<
'{'
>
>
(
position
)
||
peek
<
exactly
<
')'
>
>
(
position
)
||
peek
<
exactly
<
','
>
>
(
position
)))
peek
<
exactly
<
','
>
>
(
position
)
||
peek
<
default_flag
>
(
position
)))
{
Node
disj
(
parse_disjunction
());
space_list
<<
disj
;
...
...
eval_apply.cpp
View file @
eb1eae78
...
...
@@ -124,6 +124,7 @@ namespace Sass {
val
=
eval
(
val
,
prefix
,
env
,
f_env
,
new_Node
,
ctx
);
}
Node
var
(
expr
[
0
]);
if
(
expr
.
is_guarded
()
&&
env
.
query
(
var
.
token
()))
return
expr
;
// If a binding exists (possible upframe), then update it.
// Otherwise, make a new on in the current frame.
if
(
env
.
query
(
var
.
token
()))
{
...
...
@@ -657,6 +658,7 @@ namespace Sass {
val
=
eval
(
val
,
Node
(),
bindings
,
ctx
.
function_env
,
new_Node
,
ctx
);
}
Node
var
(
stm
[
0
]);
if
(
stm
.
is_guarded
()
&&
bindings
.
query
(
var
.
token
()))
continue
;
// If a binding exists (possible upframe), then update it.
// Otherwise, make a new on in the current frame.
if
(
bindings
.
query
(
var
.
token
()))
{
...
...
node.hpp
View file @
eb1eae78
...
...
@@ -173,6 +173,7 @@ namespace Sass {
bool
&
should_eval
()
const
;
bool
&
is_unquoted
()
const
;
bool
is_numeric
()
const
;
bool
is_guarded
()
const
;
string
&
path
()
const
;
size_t
line
()
const
;
...
...
@@ -349,6 +350,7 @@ namespace Sass {
inline
bool
&
Node
::
should_eval
()
const
{
return
ip_
->
should_eval
;
}
inline
bool
&
Node
::
is_unquoted
()
const
{
return
ip_
->
is_unquoted
;
}
inline
bool
Node
::
is_numeric
()
const
{
return
ip_
->
is_numeric
();
}
inline
bool
Node
::
is_guarded
()
const
{
return
(
type
()
==
assignment
)
&&
(
size
()
==
3
);
}
inline
string
&
Node
::
path
()
const
{
return
ip_
->
path
;
}
inline
size_t
Node
::
line
()
const
{
return
ip_
->
line
;
}
...
...
prelexer.cpp
View file @
eb1eae78
...
...
@@ -271,6 +271,13 @@ namespace Sass {
spaces_and_comments
,
exactly
<
important_kwd
>
>
(
src
);
}
// Match Sass "!default" keyword.
extern
const
char
default_kwd
[]
=
"default"
;
const
char
*
default_flag
(
const
char
*
src
)
{
return
sequence
<
exactly
<
'!'
>
,
spaces_and_comments
,
exactly
<
default_kwd
>
>
(
src
);
}
// Match CSS pseudo-class/element prefixes.
const
char
*
pseudo_prefix
(
const
char
*
src
)
{
return
sequence
<
exactly
<
':'
>
,
optional
<
exactly
<
':'
>
>
>
(
src
);
...
...
prelexer.hpp
View file @
eb1eae78
...
...
@@ -351,6 +351,8 @@ namespace Sass {
const
char
*
uri
(
const
char
*
src
);
// Match CSS "!important" keyword.
const
char
*
important
(
const
char
*
src
);
// Match Sass "!default" keyword.
const
char
*
default_flag
(
const
char
*
src
);
// Match CSS pseudo-class/element prefixes
const
char
*
pseudo_prefix
(
const
char
*
src
);
// Match CSS function call openers.
...
...
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