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
6ffd60ae
Commit
6ffd60ae
authored
Feb 29, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a matcher for SCSS variable names.
parent
6030f08c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
1 deletions
+13
-1
prelexer.cpp
src/prelexer.cpp
+6
-0
prelexer.hpp
src/prelexer.hpp
+3
-0
unit-test-prelexer.cpp
src/unit-test-prelexer.cpp
+4
-1
No files found.
src/prelexer.cpp
View file @
6ffd60ae
...
@@ -150,6 +150,11 @@ namespace Sass {
...
@@ -150,6 +150,11 @@ namespace Sass {
char
*
ancestor_of
(
char
*
src
)
{
char
*
ancestor_of
(
char
*
src
)
{
return
spaces
(
src
);
return
spaces
(
src
);
}
}
// Match SCSS variable names.
char
*
variable
(
char
*
src
)
{
return
sequence
<
exactly
<
'$'
>
,
name
>
(
src
);
}
}
}
}
}
\ No newline at end of file
src/prelexer.hpp
View file @
6ffd60ae
...
@@ -246,6 +246,9 @@ namespace Sass {
...
@@ -246,6 +246,9 @@ namespace Sass {
char
*
parent_of
(
char
*
src
);
char
*
parent_of
(
char
*
src
);
char
*
ancestor_of
(
char
*
src
);
char
*
ancestor_of
(
char
*
src
);
// Match SCSS variable names.
char
*
variable
(
char
*
src
);
// Utility functions for finding and counting characters in a string.
// Utility functions for finding and counting characters in a string.
template
<
char
c
>
template
<
char
c
>
char
*
find_first
(
char
*
src
)
{
char
*
find_first
(
char
*
src
)
{
...
...
src/unit-test-prelexer.cpp
View file @
6ffd60ae
...
@@ -46,7 +46,9 @@ char ws1[] = " /* hello */\t\n//blah\n /*blah*/ significant";
...
@@ -46,7 +46,9 @@ char ws1[] = " /* hello */\t\n//blah\n /*blah*/ significant";
char
hex1
[]
=
"#1a2b3c#f1ab"
;
char
hex1
[]
=
"#1a2b3c#f1ab"
;
char
hex2
[]
=
"#abc-zippo"
;
char
hex2
[]
=
"#abc-zippo"
;
char
nonhex1
[]
=
"#ab blah"
;
char
nonhex1
[]
=
"#ab blah"
;
char
nonhex2
[]
=
"#abc123blah"
;
char
nonhex2
[]
=
"#abc123blah"
;
char
var1
[]
=
"$hello blah"
;
char
nonvar1
[]
=
"$ hello"
;
extern
const
char
slash_star
[]
=
"/*"
;
extern
const
char
slash_star
[]
=
"/*"
;
...
@@ -88,6 +90,7 @@ int main() {
...
@@ -88,6 +90,7 @@ int main() {
check_twice
(
spaces_and_comments
,
ws1
,
num1
);
check_twice
(
spaces_and_comments
,
ws1
,
num1
);
check_twice
(
hex
,
hex1
,
nonhex1
);
check_twice
(
hex
,
hex1
,
nonhex1
);
check_twice
(
hex
,
hex2
,
nonhex2
);
check_twice
(
hex
,
hex2
,
nonhex2
);
check_twice
(
variable
,
var1
,
nonvar1
);
cout
<<
count_interval
<
'\n'
>
(
ws1
,
spaces_and_comments
(
ws1
))
<<
endl
;
cout
<<
count_interval
<
'\n'
>
(
ws1
,
spaces_and_comments
(
ws1
))
<<
endl
;
cout
<<
count_interval
<
'*'
>
(
ws1
,
spaces_and_comments
(
ws1
))
<<
endl
;
cout
<<
count_interval
<
'*'
>
(
ws1
,
spaces_and_comments
(
ws1
))
<<
endl
;
cout
<<
count_interval
<
exactly
<
slash_star
>
>
(
ws1
,
spaces_and_comments
(
ws1
))
<<
endl
;
cout
<<
count_interval
<
exactly
<
slash_star
>
>
(
ws1
,
spaces_and_comments
(
ws1
))
<<
endl
;
...
...
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