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
ef6d9046
Commit
ef6d9046
authored
Feb 20, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding another matcher and moving a few things around.
parent
07648e9d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
9 deletions
+17
-9
prefix.c
src/prefix.c
+4
-6
prefix.h
src/prefix.h
+8
-3
test_prefix.c
src/test_prefix.c
+5
-0
No files found.
src/prefix.c
View file @
ef6d9046
...
...
@@ -163,6 +163,8 @@ static SEQUENCE_MATCHER(identstart, sass_prefix_is_optional_hyphen, sass_prefix_
ONE_PLUS_MATCHER
(
name
,
sass_prefix_is_nmchar
);
FIRST_REST_MATCHER
(
identifier
,
sass_prefix_is_identstart
,
sass_prefix_is_nmchar
);
SEQUENCE_MATCHER
(
variable
,
sass_prefix_is_dollar
,
sass_prefix_is_identifier
);
static
OPTIONAL_MATCHER
(
optional_digits
,
sass_prefix_is_digits
);
static
SEQUENCE_MATCHER
(
realnum
,
sass_prefix_is_optional_digits
,
sass_prefix_is_dot
,
sass_prefix_is_digits
);
ALTERNATIVES_MATCHER
(
number
,
sass_prefix_is_digits
,
sass_prefix_is_realnum
);
...
...
@@ -176,8 +178,4 @@ static OPTIONAL_MATCHER(optional_spaces, sass_prefix_is_spaces);
SEQUENCE_MATCHER
(
adjacent_to
,
sass_prefix_is_optional_spaces
,
sass_prefix_is_plus
);
SEQUENCE_MATCHER
(
precedes
,
sass_prefix_is_optional_spaces
,
sass_prefix_is_tilde
);
SEQUENCE_MATCHER
(
parent_of
,
sass_prefix_is_optional_spaces
,
sass_prefix_is_gt
);
char
*
sass_prefix_is_ancestor_of
(
char
*
src
)
{
char
*
p
=
src
;
while
(
isspace
(
*
p
))
p
++
;
return
p
==
src
?
NULL
:
p
;
}
\ No newline at end of file
ALIAS_MATCHERS
(
sass_prefix_is_spaces
,
ancestor_of
);
\ No newline at end of file
src/prefix.h
View file @
ef6d9046
...
...
@@ -3,8 +3,11 @@ typedef char *(*sass_prefix_matcher)(char *);
#define DECLARE(name) \
char *sass_prefix_is_ ## name(char *)
#define DECLARE_ALIAS(name) \
sass_prefix_matcher sass_prefix_is_ ## name
#define ALIAS_MATCHERS(orig, new) \
char *(*new)(char *) =
orig
sass_prefix_matcher sass_prefix_is_ ## new = &
orig
#define CHAR_MATCHER(name, prefix) \
char *sass_prefix_is_ ## name(char *src) { \
...
...
@@ -174,6 +177,8 @@ DECLARE(substringmatch);
DECLARE
(
name
);
DECLARE
(
identifier
);
DECLARE
(
variable
);
DECLARE
(
number
);
DECLARE
(
string
);
...
...
@@ -184,4 +189,5 @@ DECLARE(functional);
DECLARE
(
adjacent_to
);
DECLARE
(
parent_of
);
DECLARE
(
precedes
);
DECLARE
(
ancestor_of
);
\ No newline at end of file
DECLARE_ALIAS
(
ancestor_of
);
src/test_prefix.c
View file @
ef6d9046
...
...
@@ -42,6 +42,8 @@ int main() {
char
*
integer3
=
"-294729+1"
;
char
*
class
=
".blah-blah_bloo112-blah+blee4 hello"
;
char
*
id
=
"#foo_bar-baz123-hux blee"
;
char
*
var
=
"$blah123-blah"
;
char
*
non_var
=
"$ hux"
;
test1
(
sass_prefix_is_spaces
,
spaces
);
test1
(
sass_prefix_is_spaces
,
words
);
...
...
@@ -96,6 +98,9 @@ int main() {
test1
(
sass_prefix_is_idname
,
id
);
test1
(
sass_prefix_is_idname
,
class
);
test1
(
sass_prefix_is_variable
,
var
);
test1
(
sass_prefix_is_variable
,
non_var
);
return
0
;
}
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