automatic semicolon insertion

porten at froglogic.com porten at froglogic.com
Fri Nov 7 10:57:21 CET 2003


Hi,

we received a report about a parse error that boiled down to be due to a
lack of yet another case of automatic semicolon insertion. Minimal test
case:

 { throw 1 }

Fixed by the attached patch.

Harri.

P.S. Is everyone from Apple subscribed to khtml-cvs ? All our commits are
cc'ed there. Would make sure that all our fixes can be picked up
automatically leaving this list for non-trivial changes to be discussed.
-------------- next part --------------
cvs -f log -N -r1.59 grammar.y

RCS file: /home/kde/kdelibs/kjs/grammar.y,v
Working file: grammar.y
head: 1.59
branch:
locks: strict
access list:
keyword substitution: kv
total revisions: 64;	selected revisions: 1
description:
----------------------------
revision 1.59
date: 2003/11/07 09:48:43;  author: porten;  state: Exp;  lines: +4 -0
do automatic semicolon insertion after throw statements

Had to revert Helio's lexer.cpp change as I am using an older bison
than he is. It's more recent than the one that was causing problems for him
last time, though.

CCMAIL: 66808-done at bugs.kde.org
=============================================================================
cvs -f diff -kk -bp -u -r1.58 -r1.59 grammar.y
Index: grammar.y
===================================================================
RCS file: /home/kde/kdelibs/kjs/grammar.y,v
retrieving revision 1.58
retrieving revision 1.59
diff -b -p -u -r1.58 -r1.59
--- grammar.y	6 Nov 2003 21:10:15 -0000	1.58
+++ grammar.y	7 Nov 2003 09:48:43 -0000	1.59
@@ -563,6 +563,10 @@ LabelledStatement:
 
 ThrowStatement:
     THROW Expr ';'                 { $$ = new ThrowNode($2); DBG($$, at 1, at 3); }
+  | THROW Expr error               { if (automatic()) {
+                                       $$ = new ThrowNode($2); DBG($$, at 1, at 1);
+                                     } else {
+				       YYABORT; } }
 ;
 
 TryStatement:


More information about the Khtml-devel mailing list