Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.

Commit ab4fe42

Browse files
author
Aaron Leung
committed
Ignoring the @charset directive for now.
1 parent 57a2f62 commit ab4fe42

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

constants.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ namespace Sass {
4444
extern const char kHz_kwd[] = "kHz";
4545

4646
// css functions and keywords
47+
extern const char charset_kwd[] = "@charset";
4748
extern const char media_kwd[] = "@media";
4849
extern const char only_kwd[] = "only";
4950
extern const char rgb_kwd[] = "rgb(";

constants.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ namespace Sass {
4444
extern const char kHz_kwd[];
4545

4646
// css functions and keywords
47+
extern const char charset_kwd[];
4748
extern const char media_kwd[];
4849
extern const char only_kwd[];
4950
extern const char rgb_kwd[];

document_parser.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ namespace Sass {
6666
root << parse_warning();
6767
if (!lex< exactly<';'> >()) throw_syntax_error("top-level @warn directive must be terminated by ';'");
6868
}
69+
// ignore the @charset directive for now
70+
else if (lex< exactly< charset_kwd > >()) {
71+
lex< string_constant >();
72+
lex< exactly<';'> >();
73+
}
6974
else if (peek< directive >()) {
7075
Node dir(parse_directive(Node(), Node::none));
7176
if (dir.type() == Node::blockless_directive) {
@@ -645,6 +650,11 @@ namespace Sass {
645650
else if (peek< media >()) {
646651
block << parse_media_query(inside_of);
647652
}
653+
// ignore the @charset directive for now
654+
else if (lex< exactly< charset_kwd > >()) {
655+
lex< string_constant >();
656+
lex< exactly<';'> >();
657+
}
648658
else if (peek< directive >()) {
649659
Node dir(parse_directive(surrounding_ruleset, inside_of));
650660
if (dir.type() == Node::blockless_directive) semicolon = true;

0 commit comments

Comments
 (0)