libs: fix syntax.

locals-and-roots
Doug Coleman 2016-06-06 17:16:55 -07:00
parent d54ac497c6
commit b24a1c352d
34 changed files with 95 additions and 90 deletions

View File

@ -6,6 +6,6 @@ in: calendar.holidays.canada
SINGLETONS: canada canadian-federal ; SINGLETONS: canada canadian-federal ;
HOLIDAY: canadian-thanksgiving-day october 2 monday-of-month ; HOLIDAY: canadian-thanksgiving-day october 2 monday-of-month ;
HOLIDAY-NAME: canadian-thanksgiving-day canadian-federal "Thanksgiving Day" HOLIDAY-NAME: canadian-thanksgiving-day canadian-federal "Thanksgiving Day" ;
HOLIDAY-NAME: armistice-day commonwealth-of-nations "Remembrance Day" HOLIDAY-NAME: armistice-day commonwealth-of-nations "Remembrance Day" ;

View File

@ -7,15 +7,16 @@ in: calendar.holidays
SINGLETONS: all world commonwealth-of-nations ; SINGLETONS: all world commonwealth-of-nations ;
<< <<
SYNTAX: HOLIDAY: SYNTAX: \ HOLIDAY:
scan-new-word scan-new-word
dup "holiday" word-prop [ dup "holiday" word-prop [
dup H{ } clone "holiday" set-word-prop dup H{ } clone "holiday" set-word-prop
] unless ] unless
parse-definition ( timestamp/n -- timestamp ) define-declared ; parse-definition ( timestamp/n -- timestamp ) define-declared ;
SYNTAX: HOLIDAY-NAME: SYNTAX: \ HOLIDAY-NAME:
let[ scan-word "holiday" word-prop :> holidays scan-word :> name scan-object :> value let[ scan-word "holiday" word-prop :> holidays scan-word :> name scan-object :> value
";" expect
value name holidays set-at ] ; value name holidays set-at ] ;
>> >>
@ -53,4 +54,4 @@ M: all holidays
] keep '[ _ swap "holiday" word-prop at ] map ; ] keep '[ _ swap "holiday" word-prop at ] map ;
HOLIDAY: armistice-day november 11 >>day ; HOLIDAY: armistice-day november 11 >>day ;
HOLIDAY-NAME: armistice-day world "Armistice Day" HOLIDAY-NAME: armistice-day world "Armistice Day" ;

View File

@ -27,38 +27,38 @@ M: us-federal holidays
{ [ sunday? not ] [ us-federal holiday? not ] } 1&& ; { [ sunday? not ] [ us-federal holiday? not ] } 1&& ;
HOLIDAY: new-years-day january 1 >>day ; HOLIDAY: new-years-day january 1 >>day ;
HOLIDAY-NAME: new-years-day world "New Year's Day" HOLIDAY-NAME: new-years-day world "New Year's Day" ;
HOLIDAY-NAME: new-years-day us-federal "New Year's Day" HOLIDAY-NAME: new-years-day us-federal "New Year's Day" ;
HOLIDAY: martin-luther-king-day january 3 monday-of-month ; HOLIDAY: martin-luther-king-day january 3 monday-of-month ;
HOLIDAY-NAME: martin-luther-king-day us-federal "Martin Luther King Day" HOLIDAY-NAME: martin-luther-king-day us-federal "Martin Luther King Day" ;
HOLIDAY: inauguration-day january 20 >>day [ dup 4 neg rem + ] change-year ; HOLIDAY: inauguration-day january 20 >>day [ dup 4 neg rem + ] change-year ;
HOLIDAY-NAME: inauguration-day us "Inauguration Day" HOLIDAY-NAME: inauguration-day us "Inauguration Day" ;
HOLIDAY: washingtons-birthday february 3 monday-of-month ; HOLIDAY: washingtons-birthday february 3 monday-of-month ;
HOLIDAY-NAME: washingtons-birthday us-federal "Washington's Birthday" HOLIDAY-NAME: washingtons-birthday us-federal "Washington's Birthday" ;
HOLIDAY: memorial-day may last-monday-of-month ; HOLIDAY: memorial-day may last-monday-of-month ;
HOLIDAY-NAME: memorial-day us-federal "Memorial Day" HOLIDAY-NAME: memorial-day us-federal "Memorial Day" ;
HOLIDAY: independence-day july 4 >>day ; HOLIDAY: independence-day july 4 >>day ;
HOLIDAY-NAME: independence-day us-federal "Independence Day" HOLIDAY-NAME: independence-day us-federal "Independence Day" ;
HOLIDAY: labor-day september 1 monday-of-month ; HOLIDAY: labor-day september 1 monday-of-month ;
HOLIDAY-NAME: labor-day us-federal "Labor Day" HOLIDAY-NAME: labor-day us-federal "Labor Day" ;
HOLIDAY: columbus-day october 2 monday-of-month ; HOLIDAY: columbus-day october 2 monday-of-month ;
HOLIDAY-NAME: columbus-day us-federal "Columbus Day" HOLIDAY-NAME: columbus-day us-federal "Columbus Day" ;
HOLIDAY-NAME: armistice-day us-federal "Veterans Day" HOLIDAY-NAME: armistice-day us-federal "Veterans Day" ;
HOLIDAY: thanksgiving-day november 4 thursday-of-month ; HOLIDAY: thanksgiving-day november 4 thursday-of-month ;
HOLIDAY-NAME: thanksgiving-day us-federal "Thanksgiving Day" HOLIDAY-NAME: thanksgiving-day us-federal "Thanksgiving Day" ;
HOLIDAY: christmas-day december 25 >>day ; HOLIDAY: christmas-day december 25 >>day ;
HOLIDAY-NAME: christmas-day world "Christmas Day" HOLIDAY-NAME: christmas-day world "Christmas Day" ;
HOLIDAY-NAME: christmas-day us-federal "Christmas Day" HOLIDAY-NAME: christmas-day us-federal "Christmas Day" ;
HOLIDAY: belly-laugh-day january 24 >>day ; HOLIDAY: belly-laugh-day january 24 >>day ;

View File

@ -31,5 +31,4 @@ ERROR: no-such-color name ;
: named-color ( name -- color ) : named-color ( name -- color )
dup colors at [ ] [ no-such-color ] ?if ; dup colors at [ ] [ no-such-color ] ?if ;
SYNTAX: COLOR: scan-token named-color suffix! ; SYNTAX: \ color: scan-token named-color suffix! ;
SYNTAX: color: scan-token named-color suffix! ;

View File

@ -13,5 +13,4 @@ in: colors.hex
[ red>> ] [ green>> ] [ blue>> ] tri [ red>> ] [ green>> ] [ blue>> ] tri
[ 255 * >integer ] tri@ "%02X%02X%02X" sprintf ; [ 255 * >integer ] tri@ "%02X%02X%02X" sprintf ;
SYNTAX: HEXCOLOR: scan-token hex>rgba suffix! ; SYNTAX: \ hexcolor: scan-token hex>rgba suffix! ;
SYNTAX: hexcolor: scan-token hex>rgba suffix! ;

View File

@ -27,7 +27,7 @@ symbol: current-macro
MACRO:: log-euler-op ( class def inputs -- quot ) MACRO:: log-euler-op ( class def inputs -- quot )
class inputs def inputs '[ [ current-macro get [ _ boa save-euler-op ] [ _ ndrop ] if ] _ _ nbi ] ; class inputs def inputs '[ [ current-macro get [ _ boa save-euler-op ] [ _ ndrop ] if ] _ _ nbi ] ;
SYNTAX: LOG-GML: SYNTAX: \ LOG-GML:
let[ let[
(GML:) :> ( word name effect def ) (GML:) :> ( word name effect def )

View File

@ -37,9 +37,9 @@ FROM: kernel.private => declare ;
scan-word \ (exec) create-method-in scan-word \ (exec) create-method-in
swap call( -- quot ) [ is-gml ] prepend ; swap call( -- quot ) [ is-gml ] prepend ;
SYNTAX: EXEC: [ parse-definition ] (EXEC:) define ; SYNTAX: \ EXEC: [ parse-definition ] (EXEC:) define ;
SYNTAX: EXEC:: [ [ parse-definition ] parse-locals-definition drop ] (EXEC:) define ; SYNTAX: \ EXEC:: [ [ parse-definition ] parse-locals-definition drop ] (EXEC:) define ;
>> >>
@ -53,7 +53,7 @@ TUPLE: exec-name < identity-tuple name ;
MEMO: exec-name ( string -- name ) name \ exec-name boa ; MEMO: exec-name ( string -- name ) name \ exec-name boa ;
SYNTAX: exec" lexer get skip-blank parse-string exec-name suffix! ; SYNTAX: \ exec" lexer get skip-blank parse-string exec-name suffix! ;
ERROR: unbound-name { name name } ; ERROR: unbound-name { name name } ;
@ -185,10 +185,10 @@ global-dictionary [ H{ } clone ] initialize
: (GML:) ( -- word name effect def ) : (GML:) ( -- word name effect def )
scan-gml-name scan-effect parse-definition ; scan-gml-name scan-effect parse-definition ;
SYNTAX: GML: SYNTAX: \ GML:
(GML:) define-gml-primitive ; (GML:) define-gml-primitive ;
SYNTAX: GML:: SYNTAX: \ GML::
let[ let[
scan-gml-name :> ( word name ) scan-gml-name :> ( word name )
word [ parse-definition ] parse-locals-definition :> ( word def effect ) word [ parse-definition ] parse-locals-definition :> ( word def effect )

View File

@ -13,7 +13,7 @@ tags [ H{ } clone ] initialize
: define-chloe-tag ( name quot -- ) swap tags get set-at ; : define-chloe-tag ( name quot -- ) swap tags get set-at ;
SYNTAX: CHLOE: SYNTAX: \ CHLOE:
scan-token parse-definition define-chloe-tag ; scan-token parse-definition define-chloe-tag ;
CONSTANT: chloe-ns "http://factorcode.org/chloe/1.0" ; CONSTANT: chloe-ns "http://factorcode.org/chloe/1.0" ;
@ -21,7 +21,7 @@ CONSTANT: chloe-ns "http://factorcode.org/chloe/1.0" ;
: chloe-name? ( name -- ? ) : chloe-name? ( name -- ? )
url>> chloe-ns = ; url>> chloe-ns = ;
XML-NS: chloe-name http://factorcode.org/chloe/1.0 XML-NS: chloe-name http://factorcode.org/chloe/1.0 ;
: required-attr ( tag name -- value ) : required-attr ( tag name -- value )
[ nip ] [ chloe-name attr ] 2bi [ nip ] [ chloe-name attr ] 2bi

View File

@ -81,7 +81,7 @@ M: irc-message set-irc-command
[ prefix>> ] [ prefix>> ]
[ command>> ] [ command>> ]
[ parameters>> " " join ] [ parameters>> " " join ]
[ trailing>> dup [ char: : prefix ] when ] [ trailing>> dup [ char: \ : prefix ] when ]
} cleave 4array sift " " join ; } cleave 4array sift " " join ;
<PRIVATE <PRIVATE
@ -109,7 +109,7 @@ PRIVATE>
! SYNTAX: name string parameters ; ! SYNTAX: name string parameters ;
! IRC: type "COMMAND" slot1 ...; ! IRC: type "COMMAND" slot1 ...;
! IRC: type "COMMAND" slot1 ... : trailing-slot; ! IRC: type "COMMAND" slot1 ... : trailing-slot;
SYNTAX: IRC: SYNTAX: \ IRC:
scan-new-class scan-new-class
[ scan-object register-irc-message-type ] keep [ scan-object register-irc-message-type ] keep
";" parse-tokens ";" parse-tokens

View File

@ -137,7 +137,7 @@ PRIVATE>
[ [ input-logging-quot ] 2keep drop error-logging-quot ] [ [ input-logging-quot ] 2keep drop error-logging-quot ]
(define-logging) ; (define-logging) ;
SYNTAX: LOG: SYNTAX: \ LOG:
! Syntax: name level ! Syntax: name level
scan-new-word dup scan-word ";" expect scan-new-word dup scan-word ";" expect
'[ 1array stack>message _ _ log-message ] '[ 1array stack>message _ _ log-message ]

View File

@ -291,7 +291,7 @@ M: MATRIX n*V(*)V+M!
M: MATRIX n*V(*)Vconj+M! M: MATRIX n*V(*)Vconj+M!
(prepare-ger) [ XGERC ] dip ; (prepare-ger) [ XGERC ] dip ;
SYNTAX: XMATRIX{ \ } [ >MATRIX ] parse-literal ; SYNTAX: \ XMATRIX{ \ } [ >MATRIX ] parse-literal ;
M: MATRIX pprint-delims M: MATRIX pprint-delims
drop \ XMATRIX{ \ } ; drop \ XMATRIX{ \ } ;

View File

@ -179,7 +179,7 @@ M: VECTOR n*V+V!
M: VECTOR n*V! M: VECTOR n*V!
(prepare-scal) [ XSCAL ] dip ; (prepare-scal) [ XSCAL ] dip ;
SYNTAX: XVECTOR{ \ } [ >VECTOR ] parse-literal ; SYNTAX: \ XVECTOR{ \ } [ >VECTOR ] parse-literal ;
M: VECTOR pprint-delims M: VECTOR pprint-delims
drop \ XVECTOR{ \ } ; drop \ XVECTOR{ \ } ;

View File

@ -40,7 +40,7 @@ ERROR: malformed-complex obj ;
: parse-complex ( seq -- complex ) : parse-complex ( seq -- complex )
dup length 2 = [ first2-unsafe rect> ] [ malformed-complex ] if ; dup length 2 = [ first2-unsafe rect> ] [ malformed-complex ] if ;
SYNTAX: C{ \ } [ parse-complex ] parse-literal ; SYNTAX: \ C{ \ } [ parse-complex ] parse-literal ;
use: prettyprint.custom use: prettyprint.custom

View File

@ -4,6 +4,6 @@ USING: accessors effects kernel lexer math.ranges parser
sequences words ; sequences words ;
in: math.derivatives.syntax in: math.derivatives.syntax
SYNTAX: DERIVATIVE: scan-object dup stack-effect in>> length [1,b] SYNTAX: \ DERIVATIVE: scan-object dup stack-effect in>> length [1,b]
[ drop scan-object ] map ";" expect [ drop scan-object ] map ";" expect
"derivative" set-word-prop ; "derivative" set-word-prop ;

View File

@ -8,7 +8,7 @@ TUPLE: rect { loc initial: { 0 0 } } { dim initial: { 0 0 } } ;
: <rect> ( loc dim -- rect ) rect boa ; inline : <rect> ( loc dim -- rect ) rect boa ; inline
SYNTAX: RECT: scan-object scan-object <rect> suffix! ; SYNTAX: \ RECT: scan-object scan-object <rect> suffix! ;
: <zero-rect> ( -- rect ) rect new ; inline : <zero-rect> ( -- rect ) rect new ; inline

View File

@ -54,7 +54,7 @@ M: A >pprint-sequence ;
M: A pprint* pprint-object ; M: A pprint* pprint-object ;
M: A pprint-delims drop \ A{ \ } ; M: A pprint-delims drop \ A{ \ } ;
SYNTAX: A{ \ } [ >A ] parse-literal ; SYNTAX: \ A{ \ } [ >A ] parse-literal ;
<c-type> <c-type>
byte-array >>class byte-array >>class
@ -78,20 +78,20 @@ FUNCTOR;
[ define-specialized-cord ] [ define-specialized-cord ]
[ create-word-in (define-simd-128-cord) ] 2bi ; [ create-word-in (define-simd-128-cord) ] 2bi ;
SYNTAX: SIMD-128-CORD: SYNTAX: \ SIMD-128-CORD:
scan-word scan-token define-simd-128-cord ; scan-word scan-token ";" expect define-simd-128-cord ;
PRIVATE> PRIVATE>
>> >>
SIMD-128-CORD: char-16 char-32 SIMD-128-CORD: char-16 char-32 ;
SIMD-128-CORD: uchar-16 uchar-32 SIMD-128-CORD: uchar-16 uchar-32 ;
SIMD-128-CORD: short-8 short-16 SIMD-128-CORD: short-8 short-16 ;
SIMD-128-CORD: ushort-8 ushort-16 SIMD-128-CORD: ushort-8 ushort-16 ;
SIMD-128-CORD: int-4 int-8 SIMD-128-CORD: int-4 int-8 ;
SIMD-128-CORD: uint-4 uint-8 SIMD-128-CORD: uint-4 uint-8 ;
SIMD-128-CORD: longlong-2 longlong-4 SIMD-128-CORD: longlong-2 longlong-4 ;
SIMD-128-CORD: ulonglong-2 ulonglong-4 SIMD-128-CORD: ulonglong-2 ulonglong-4 ;
SIMD-128-CORD: float-4 float-8 SIMD-128-CORD: float-4 float-8 ;
SIMD-128-CORD: double-2 double-4 SIMD-128-CORD: double-2 double-4 ;

View File

@ -312,7 +312,7 @@ M: A length drop N ; inline
BOA-EFFECT define-inline BOA-EFFECT define-inline
M: A pprint-delims drop \ A{ \ } ; M: A pprint-delims drop \ A{ \ } ;
SYNTAX: A{ \ } [ >A ] parse-literal ; SYNTAX: \ A{ \ } [ >A ] parse-literal ;
INSTANCE: A sequence ; INSTANCE: A sequence ;

View File

@ -225,5 +225,5 @@ ERROR: bad-suit-symbol ch ;
: string>hand-name ( string -- string' ) : string>hand-name ( string -- string' )
string>value value>hand-name ; string>value value>hand-name ;
SYNTAX: HAND{ SYNTAX: \ HAND{
"}" [ card> ] map-tokens suffix! ; "}" [ card> ] map-tokens suffix! ;

View File

@ -2,4 +2,4 @@
USING: lexer sequences parser ; USING: lexer sequences parser ;
in: qw in: qw
SYNTAX: qw{ "}" parse-tokens suffix! ; SYNTAX: \ qw{ "}" parse-tokens suffix! ;

View File

@ -64,5 +64,5 @@ PREDICATE: role < mixin-class
[ roles>slots define-tuple-class ] [ roles>slots define-tuple-class ]
[ drop [ role? ] filter add-to-roles ] 3tri ; [ drop [ role? ] filter add-to-roles ] 3tri ;
SYNTAX: ROLE: parse-role-definition define-role ; SYNTAX: \ ROLE: parse-role-definition define-role ;
SYNTAX: ROLE-TUPLE: parse-role-definition define-tuple-class-with-roles ; SYNTAX: \ ROLE-TUPLE: parse-role-definition define-tuple-class-with-roles ;

View File

@ -92,11 +92,11 @@ HELP: roman/mod
{ roman* roman/i roman/mod } related-words { roman* roman/i roman/mod } related-words
HELP: ROMAN: HELP: \ roman:
{ $description "A parsing word that reads the next token and converts it to an integer." } { $description "A parsing word that reads the next token and converts it to an integer." }
{ $examples { $examples
{ $example "USING: prettyprint roman ;" { $example "USING: prettyprint roman ;"
"ROMAN: v ." "roman: v ."
"5" "5"
} }
} ; } ;
@ -104,7 +104,7 @@ HELP: ROMAN:
ARTICLE: "roman" "Roman numerals" ARTICLE: "roman" "Roman numerals"
"The " { $vocab-link "roman" } " vocabulary can convert numbers to and from the Roman numeral system and can perform arithmetic given Roman numerals as input." $nl "The " { $vocab-link "roman" } " vocabulary can convert numbers to and from the Roman numeral system and can perform arithmetic given Roman numerals as input." $nl
"A parsing word for literal Roman numerals:" "A parsing word for literal Roman numerals:"
{ $subsections postpone\ ROMAN: } { $subsections \ roman: }
"Converting to Roman numerals:" "Converting to Roman numerals:"
{ $subsections { $subsections
>roman >roman

View File

@ -37,7 +37,7 @@ USING: arrays kernel math roman roman.private sequences tools.test ;
{ "i" "ii" } [ "v" "iii" roman/mod ] unit-test { "i" "ii" } [ "v" "iii" roman/mod ] unit-test
[ "iii" "iii" roman- ] must-fail [ "iii" "iii" roman- ] must-fail
{ 30 } [ ROMAN: xxx ] unit-test { 30 } [ roman: xxx ] unit-test
[ roman+ ] must-infer [ roman+ ] must-infer
[ roman- ] must-infer [ roman- ] must-infer

View File

@ -56,17 +56,17 @@ PRIVATE>
<< <<
SYNTAX: ROMAN-OP: SYNTAX: \ ROMAN-OP:
scan-word [ name>> "roman" prepend create-word-in ] keep scan-word [ name>> "roman" prepend create-word-in ] keep
1quotation '[ _ binary-roman-op ] 1quotation '[ _ binary-roman-op ]
scan-effect define-declared ; scan-effect ";" expect define-declared ;
>> >>
ROMAN-OP: + ( x y -- z ) ROMAN-OP: + ( x y -- z ) ;
ROMAN-OP: - ( x y -- z ) ROMAN-OP: - ( x y -- z ) ;
ROMAN-OP: * ( x y -- z ) ROMAN-OP: * ( x y -- z ) ;
ROMAN-OP: /i ( x y -- z ) ROMAN-OP: /i ( x y -- z ) ;
ROMAN-OP: /mod ( x y -- z w ) ROMAN-OP: /mod ( x y -- z w ) ;
SYNTAX: ROMAN: scan-token roman> suffix! ; SYNTAX: \ roman: scan-token roman> suffix! ;

View File

@ -113,7 +113,7 @@ TUPLE: slides < book ;
: strip-tease ( data -- seq ) : strip-tease ( data -- seq )
first3 2 over length [a,b] [ head 3array ] with with with map ; first3 2 over length [a,b] [ head 3array ] with with with map ;
SYNTAX: STRIP-TEASE: SYNTAX: \ STRIP-TEASE:
parse-definition strip-tease append! ; parse-definition strip-tease append! ;
\ slides H{ \ slides H{

View File

@ -4,10 +4,10 @@ math.functions math.parser math.vectors memoize peg.ebnf sequences sequences.squ
splitting strings xml.data xml.syntax ; splitting strings xml.data xml.syntax ;
in: svg in: svg
XML-NS: svg-name http://www.w3.org/2000/svg XML-NS: svg-name http://www.w3.org/2000/svg ;
XML-NS: xlink-name http://www.w3.org/1999/xlink XML-NS: xlink-name http://www.w3.org/1999/xlink ;
XML-NS: sodipodi-name http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd XML-NS: sodipodi-name http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd ;
XML-NS: inkscape-name http://www.inkscape.org/namespaces/inkscape XML-NS: inkscape-name http://www.inkscape.org/namespaces/inkscape ;
: svg-string>number ( string -- number ) : svg-string>number ( string -- number )
H{ { char: E char: e } } substitute "e" split1 H{ { char: E char: e } } substitute "e" split1

View File

@ -29,6 +29,6 @@ SYMBOLS: Cn Lu Ll Lt Lm Lo Mn Mc Me Nd Nl No Pc Pd Ps Pe Pi Pf Po Sm Sc Sk So Zs
PRIVATE> PRIVATE>
SYNTAX: CATEGORY: parse-category define-category ; SYNTAX: \ CATEGORY: parse-category define-category ;
SYNTAX: CATEGORY-NOT: parse-category define-not-category ; SYNTAX: \ CATEGORY-NOT: parse-category define-not-category ;

View File

@ -186,6 +186,6 @@ PRIVATE>
clone dup protocol>> '[ _ protocol-port or ] change-port ; clone dup protocol>> '[ _ protocol-port or ] change-port ;
! Literal syntax ! Literal syntax
SYNTAX: URL" lexer get skip-blank parse-string >url suffix! ; SYNTAX: \ URL" lexer get skip-blank parse-string >url suffix! ;
{ "urls" "prettyprint" } "urls.prettyprint" require-when { "urls" "prettyprint" } "urls.prettyprint" require-when

View File

@ -50,6 +50,6 @@ TUPLE: xkcd number image ;
C: <xkcd> xkcd ; C: <xkcd> xkcd ;
SYNTAX: XKCD: scan-number dup xkcd-image <xkcd> suffix! ; SYNTAX: \ XKCD: scan-number dup xkcd-image <xkcd> suffix! ;
M: xkcd pprint* image>> <image-section> add-section ; M: xkcd pprint* image>> <image-section> add-section ;

View File

@ -25,7 +25,7 @@ PREDICATE: generated-xml-error < tuple class-of "xml-error-class" word-prop ;
] ]
} 3cleave ; } 3cleave ;
SYNTAX: XML-ERROR: SYNTAX: \ XML-ERROR:
parse-tuple-definition pick save-location parse-tuple-definition pick save-location
define-xml-error-class ; define-xml-error-class ;

View File

@ -10,7 +10,7 @@ ARTICLE: "xml.syntax" "Syntax extensions for XML"
{ $subsections { $subsections
{ "xml.syntax" "tags" } { "xml.syntax" "tags" }
{ "xml.syntax" "literals" } { "xml.syntax" "literals" }
postpone\ XML-NS: \ XML-NS:
} ; } ;
ARTICLE: { "xml.syntax" "tags" } "Dispatch on XML tag names" ARTICLE: { "xml.syntax" "tags" } "Dispatch on XML tag names"
@ -104,6 +104,6 @@ let[
XML[[ <a>pple</a> XML]] dispatch write" XML[[ <a>pple</a> XML]] dispatch write"
"apple" } ; "apple" } ;
HELP: XML-NS: HELP: \ XML-NS:
{ $syntax "XML-NS: name http://url" } { $syntax "XML-NS: name http://url ;" }
{ $description "Defines a new word of the given name which constructs XML names in the namespace of the given URL. The names constructed are memoized." } ; { $description "Defines a new word of the given name which constructs XML names in the namespace of the given URL. The names constructed are memoized." } ;

View File

@ -34,7 +34,7 @@ TAG: neg calculate
calc-arith calc-arith
] unit-test ] unit-test
XML-NS: foo http://blah.com XML-NS: foo http://blah.com ;
{ T{ name { main "bling" } { url "http://blah.com" } } } [ "bling" foo ] unit-test { T{ name { main "bling" } { url "http://blah.com" } } } [ "bling" foo ] unit-test

View File

@ -27,17 +27,17 @@ M: no-tag summary
PRIVATE> PRIVATE>
SYNTAX: TAGS: SYNTAX: \ TAGS:
scan-new-word scan-effect ";" expect scan-new-word scan-effect ";" expect
[ drop H{ } clone "xtable" set-word-prop ] [ drop H{ } clone "xtable" set-word-prop ]
[ define-tags ] [ define-tags ]
2bi ; 2bi ;
SYNTAX: TAG: SYNTAX: \ TAG:
scan-token scan-word parse-definition define-tag ; scan-token scan-word parse-definition define-tag ;
SYNTAX: XML-NS: SYNTAX: \ XML-NS:
scan-new-word scan-token '[ f swap _ <name> ] ( string -- name ) define-memoized ; scan-new-word scan-token ";" expect '[ f swap _ <name> ] ( string -- name ) define-memoized ;
<PRIVATE <PRIVATE
@ -170,10 +170,10 @@ MACRO: interpolate-xml ( xml -- quot )
PRIVATE> PRIVATE>
SYNTAX: <XML SYNTAX: \ <XML
"XML>" [ string>doc ] parse-def ; "XML>" [ string>doc ] parse-def ;
SYNTAX: XML[[ SYNTAX: \ XML[[
"XML]]" [ string>chunk ] parse-def ; "XML]]" [ string>chunk ] parse-def ;
use: vocabs.loader use: vocabs.loader

View File

@ -10,7 +10,7 @@ in: xmode.loader.syntax
: (parse-rule-tag) ( rule-set tag specs class -- ) : (parse-rule-tag) ( rule-set tag specs class -- )
new swap init-from-tag swap add-rule ; inline new swap init-from-tag swap add-rule ; inline
SYNTAX: RULE: SYNTAX: \ RULE:
scan-token scan-word scan-word [ scan-token scan-word scan-word [
[ parse-definition call( -- ) ] { } make [ parse-definition call( -- ) ] { } make
swap [ (parse-rule-tag) ] 2curry swap [ (parse-rule-tag) ] 2curry

View File

@ -17,10 +17,16 @@
[ dup <vocab-link> . flush vocab>literals ] map-zip [ dup <vocab-link> . flush vocab>literals ] map-zip
"resource:libs" vocabs-from "resource:libs" vocabs-from
{ { "brainfuck" "metar" "svg"
"gml.parser" "infix.tokenizer"
"math.blas.matrices" "math.blas.vectors"
"math.vectors.simd" "math.vectors.simd.cords"
"peg.pl0" "peg.javascript.parser" "peg.javascript.tokenizer"
"yaml.conversion"
} diff } diff
[ dup <vocab-link> . flush vocab>literals ] map-zip [ dup <vocab-link> . flush vocab>literals ] map-zip
"resource:frameworks" vocabs-from "resource:frameworks" vocabs-from
{ "ui.theme.switching" "ui.backend.cocoa.views" "ui.backend.cocoa.tools" { "ui.theme.switching" "ui.backend.cocoa.views" "ui.backend.cocoa.tools"
"ui.backend.gtk" "ui.backend.cocoa" "gpu.demos.raytrace" "gpu.demos.bunny" "ui.backend.gtk" "ui.backend.cocoa" "gpu.demos.raytrace" "gpu.demos.bunny"