bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: Check yyerrok


From: Akim Demaille
Subject: FYI: Check yyerrok
Date: Wed, 27 Aug 2008 10:34:20 +0200

From 6501566813190e211a55a44216044135b19259b0 Mon Sep 17 00:00:00 2001
From: Akim Demaille <address@hidden>
Date: Mon, 4 Aug 2008 23:23:27 +0200
Subject: [PATCH] Check yyerrok in calc.at.

        * tests/calc.at (calc.y): Use yyerrok on "( error )".
        (AT_CHECK_CALC): Add a check that ensures that yyerrok works as
        expected.
---
 ChangeLog     |    7 +++++++
 tests/calc.at |   12 ++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c961b7b..e146d19 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2008-08-27  Akim Demaille  <address@hidden>

+       Check yyerrok in calc.at.
+        * tests/calc.at (calc.y): Use yyerrok on "( error )".
+        (AT_CHECK_CALC): Add a check that ensures that yyerrok works as
+        expected.
+
+2008-08-27  Akim Demaille  <address@hidden>
+
        Support yyerrok in lalr1.cc.
        YYBACKUP is still to import back into lalr1.cc.
         * data/lalr1.cc (yyerrork, yyclearin, YYRECOVERING): Define.
diff --git a/tests/calc.at b/tests/calc.at
index 189b5b3..2624908 100644
--- a/tests/calc.at
+++ b/tests/calc.at
@@ -1,6 +1,6 @@
 # Simple calculator.                         -*- Autotest -*-

-# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software +# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software
 # Foundation, Inc.

 # This program is free software: you can redistribute it and/or modify
@@ -139,7 +139,7 @@ exp:
 | '-' exp  %prec NEG { $$ = -$2;            }
 | exp '^' exp        { $$ = power ($1, $3); }
 | '(' exp ')'        { $$ = $2;             }
-| '(' error ')'      { $$ = 1111;           }
+| '(' error ')'      { $$ = 1111; yyerrok;  }
 | '!'                { $$ = 0; YYERROR;     }
 | '-' error          { $$ = 0; YYERROR;     }
 ;
@@ -529,6 +529,14 @@ _AT_CHECK_CALC_ERROR([$1], [0], [(- *) + (0 0) = 1], [113], [1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!'
 1.12: syntax error, unexpected number
 calc: error: 2222 != 1])
+
+# Check that yyerrok works properly: second error is not reported,
+# third and fourth are.  Parse status is succesfull.
+_AT_CHECK_CALC_ERROR([$1], [0], [(* *) + (*) + (*)], [113],
+[1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!'])
+
 AT_BISON_OPTION_POPDEFS

 AT_CLEANUP
--
1.6.0.1.90.g27a6e






reply via email to

[Prev in Thread] Current Thread [Next in Thread]