CSS with empty declarations

Dirk Mueller mueller@kde.org
Mon, 20 Jan 2003 04:52:43 +0100


--k+w/mQv8wyuph6w0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi, 

the new CSS parser seems to be unable to parse empty declarations properly: 

<html>
  <head>
    <style>
.neutralColorBlack { background-color:#000000; }
.functionSearch   { }
.cmsBgColorLight0 { background-color: #FFFFFF; } 
</style>

  </head>
  <body>
    <div class="neutralColorBlack">
        <div class="cmsBgColorLight0">labalaba</div>
  </body>
</html>


I came up with this straight-forward patch, but it produceses an additional
reduce/reduce conflict, and it doesn't elegantly solve the problem because 
it still accepts the selector and creates a data structure for it, while 
this is a wasted effort here. 

I'm not too familiar with bison grammar, therefore I ask for review. 



-- 
Dirk (received 81 mails today)

--k+w/mQv8wyuph6w0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="cssparser.diff"

Index: parser.y
===================================================================
RCS file: /home/kde/kdelibs/khtml/css/parser.y,v
retrieving revision 1.11
diff -u -5 -d -p -r1.11 parser.y
--- parser.y	20 Jan 2003 00:13:35 -0000	1.11
+++ parser.y	20 Jan 2003 03:49:33 -0000
@@ -688,10 +688,11 @@ declaration:
 #endif
 	}
 	delete p->valueList;
 	p->valueList = 0;
     }
+    | /* empty */ { $$ = false; }
   ;
 
 property:
     IDENT maybe_space {
 	QString str = qString($1);

--k+w/mQv8wyuph6w0--