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
038c77f9
Commit
038c77f9
authored
Jun 27, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allowing interpolants in function names.
parent
cd6042d5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
10 deletions
+19
-10
document_parser.cpp
document_parser.cpp
+15
-8
eval_apply.cpp
eval_apply.cpp
+3
-1
prelexer.cpp
prelexer.cpp
+1
-1
No files found.
document_parser.cpp
View file @
038c77f9
...
@@ -820,7 +820,10 @@ namespace Sass {
...
@@ -820,7 +820,10 @@ namespace Sass {
lex
<
exactly
<
')'
>
>
();
lex
<
exactly
<
')'
>
>
();
return
result
;
return
result
;
}
}
if
(
peek
<
functional
>
())
{
return
parse_function_call
();
}
if
(
lex
<
value_schema
>
())
if
(
lex
<
value_schema
>
())
{
return
Document
::
make_from_token
(
context
,
lexed
,
path
,
line
).
parse_value_schema
();
}
{
return
Document
::
make_from_token
(
context
,
lexed
,
path
,
line
).
parse_value_schema
();
}
...
@@ -829,10 +832,7 @@ namespace Sass {
...
@@ -829,10 +832,7 @@ namespace Sass {
if
(
lex
<
sequence
<
false_kwd
,
negate
<
identifier
>
>
>
())
if
(
lex
<
sequence
<
false_kwd
,
negate
<
identifier
>
>
>
())
{
return
context
.
new_Node
(
Node
::
boolean
,
path
,
line
,
false
);
}
{
return
context
.
new_Node
(
Node
::
boolean
,
path
,
line
,
false
);
}
if
(
peek
<
functional
>
())
{
return
parse_function_call
();
}
if
(
lex
<
important
>
())
if
(
lex
<
important
>
())
{
return
context
.
new_Node
(
Node
::
important
,
path
,
line
,
lexed
);
}
{
return
context
.
new_Node
(
Node
::
important
,
path
,
line
,
lexed
);
}
...
@@ -947,7 +947,7 @@ namespace Sass {
...
@@ -947,7 +947,7 @@ namespace Sass {
}
}
Node
Document
::
parse_identifier_schema
()
Node
Document
::
parse_identifier_schema
()
{
{
lex
<
sequence
<
optional
<
exactly
<
'*'
>
>
,
identifier_schema
>
>
();
lex
<
sequence
<
optional
<
exactly
<
'*'
>
>
,
identifier_schema
>
>
();
Token
id
(
lexed
);
Token
id
(
lexed
);
const
char
*
i
=
id
.
begin
;
const
char
*
i
=
id
.
begin
;
...
@@ -988,8 +988,15 @@ namespace Sass {
...
@@ -988,8 +988,15 @@ namespace Sass {
Node
Document
::
parse_function_call
()
Node
Document
::
parse_function_call
()
{
{
lex
<
identifier
>
();
Node
name
;
Node
name
(
context
.
new_Node
(
Node
::
identifier
,
path
,
line
,
lexed
));
if
(
lex
<
identifier_schema
>
())
{
name
=
parse_identifier_schema
();
}
else
{
lex
<
identifier
>
();
name
=
context
.
new_Node
(
Node
::
identifier
,
path
,
line
,
lexed
);
}
Node
args
(
parse_arguments
());
Node
args
(
parse_arguments
());
Node
call
(
context
.
new_Node
(
Node
::
function_call
,
path
,
line
,
2
));
Node
call
(
context
.
new_Node
(
Node
::
function_call
,
path
,
line
,
2
));
call
<<
name
<<
args
;
call
<<
name
<<
args
;
...
...
eval_apply.cpp
View file @
038c77f9
...
@@ -290,7 +290,9 @@ namespace Sass {
...
@@ -290,7 +290,9 @@ namespace Sass {
case
Node
:
:
function_call
:
{
case
Node
:
:
function_call
:
{
// TO DO: default-constructed Function should be a generic callback (maybe)
// TO DO: default-constructed Function should be a generic callback (maybe)
pair
<
string
,
size_t
>
sig
(
expr
[
0
].
token
().
to_string
(),
expr
[
1
].
size
());
// eval the function name in case it's interpolated
expr
[
0
]
=
eval
(
expr
[
0
],
prefix
,
env
,
f_env
,
new_Node
,
ctx
);
pair
<
string
,
size_t
>
sig
(
expr
[
0
].
to_string
(),
expr
[
1
].
size
());
if
(
!
f_env
.
count
(
sig
))
{
if
(
!
f_env
.
count
(
sig
))
{
Node
args
(
expr
[
1
]);
Node
args
(
expr
[
1
]);
for
(
size_t
i
=
0
,
S
=
args
.
size
();
i
<
S
;
++
i
)
{
for
(
size_t
i
=
0
,
S
=
args
.
size
();
i
<
S
;
++
i
)
{
...
...
prelexer.cpp
View file @
038c77f9
...
@@ -298,7 +298,7 @@ namespace Sass {
...
@@ -298,7 +298,7 @@ namespace Sass {
}
}
// Match CSS function call openers.
// Match CSS function call openers.
const
char
*
functional
(
const
char
*
src
)
{
const
char
*
functional
(
const
char
*
src
)
{
return
sequence
<
identifier
,
exactly
<
'('
>
>
(
src
);
return
sequence
<
alternatives
<
identifier_schema
,
identifier
>
,
exactly
<
'('
>
>
(
src
);
}
}
// Match the CSS negation pseudo-class.
// Match the CSS negation pseudo-class.
extern
const
char
pseudo_not_chars
[]
=
":not("
;
extern
const
char
pseudo_not_chars
[]
=
":not("
;
...
...
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