]> gitweb.factorcode.org Git - factor.git/commitdiff
peg: use concurrency.lock for compilation
authorJohn Benediktsson <mrjbq7@gmail.com>
Mon, 28 Aug 2023 21:12:51 +0000 (14:12 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 28 Aug 2023 21:12:51 +0000 (14:12 -0700)
basis/peg/peg.factor

index 87923a264852fcb9a7ba76fb78540992bd924622..c3866a441caadab113475f14260f28f774379650 100644 (file)
@@ -2,10 +2,10 @@
 ! See https://factorcode.org/license.txt for BSD license.
 
 USING: accessors arrays assocs classes combinators
-combinators.short-circuit compiler.units effects.parser kernel
-literals make math math.order memoize namespaces quotations
-sequences sets splitting strings unicode vectors vocabs.loader
-words ;
+combinators.short-circuit compiler.units concurrency.locks
+effects.parser kernel literals make math math.order memoize
+namespaces quotations sequences sets splitting strings unicode
+vectors vocabs.loader words ;
 
 IN: peg
 
@@ -595,13 +595,15 @@ PRIVATE>
 
 SYNTAX: PARTIAL-PEG:
     (:) [
-        '[ @ compile-parser ] ( -- word ) memoize-quot
+        <lock> swap
+        '[ _ [ @ compile-parser ] with-lock ] ( -- word ) memoize-quot
         '[ @ perform-parse ast>> ]
     ] dip define-declared ;
 
 SYNTAX: PEG:
     (:) [
-        '[ @ compile-parser ] ( -- word ) memoize-quot
+        <lock> swap
+        '[ _ [ @ compile-parser ] with-lock ] ( -- word ) memoize-quot
         '[ @ perform-parse check-parse-result ast>> ]
     ] dip define-declared ;