diff --git a/lesscpy/lessc/lexer.py b/lesscpy/lessc/lexer.py index 14bc009..dd03053 100644 --- a/lesscpy/lessc/lexer.py +++ b/lesscpy/lessc/lexer.py @@ -75,6 +75,7 @@ class LessLexer: def __init__(self): self.build(reflags=re.UNICODE|re.IGNORECASE) self.last = None + self.next = None def t_css_filter(self, t): (r'\[[^\]]*\]' @@ -219,11 +220,24 @@ class LessLexer: def token(self): """ """ + if self.next: + t = self.next + self.next = None + return t while True: t = self.lexer.token() if not t: return t if t.type == 't_ws' and self.last and self.last.type not in self.significant_ws: continue + if t.type == '}' and self.last and self.last.type not in '{;}': + self.next = t + tok = lex.LexToken() + tok.type = ';' + tok.value = ';' + tok.lineno = t.lineno + tok.lexpos = t.lexpos + self.last = tok + return tok self.last = t break return t diff --git a/lesscpy/test/css/ws.css b/lesscpy/test/css/ws.css index 9534e15..06e8897 100644 --- a/lesscpy/test/css/ws.css +++ b/lesscpy/test/css/ws.css @@ -23,3 +23,15 @@ background: the, great, wall; border: 2px solid black; } +.no_final_semi { + color: white; +} +.no_final_semi1 { + color: yellow; + color: white; +} +@media all { + html { + padding: src('no semi in media block'); + } +} diff --git a/lesscpy/test/css/ws.min.css b/lesscpy/test/css/ws.min.css index 1aa9ef7..5087239 100644 --- a/lesscpy/test/css/ws.min.css +++ b/lesscpy/test/css/ws.min.css @@ -6,3 +6,7 @@ .whitespace{color:black;} .white,.space,.mania{color:white;} .newlines{background:the,great,wall;border:2px solid black;} +.no_final_semi{color:white;} +.no_final_semi1{color:yellow;color:white;} +@media all{html{padding:src('no semi in media block');} +} diff --git a/lesscpy/test/less/ws.less b/lesscpy/test/less/ws.less index 59d0597..706631f 100644 --- a/lesscpy/test/less/ws.less +++ b/lesscpy/test/less/ws.less @@ -43,3 +43,17 @@ .empty { } +.no_final_semi { + color: white +} +.no_final_semi1 { +color: yellow; + color: white + + +} +@media all { + html { + padding: src('no semi in media block') + } +} \ No newline at end of file