From c3c3dfc25b688e408dd4ca011a4063ecb256ac9c Mon Sep 17 00:00:00 2001 From: John Clements Date: Sun, 4 Jun 2017 10:25:02 -0700 Subject: [PATCH] add test and easy fix for cfg bug --- parser-tools-lib/parser-tools/cfg-parser.rkt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/parser-tools-lib/parser-tools/cfg-parser.rkt b/parser-tools-lib/parser-tools/cfg-parser.rkt index 07da911..bad6866 100644 --- a/parser-tools-lib/parser-tools/cfg-parser.rkt +++ b/parser-tools-lib/parser-tools/cfg-parser.rkt @@ -731,7 +731,7 @@ src-pos? (cons (car clauses) parser-clauses))]))))]) #`(let ([orig-parse (parser - [error (lambda (a b c) + [error (lambda (a b c . ignored) (error 'cfg-parser "unexpected ~a token: ~a" b c))] . #,parser-clauses)] [error-proc #,cfg-error]) @@ -906,10 +906,15 @@ (list (position-token (token-ZERO "zero") (position 2 2 5) - (position 3 2 6)))))))) + (position 3 2 6))))))) - + (check-exn #px"unexpected BOGUS token: #f" + (λ ()(parse (sequence->tokenizer + (list (position-token + 'BOGUS + (position 2 2 5) + (position 3 2 6)))))))) ;; Tests used during development