Fixing libraries for stack checker changes

db4
Slava Pestov 2008-08-27 19:27:06 -05:00
parent a252844e3e
commit bcaade8005
11 changed files with 49 additions and 55 deletions

Binary file not shown.

View File

@ -96,12 +96,12 @@ M: object execute-statement* ( statement type -- )
: sql-row-typed ( result-set -- seq ) : sql-row-typed ( result-set -- seq )
dup #columns [ row-column-typed ] with map ; dup #columns [ row-column-typed ] with map ;
: query-each ( statement quot -- ) : query-each ( statement quot: ( statement -- ) -- )
over more-rows? [ over more-rows? [
[ call ] 2keep over advance-row query-each [ call ] 2keep over advance-row query-each
] [ ] [
2drop 2drop
] if ; inline ] if ; inline recursive
: query-map ( statement quot -- seq ) : query-map ( statement quot -- seq )
accumulator >r query-each r> { } like ; inline accumulator >r query-each r> { } like ; inline

View File

@ -14,7 +14,7 @@ GENERIC: where ( specs obj -- )
: query-make ( class quot -- ) : query-make ( class quot -- )
>r sql-props r> >r sql-props r>
[ 0 sql-counter rot with-variable ] { "" { } { } } nmake [ 0 sql-counter rot with-variable ] curry { "" { } { } } nmake
<simple-statement> maybe-make-retryable ; inline <simple-statement> maybe-make-retryable ; inline
M: db begin-transaction ( -- ) "BEGIN" sql-command ; M: db begin-transaction ( -- ) "BEGIN" sql-command ;

View File

@ -28,6 +28,7 @@ DEFER: process-template
[ drop name-url chloe-ns = not ] assoc-filter ; [ drop name-url chloe-ns = not ] assoc-filter ;
: chloe-tag? ( tag -- ? ) : chloe-tag? ( tag -- ? )
dup xml? [ body>> ] when
{ {
{ [ dup tag? not ] [ f ] } { [ dup tag? not ] [ f ] }
{ [ dup url>> chloe-ns = not ] [ f ] } { [ dup url>> chloe-ns = not ] [ f ] }
@ -112,12 +113,12 @@ CHLOE-TUPLE: checkbox
CHLOE-TUPLE: code CHLOE-TUPLE: code
: process-chloe-tag ( tag -- ) : process-chloe-tag ( tag -- )
dup name-tag dup tags get at dup main>> dup tags get at
[ call ] [ "Unknown chloe tag: " prepend throw ] ?if ; [ call ] [ "Unknown chloe tag: " prepend throw ] ?if ;
: process-tag ( tag -- ) : process-tag ( tag -- )
{ {
[ name-tag >lower tag-stack get push ] [ main>> >lower tag-stack get push ]
[ write-start-tag ] [ write-start-tag ]
[ process-tag-children ] [ process-tag-children ]
[ write-end-tag ] [ write-end-tag ]
@ -125,7 +126,7 @@ CHLOE-TUPLE: code
} cleave ; } cleave ;
: expand-attrs ( tag -- tag ) : expand-attrs ( tag -- tag )
dup [ tag? ] is? [ dup [ tag? ] [ xml? ] bi or [
clone [ clone [
[ "@" ?head [ value present ] when ] assoc-map [ "@" ?head [ value present ] when ] assoc-map
] change-attrs ] change-attrs
@ -134,8 +135,8 @@ CHLOE-TUPLE: code
: process-template ( xml -- ) : process-template ( xml -- )
expand-attrs expand-attrs
{ {
{ [ dup [ chloe-tag? ] is? ] [ process-chloe-tag ] } { [ dup chloe-tag? ] [ process-chloe-tag ] }
{ [ dup [ tag? ] is? ] [ process-tag ] } { [ dup [ tag? ] [ xml? ] bi or ] [ process-tag ] }
{ [ t ] [ write-item ] } { [ t ] [ write-item ] }
} cond ; } cond ;

View File

@ -1,6 +1,8 @@
IN: namespaces.lib.tests IN: namespaces.lib.tests
USING: namespaces.lib tools.test ; USING: namespaces.lib kernel tools.test ;
[ ] [ [ ] { } nmake ] unit-test [ ] [ [ ] { } nmake ] unit-test
[ { 1 } { 2 } ] [ [ 1 0, 2 1, ] { { } { } } nmake ] unit-test [ { 1 } { 2 } ] [ [ 1 0, 2 1, ] { { } { } } nmake ] unit-test
[ [ ] [ call ] curry { { } } nmake ] must-infer

View File

@ -1,8 +1,6 @@
! USING: kernel quotations namespaces sequences assocs.lib ;
USING: kernel namespaces namespaces.private quotations sequences USING: kernel namespaces namespaces.private quotations sequences
assocs.lib math.parser math generalizations locals mirrors ; assocs.lib math.parser math generalizations locals mirrors
macros ;
IN: namespaces.lib IN: namespaces.lib
@ -42,9 +40,10 @@ SYMBOL: building-seq
: 4% ( seq -- ) 4 n% ; : 4% ( seq -- ) 4 n% ;
: 4# ( num -- ) 4 n# ; : 4# ( num -- ) 4 n# ;
MACRO:: nmake ( quot exemplars -- ) MACRO: finish-nmake ( exemplars -- )
[let | n [ exemplars length ] | length [ firstn ] curry ;
[
:: nmake ( quot exemplars -- )
[ [
exemplars exemplars
[ 0 swap new-resizable ] map [ 0 swap new-resizable ] map
@ -53,11 +52,8 @@ MACRO:: nmake ( quot exemplars -- )
quot call quot call
building-seq get building-seq get
exemplars [ like ] 2map exemplars [ [ like ] 2map ] [ finish-nmake ] bi
n firstn ] with-scope ; inline
] with-scope
]
] ;
: make-object ( quot class -- object ) : make-object ( quot class -- object )
new [ <mirror> swap bind ] keep ; inline new [ <mirror> swap bind ] keep ; inline

View File

@ -1,4 +1,4 @@
USING: xmode.tokens xmode.rules xmode.keyword-map xml.data USING: accessors xmode.tokens xmode.rules xmode.keyword-map xml.data
xml.utilities xml assocs kernel combinators sequences xml.utilities xml assocs kernel combinators sequences
math.parser namespaces parser lexer xmode.utilities regexp io.files ; math.parser namespaces parser lexer xmode.utilities regexp io.files ;
IN: xmode.loader.syntax IN: xmode.loader.syntax
@ -7,7 +7,7 @@ SYMBOL: ignore-case?
! Rule tag parsing utilities ! Rule tag parsing utilities
: (parse-rule-tag) ( rule-set tag specs class -- ) : (parse-rule-tag) ( rule-set tag specs class -- )
construct-rule swap init-from-tag swap add-rule ; inline new swap init-from-tag swap add-rule ; inline
: RULE: : RULE:
scan scan-word scan scan-word
@ -98,4 +98,4 @@ TAGS>
: init-eol-span-tag ( -- ) [ drop init-eol-span ] , ; : init-eol-span-tag ( -- ) [ drop init-eol-span ] , ;
: parse-keyword-tag ( tag keyword-map -- ) : parse-keyword-tag ( tag keyword-map -- )
>r dup name-tag string>token swap children>string r> set-at ; >r dup main>> string>token swap children>string r> set-at ;

View File

@ -1,4 +1,4 @@
USING: kernel ; USING: accessors kernel ;
IN: xmode.marker.context IN: xmode.marker.context
! Based on org.gjt.sp.jedit.syntax.TokenMarker.LineContext ! Based on org.gjt.sp.jedit.syntax.TokenMarker.LineContext
@ -11,10 +11,9 @@ end
: <line-context> ( ruleset parent -- line-context ) : <line-context> ( ruleset parent -- line-context )
over [ "no context" throw ] unless over [ "no context" throw ] unless
{ set-line-context-in-rule-set set-line-context-parent } line-context new
line-context construct ; swap >>parent
swap >>in-rule-set ;
M: line-context clone M: line-context clone
(clone) call-next-method [ clone ] change-parent ;
dup line-context-parent clone
over set-line-context-parent ;

View File

@ -66,14 +66,11 @@ delegate
chars chars
; ;
: construct-rule ( class -- rule ) TUPLE: seq-rule < rule ;
>r rule new r> construct-delegate ; inline
TUPLE: seq-rule ; TUPLE: span-rule < rule ;
TUPLE: span-rule ; TUPLE: eol-span-rule < rule ;
TUPLE: eol-span-rule ;
: init-span ( rule -- ) : init-span ( rule -- )
dup rule-delegate [ drop ] [ dup rule-delegate [ drop ] [
@ -85,16 +82,15 @@ TUPLE: eol-span-rule ;
dup init-span dup init-span
t swap set-rule-no-line-break? ; t swap set-rule-no-line-break? ;
TUPLE: mark-following-rule ; TUPLE: mark-following-rule < rule ;
TUPLE: mark-previous-rule ; TUPLE: mark-previous-rule < rule ;
TUPLE: escape-rule ; TUPLE: escape-rule < rule ;
: <escape-rule> ( string -- rule ) : <escape-rule> ( string -- rule )
f <string-matcher> f f f <matcher> f <string-matcher> f f f <matcher>
escape-rule construct-rule escape-rule new swap >>start ;
[ set-rule-start ] keep ;
GENERIC: text-hash-char ( text -- ch ) GENERIC: text-hash-char ( text -- ch )

View File

@ -1,7 +1,7 @@
IN: xmode.utilities.tests IN: xmode.utilities.tests
USING: xmode.utilities tools.test xml xml.data kernel strings USING: accessors xmode.utilities tools.test xml xml.data kernel
vectors sequences io.files prettyprint assocs unicode.case ; strings vectors sequences io.files prettyprint assocs
unicode.case ;
[ "hi" 3 ] [ [ "hi" 3 ] [
{ 1 2 3 4 5 6 7 8 } [ H{ { 3 "hi" } } at ] map-find { 1 2 3 4 5 6 7 8 } [ H{ { 3 "hi" } } at ] map-find
] unit-test ] unit-test
@ -35,7 +35,7 @@ TAGS>
{ { "type" >upper set-company-type } } { { "type" >upper set-company-type } }
init-from-tag dup init-from-tag dup
] keep ] keep
tag-children [ tag? ] filter children>> [ tag? ] filter
[ parse-employee-tag ] with each ; [ parse-employee-tag ] with each ;
[ [

View File

@ -1,10 +1,10 @@
USING: sequences assocs kernel quotations namespaces xml.data USING: accessors sequences assocs kernel quotations namespaces
xml.utilities combinators macros parser lexer words ; xml.data xml.utilities combinators macros parser lexer words ;
IN: xmode.utilities IN: xmode.utilities
: implies >r not r> or ; inline : implies >r not r> or ; inline
: child-tags ( tag -- seq ) tag-children [ tag? ] filter ; : child-tags ( tag -- seq ) children>> [ tag? ] filter ;
: map-find ( seq quot -- result elt ) : map-find ( seq quot -- result elt )
f -rot f -rot
@ -53,5 +53,5 @@ SYMBOL: tag-handler-word
: TAGS> : TAGS>
tag-handler-word get tag-handler-word get
tag-handlers get >alist [ >r dup name-tag r> case ] curry tag-handlers get >alist [ >r dup main>> r> case ] curry
define ; parsing define ; parsing