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
ebc5cf7c
Commit
ebc5cf7c
authored
Mar 19, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working on more sophisticated lookahead in order to parse arithmetic expressions.
parent
44c140ed
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
76 additions
and
0 deletions
+76
-0
document_parser.cpp
document_parser.cpp
+76
-0
No files found.
document_parser.cpp
View file @
ebc5cf7c
...
@@ -282,4 +282,79 @@ namespace Sass {
...
@@ -282,4 +282,79 @@ namespace Sass {
{
p
=
q
;
}
{
p
=
q
;
}
return
p
==
start
?
0
:
p
;
return
p
==
start
?
0
:
p
;
}
}
// NEW LOOKAHEAD FUNCTIONS. THIS ESSENTIALLY IMPLEMENTS A BACKTRACKING
// PARSER, BECAUSE NEITHER SELECTORS NOR VALUES ARE EXPRESSIBLE IN A
// REGULAR LANGUAGE.
const
char
*
Document
::
look_for_selector_group
(
const
char
*
start
)
{
const
char
*
p
=
start
?
start
:
position
;
const
char
*
q
=
look_for_selector
(
p
);
if
(
!
q
)
{
return
0
;
}
else
{
p
=
q
;
}
while
((
q
=
peek
<
exactly
<
','
>
>
(
p
))
&&
(
q
=
look_for_selector
(
q
)))
{
p
=
q
;
}
return
p
;
}
const
char
*
look_for_selector
(
const
char
*
start
)
{
const
char
*
p
=
start
?
start
:
position
;
const
char
*
q
;
if
((
q
=
peek
<
exactly
<
'+'
>
>
(
p
))
||
(
q
=
peek
<
exactly
<
'~'
>
>
(
p
))
||
(
q
=
peek
<
exactly
<
'>'
>
>
(
p
)))
{
p
=
q
;
}
q
=
look_for_simple_selector_sequence
(
p
);
if
(
!
q
)
{
return
0
;
}
else
{
p
=
q
;
}
while
(((
q
=
peek
<
exactly
<
'+'
>
>
(
p
))
||
(
q
=
peek
<
exactly
<
'~'
>
>
(
p
))
||
(
q
=
peek
<
exactly
<
'>'
>
>
(
p
))
||
(
q
=
peek
<
ancestor_of
>
(
p
)))
&&
(
q
=
look_for_simple_selector_sequence
(
q
)))
{
p
=
q
;
}
return
p
;
}
const
char
*
look_for_simple_selector_sequence
(
const
char
*
start
)
{
const
char
*
p
=
start
?
start
:
position
;
const
char
*
q
;
if
((
q
=
peek
<
type_selector
>
(
p
))
||
(
q
=
peek
<
universal
>
(
p
))
||
(
q
=
peek
<
exactly
<
'&'
>
>
(
p
))
||
(
q
=
look_for_simple_selector
(
p
)))
{
p
=
q
;
}
else
{
return
0
;
}
while
(
!
peek
<
spaces
>
(
p
)
&&
!
(
peek
<
exactly
<
'+'
>
>
(
p
)
||
peek
<
exactly
<
'~'
>
>
(
p
)
||
peek
<
exactly
<
'>'
>
>
(
p
)
||
peek
<
exactly
<
','
>
>
(
p
)
||
peek
<
exactly
<
'{'
>
>
(
p
))
&&
(
q
=
look_for_simple_selector
(
p
)))
{
p
=
q
;
}
return
p
;
}
}
}
\ No newline at end of file
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