]> gitweb.factorcode.org Git - factor.git/commitdiff
xmode.rules: throw error if there is no character for the string-matcher
authorDoug Coleman <doug.coleman@gmail.com>
Thu, 26 Jan 2023 18:18:53 +0000 (12:18 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Thu, 26 Jan 2023 19:58:31 +0000 (13:58 -0600)
good case before this:
<SEQ TYPE="NULL" DELEGATE="MAIN"> </SEQ>

bad case before this:
<SEQ TYPE="NULL" DELEGATE="MAIN"></SEQ>

Now both seem to work.

basis/xmode/rules/rules.factor

index 3b728a8e7349fc43097b22397a37fada476d7f1f..24fbdd6b1621f698780196fc5bc8fd3aeca9c7df 100644 (file)
@@ -90,11 +90,13 @@ TUPLE: escape-rule < rule ;
     f <string-matcher> f f f <matcher>
     escape-rule new swap >>start ;
 
+ERROR: text-required ;
+
 GENERIC: text-hash-char ( text -- ch )
 
 M: f text-hash-char ;
 
-M: string-matcher text-hash-char string>> first ;
+M: string-matcher text-hash-char string>> [ text-required ] [ first ] if-empty ;
 
 M: regexp text-hash-char drop f ;