Skip to content

Commit

Permalink
style: raise error if trailing unexpected tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
pauloamed committed Sep 12, 2024
1 parent 850fac7 commit 32e5d21
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/web/vaev-style/decls.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include <vaev-css/parser.h>

#include "base.h"

namespace Vaev::Style {

template <typename T>
Expand Down Expand Up @@ -36,7 +38,7 @@ Res<P> parseDeclaration(Css::Sst const &sst) {
auto res = parseDeclarationValue<T>(cursor);
if (not res) {
resDecl = res.none();
return false;
return true;
}

resDecl = Ok(res.take());
Expand All @@ -46,6 +48,11 @@ Res<P> parseDeclaration(Css::Sst const &sst) {
resDecl.unwrap().important = Important::YES;
}

eatWhitespace(cursor);
if (not cursor.ended())
resDecl = Error::invalidData("unknown tokens in content");


return true;
});

Expand Down

0 comments on commit 32e5d21

Please sign in to comment.