]> gitweb.factorcode.org Git - factor.git/commitdiff
modern: add a rewrite-file word
authorDoug Coleman <doug.coleman@gmail.com>
Thu, 26 Jan 2023 01:44:37 +0000 (19:44 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Thu, 26 Jan 2023 19:58:31 +0000 (13:58 -0600)
extra/modern/modern.factor

index 2648b03c2ff21cc2eba4691c0b5d598d9770168f..f0b5402cf753afa253755843f7a63c8587fb36b4 100644 (file)
@@ -487,6 +487,9 @@ ERROR: compound-syntax-disallowed n seq obj ;
 
 : failed-lexing ( assoc -- assoc' ) [ nip array? ] assoc-reject ;
 
+: rewrite-file ( path encoding quot: ( str -- str' ) -- )
+    '[ file-contents @ ] 2keep set-file-contents ; inline
+
 : lex-core ( -- assoc ) core-vocabs lex-vocabs ;
 : lex-basis ( -- assoc ) basis-vocabs lex-vocabs ;
 : lex-extra ( -- assoc ) extra-vocabs lex-vocabs ;