From d2a730dda8e05459a3450fa16fc8c4d91304a18e Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Fri, 29 Mar 2013 09:43:05 -0700 Subject: [PATCH] peg.ebnf: Throw errors not strings. --- basis/peg/ebnf/ebnf.factor | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/basis/peg/ebnf/ebnf.factor b/basis/peg/ebnf/ebnf.factor index 25c908e0b7..40891086ad 100644 --- a/basis/peg/ebnf/ebnf.factor +++ b/basis/peg/ebnf/ebnf.factor @@ -538,16 +538,17 @@ M: ebnf-non-terminal (transform) ( ast -- parser ) : transform-ebnf ( string -- object ) 'ebnf' parse transform ; +ERROR: unable-to-fully-parse-ebnf remaining ; + +ERROR: could-not-parse-ebnf ; + : check-parse-result ( result -- result ) [ dup remaining>> [ blank? ] trim [ - [ - "Unable to fully parse EBNF. Left to parse was: " % - % - ] "" make throw + unable-to-fully-parse-ebnf ] unless-empty ] [ - "Could not parse EBNF" throw + could-not-parse-ebnf ] if* ; : parse-ebnf ( string -- hashtable )