Fixing libraries for stack checker changes
parent
a252844e3e
commit
bcaade8005
Binary file not shown.
|
@ -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
|
||||||
|
|
|
@ -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 ;
|
||||||
|
|
|
@ -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 ;
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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,22 +40,20 @@ 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 ;
|
||||||
[
|
|
||||||
[
|
|
||||||
exemplars
|
|
||||||
[ 0 swap new-resizable ] map
|
|
||||||
building-seq set
|
|
||||||
|
|
||||||
quot call
|
:: nmake ( quot exemplars -- )
|
||||||
|
[
|
||||||
|
exemplars
|
||||||
|
[ 0 swap new-resizable ] map
|
||||||
|
building-seq set
|
||||||
|
|
||||||
building-seq get
|
quot call
|
||||||
exemplars [ like ] 2map
|
|
||||||
n firstn
|
building-seq get
|
||||||
] with-scope
|
exemplars [ [ like ] 2map ] [ finish-nmake ] bi
|
||||||
]
|
] with-scope ; inline
|
||||||
] ;
|
|
||||||
|
|
||||||
: make-object ( quot class -- object )
|
: make-object ( quot class -- object )
|
||||||
new [ <mirror> swap bind ] keep ; inline
|
new [ <mirror> swap bind ] keep ; inline
|
||||||
|
|
|
@ -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 ;
|
||||||
|
|
|
@ -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 ;
|
|
||||||
|
|
|
@ -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 )
|
||||||
|
|
||||||
|
|
|
@ -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 ;
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue