Skip to content

Commit

Permalink
Take care of declaration first token
Browse files Browse the repository at this point in the history
  • Loading branch information
liZe committed Feb 10, 2024
1 parent 21dd31a commit f695870
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions tinycss2/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,14 @@ def _consume_declaration_in_list(first_token, tokens):
"""Like :func:`_parse_declaration`, but stop at the first ``;``."""
declaration_tokens = []
semicolon_token = []
for token in tokens:
if token == ';':
semicolon_token.append(token)
break
declaration_tokens.append(token)
if token.type == '{} block':
break
if first_token != ';' and first_token.type != '{} block':
for token in tokens:
if token == ';':
semicolon_token.append(token)
break
declaration_tokens.append(token)
if token.type == '{} block':
break
declaration = _parse_declaration(first_token, iter(declaration_tokens))
if declaration.type == 'declaration':
return declaration
Expand Down

0 comments on commit f695870

Please sign in to comment.