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
9867ac1a
Commit
9867ac1a
authored
Apr 13, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Still working on syntax error handling.
parent
0efb479b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
9 deletions
+26
-9
document_parser.cpp
document_parser.cpp
+11
-7
exceptional.scss
exceptional.scss
+15
-2
No files found.
document_parser.cpp
View file @
9867ac1a
...
...
@@ -28,7 +28,7 @@ namespace Sass {
}
else
if
(
peek
<
variable
>
(
position
))
{
root
<<
parse_assignment
();
// missing semicolon will be caught further down
if
(
!
lex
<
exactly
<
';'
>
>
())
syntax_error
(
"top-level variable binding must be terminated by ';'"
);
}
else
{
root
<<
parse_ruleset
();
...
...
@@ -158,7 +158,7 @@ namespace Sass {
ruleset
<<
parse_selector_group
();
// if (ruleset[0].type == Node::selector) cerr << "ruleset starts with selector" << endl;
// if (ruleset[0].type == Node::selector_group) cerr << "ruleset starts with selector_group" << endl;
if
(
!
peek
<
exactly
<
'{'
>
>
())
syntax_error
(
"expected a '{' after the selector"
);
ruleset
<<
parse_block
(
definition
);
return
ruleset
;
}
...
...
@@ -389,17 +389,20 @@ namespace Sass {
block
<<
Node
(
Node
::
flags
);
while
(
!
lex
<
exactly
<
'}'
>
>
())
{
if
(
semicolon
)
{
lex
<
exactly
<
';'
>
>
();
// enforce terminal ';' here
if
(
!
lex
<
exactly
<
';'
>
>
())
syntax_error
(
"non-terminal statement or declaration must end with ';'"
);
semicolon
=
false
;
if
(
lex
<
exactly
<
'}'
>
>
())
break
;
//
if (lex< exactly<'}'> >()) break;
}
if
(
lex
<
block_comment
>
())
{
block
<<
Node
(
Node
::
comment
,
line_number
,
lexed
);
block
[
0
].
has_statements
=
true
;
semicolon
=
true
;
//
semicolon = true;
}
else
if
(
peek
<
import
>
(
position
))
{
// TO DO: disallow imports inside of definitions
if
(
definition
)
{
lex
<
import
>
();
// to adjust the line number
syntax_error
(
"@import directive not allowed inside mixin definition"
);
}
Node
imported_tree
(
parse_import
());
for
(
int
i
=
0
;
i
<
imported_tree
.
size
();
++
i
)
{
if
(
imported_tree
[
i
].
type
==
Node
::
comment
||
...
...
@@ -416,6 +419,7 @@ namespace Sass {
else
if
(
peek
<
include
>
(
position
))
{
block
<<
parse_mixin_call
();
block
[
0
].
has_expansions
=
true
;
semicolon
=
true
;
}
else
if
(
lex
<
variable
>
())
{
block
<<
parse_assignment
();
...
...
@@ -438,7 +442,7 @@ namespace Sass {
block
<<
parse_rule
();
block
[
0
].
has_statements
=
true
;
semicolon
=
true
;
lex
<
exactly
<
';'
>
>
();
// TO DO: clean up the semicolon handling stuff
//
lex< exactly<';'> >(); // TO DO: clean up the semicolon handling stuff
}
else
lex
<
exactly
<
';'
>
>
();
while
(
lex
<
block_comment
>
())
{
...
...
exceptional.scss
View file @
9867ac1a
$x
:
1
2
3
;
bobo
+
mogo
{
hey
:
hoo
;
}
@mixin
moogoo
()
{
hey
:
ho
;
div
{
blah
:
blah
;
}
}
:nth-of-type
(
2
)
{
foo
:
bar
;
}
div
[
hux
~=
"hello"
{
foo
:
bar
;
div
[
hux
~=
"hello"
]
{
hux
:
blux
;
foo
:
boo
;
@include
moogoo
;
dux
:
mux
}
\ 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