basis/,extra/: using parse-array-def in a bunch of places

char-rename
Björn Lindqvist 2016-12-03 13:16:08 +01:00
parent 1c53e43768
commit 0142d0b078
7 changed files with 19 additions and 9 deletions

View File

@ -7,14 +7,14 @@ IN: help.syntax
SYNTAX: HELP:
scan-word bootstrap-word
[ >link save-location ]
[ [ \ ; parse-until >array ] dip set-word-help ]
[ [ parse-array-def ] dip set-word-help ]
bi ;
ERROR: article-expects-name-and-title got ;
SYNTAX: ARTICLE:
location [
\ ; parse-until >array
parse-array-def
dup length 2 < [ article-expects-name-and-title ] when
[ first2 ] [ 2 tail ] bi <article>
over add-article >link

View File

@ -30,7 +30,12 @@ TIP: "Use the " { $link leaks. } " combinator to track down resource leaks." ;
HELP: TIP:
{ $syntax "TIP: content ;" }
{ $values { "content" "a markup element" } }
{ $description "Defines a new tip of the day." } ;
{ $description "Defines a new tip of the day." }
{ $examples
{ $unchecked-example
"TIP: \"Factor is a fun programming language.\" ;"
}
} ;
ARTICLE: "all-tips-of-the-day" "All tips of the day"
{ $tips-of-the-day } ;

View File

@ -22,7 +22,7 @@ M: tip set-where loc<< ;
: add-tip ( tip -- ) tips get push ;
SYNTAX: TIP:
parse-definition >array <tip>
parse-array-def <tip>
[ save-location ] [ add-tip ] bi ;
: a-tip ( -- tip ) tips get random ;

View File

@ -105,6 +105,11 @@ M: a-union test-generic ;
{ f } [ "fast-union-2?" "classes.union.tests" lookup-word def>> \ fixnum-bitand swap member? ] unit-test
{ { fixnum } } [
"IN: classes.union.tests USE: math UNION: um fixnum ;" eval( -- )
"um" "classes.union.tests" lookup-word "members" word-prop
] unit-test
! Test union{
TUPLE: stuff { a union{ integer string } } ;

View File

@ -180,11 +180,11 @@ IN: bootstrap.syntax
] define-core-syntax
"UNION:" [
scan-new-class parse-definition define-union-class
scan-new-class parse-array-def define-union-class
] define-core-syntax
"INTERSECTION:" [
scan-new-class parse-definition define-intersection-class
scan-new-class parse-array-def define-intersection-class
] define-core-syntax
"MIXIN:" [

View File

@ -505,10 +505,10 @@ DEFER: [bind-uniform-tuple]
: parse-uniform-tuple-definition ( -- class superclass uniforms )
scan-new-class scan-token {
{ ";" [ uniform-tuple f ] }
{ "<" [ scan-word parse-definition [ first3 uniform boa ] map ] }
{ "<" [ scan-word parse-array-def [ first3 uniform boa ] map ] }
{ "{" [
uniform-tuple
\ } parse-until parse-definition swap prefix
\ } parse-until parse-array-def swap prefix
[ first3 uniform boa ] map
] }
} case ;

View File

@ -614,7 +614,7 @@ SYNTAX: GLSL-PROGRAM:
dup old-instances [
f
lexer get line>>
\ ; parse-until >array shaders-and-formats
parse-array-def shaders-and-formats
] dip
program boa
over reset-generic