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
7d2dd600
Commit
7d2dd600
authored
Mar 12, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working on parsing attribute selectors.
parent
a5080f4e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
3 deletions
+49
-3
attribute_selectors.scss
attribute_selectors.scss
+7
-0
document.hpp
document.hpp
+1
-0
document_parser.cpp
document_parser.cpp
+21
-3
prelexer.hpp
prelexer.hpp
+20
-0
No files found.
attribute_selectors.scss
0 → 100644
View file @
7d2dd600
[
hey
=
'ho'
]
{
blah
:
blah
;
[
hoo
*=
"ha"
]
{
bloo
:
bloo
;
}
}
\ No newline at end of file
document.hpp
View file @
7d2dd600
...
...
@@ -105,6 +105,7 @@ namespace Sass {
Node
parse_selector
();
Node
parse_simple_selector_sequence
();
Node
parse_simple_selector
();
Node
parse_attribute_selector
();
Node
parse_block
();
Node
parse_rule
();
Node
parse_values
();
...
...
document_parser.cpp
View file @
7d2dd600
...
...
@@ -86,9 +86,27 @@ namespace Sass {
Node
Document
::
parse_simple_selector
()
{
lex
<
id_name
>
()
||
lex
<
class_name
>
()
/*|| lex< attribute >() ||
lex< pseudo >() || lex< negation >()*/
;
return
Node
(
line_number
,
Node
::
simple_selector
,
lexed
);
if
(
lex
<
id_name
>
()
||
lex
<
class_name
>
())
{
return
Node
(
line_number
,
Node
::
simple_selector
,
lexed
);
}
else
if
(
peek
<
exactly
<
'['
>
>
(
position
))
{
return
parse_attribute_selector
();
}
}
Node
Document
::
parse_attribute_selector
()
{
Node
attr_sel
(
line_number
,
Node
::
attribute_selector
,
3
);
lex
<
exactly
<
'['
>
>
();
lex
<
type_selector
>
();
attr_sel
<<
Node
(
line_number
,
Node
::
value
,
lexed
);
lex
<
alternatives
<
exact_match
,
class_match
,
dash_match
,
prefix_match
,
suffix_match
,
substring_match
>
>
();
attr_sel
<<
Node
(
line_number
,
Node
::
value
,
lexed
);
lex
<
string_constant
>
();
attr_sel
<<
Node
(
line_number
,
Node
::
value
,
lexed
);
lex
<
exactly
<
']'
>
>
();
return
attr_sel
;
}
Node
Document
::
parse_block
()
...
...
prelexer.hpp
View file @
7d2dd600
...
...
@@ -121,6 +121,26 @@ namespace Sass {
return
rslt
;
}
// Same as above, but with 5 arguments.
template
<
prelexer
mx1
,
prelexer
mx2
,
prelexer
mx3
,
prelexer
mx4
,
prelexer
mx5
>
char
*
alternatives
(
char
*
src
)
{
char
*
rslt
;
(
rslt
=
mx1
(
src
))
||
(
rslt
=
mx2
(
src
))
||
(
rslt
=
mx3
(
src
))
||
(
rslt
=
mx4
(
src
))
||
(
rslt
=
mx5
(
src
));
return
rslt
;
}
// Same as above, but with 6 arguments.
template
<
prelexer
mx1
,
prelexer
mx2
,
prelexer
mx3
,
prelexer
mx4
,
prelexer
mx5
,
prelexer
mx6
>
char
*
alternatives
(
char
*
src
)
{
char
*
rslt
;
(
rslt
=
mx1
(
src
))
||
(
rslt
=
mx2
(
src
))
||
(
rslt
=
mx3
(
src
))
||
(
rslt
=
mx4
(
src
))
||
(
rslt
=
mx5
(
src
))
||
(
rslt
=
mx6
(
src
));
return
rslt
;
}
// Tries the matchers in sequence and succeeds if they all succeed.
template
<
prelexer
mx1
,
prelexer
mx2
>
char
*
sequence
(
char
*
src
)
{
...
...
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