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
d8419f01
Commit
d8419f01
authored
Feb 29, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added function for matching hex literals.
parent
d3b2584d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
0 deletions
+12
-0
prelexer.cpp
src/prelexer.cpp
+5
-0
prelexer.hpp
src/prelexer.hpp
+1
-0
unit-test-prelexer.cpp
src/unit-test-prelexer.cpp
+6
-0
No files found.
src/prelexer.cpp
View file @
d8419f01
...
@@ -107,6 +107,11 @@ namespace Sass {
...
@@ -107,6 +107,11 @@ namespace Sass {
char
*
dimension
(
char
*
src
)
{
char
*
dimension
(
char
*
src
)
{
return
sequence
<
number
,
identifier
>
(
src
);
return
sequence
<
number
,
identifier
>
(
src
);
}
}
char
*
hex
(
char
*
src
)
{
char
*
p
=
sequence
<
exactly
<
'#'
>
,
one_plus
<
xdigit
>
>
(
src
);
int
len
=
p
-
src
;
return
(
len
!=
4
&&
len
!=
7
)
?
0
:
p
;
}
// Match CSS uri specifiers.
// Match CSS uri specifiers.
extern
const
char
url_call
[]
=
"url("
;
extern
const
char
url_call
[]
=
"url("
;
char
*
uri
(
char
*
src
)
{
char
*
uri
(
char
*
src
)
{
...
...
src/prelexer.hpp
View file @
d8419f01
...
@@ -228,6 +228,7 @@ namespace Sass {
...
@@ -228,6 +228,7 @@ namespace Sass {
char
*
number
(
char
*
src
);
char
*
number
(
char
*
src
);
char
*
percentage
(
char
*
src
);
char
*
percentage
(
char
*
src
);
char
*
dimension
(
char
*
src
);
char
*
dimension
(
char
*
src
);
char
*
hex
(
char
*
src
);
// Match CSS uri specifiers.
// Match CSS uri specifiers.
char
*
uri
(
char
*
src
);
char
*
uri
(
char
*
src
);
// Match CSS function call openers.
// Match CSS function call openers.
...
...
src/unit-test-prelexer.cpp
View file @
d8419f01
...
@@ -43,6 +43,10 @@ char pre1[] = "^='hux'] { ... }";
...
@@ -43,6 +43,10 @@ char pre1[] = "^='hux'] { ... }";
char
suf1
[]
=
"$='baz'] { ... }"
;
char
suf1
[]
=
"$='baz'] { ... }"
;
char
sub1
[]
=
"*='bum'] { ... }"
;
char
sub1
[]
=
"*='bum'] { ... }"
;
char
ws1
[]
=
" /* hello */
\t\n
//blah
\n
/*blah*/ significant"
;
char
ws1
[]
=
" /* hello */
\t\n
//blah
\n
/*blah*/ significant"
;
char
hex1
[]
=
"#1a2b3c#f1ab"
;
char
hex2
[]
=
"#abc-zippo"
;
char
nonhex1
[]
=
"#ab blah"
;
char
nonhex2
[]
=
"#abc123blah"
;
extern
const
char
slash_star
[]
=
"/*"
;
extern
const
char
slash_star
[]
=
"/*"
;
...
@@ -82,6 +86,8 @@ int main() {
...
@@ -82,6 +86,8 @@ int main() {
check_twice
(
suffix_match
,
suf1
,
pre1
);
check_twice
(
suffix_match
,
suf1
,
pre1
);
check_twice
(
substring_match
,
sub1
,
suf1
);
check_twice
(
substring_match
,
sub1
,
suf1
);
check_twice
(
spaces_and_comments
,
ws1
,
num1
);
check_twice
(
spaces_and_comments
,
ws1
,
num1
);
check_twice
(
hex
,
hex1
,
nonhex1
);
check_twice
(
hex
,
hex2
,
nonhex2
);
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