]> gitweb.factorcode.org Git - factor.git/commitdiff
peg.ebnf: Throw errors not strings.
authorDoug Coleman <doug.coleman@gmail.com>
Fri, 29 Mar 2013 16:43:05 +0000 (09:43 -0700)
committerDoug Coleman <doug.coleman@gmail.com>
Fri, 29 Mar 2013 16:51:26 +0000 (09:51 -0700)
basis/peg/ebnf/ebnf.factor

index 25c908e0b7ca0d43a032538d07e718e0e51af557..40891086ad0e85da706d48d224c0084222bad9b4 100644 (file)
@@ -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 )