Ensure box parsers are never cached

db4
Chris Double 2008-03-31 00:53:33 +13:00
parent bb8198d3d0
commit 5989680a7b
1 changed files with 11 additions and 3 deletions

View File

@ -488,8 +488,11 @@ M: box-parser (compile) ( parser -- quot )
#! Calls the quotation at compile time
#! to produce the parser to be compiled.
#! This differs from 'delay' which calls
#! it at run time.
quot>> call compiled-parser 1quotation ;
#! it at run time. Due to using the runtime
#! environment at compile time, this parser
#! must not be cached, so we clear out the
#! delgates cache.
f >>compiled quot>> call compiled-parser 1quotation ;
PRIVATE>
@ -560,7 +563,12 @@ PRIVATE>
delay-parser construct-boa init-parser ;
: box ( quot -- parser )
box-parser construct-boa init-parser ;
#! because a box has its quotation run at compile time
#! it must always have a new parser delgate created,
#! not a cached one. This is because the same box,
#! compiled twice can have a different compiled word
#! due to running at compile time.
box-parser construct-boa next-id f <parser> over set-delegate ;
: PEG:
(:) [