Merge git://spitspat.com/git/factor

release
Doug Coleman 2007-12-03 23:05:28 -06:00
commit 9718387289
3 changed files with 32 additions and 11 deletions

View File

@ -149,9 +149,3 @@ IN: scratchpad
{ { } } [ { { } } [
"234" "1" token <+> parse list>array "234" "1" token <+> parse list>array
] unit-test ] unit-test
[ "a" "a" token <!> parse-1 ] unit-test-fails
[ t ] [ "b" "a" token <!> parse-1 >boolean ] unit-test
[ t ] [ "b" "ab" token <!> parse-1 >boolean ] unit-test

View File

@ -2,6 +2,7 @@ USING: arrays combinators kernel lazy-lists math math.parser
namespaces parser parser-combinators parser-combinators.simple namespaces parser parser-combinators parser-combinators.simple
promises quotations sequences combinators.lib strings macros promises quotations sequences combinators.lib strings macros
assocs prettyprint.backend ; assocs prettyprint.backend ;
USE: io
IN: regexp IN: regexp
: or-predicates ( quots -- quot ) : or-predicates ( quots -- quot )
@ -40,7 +41,7 @@ MACRO: fast-member? ( str -- quot )
dup alpha? swap punct? or ; dup alpha? swap punct? or ;
: 'ordinary-char' ( -- parser ) : 'ordinary-char' ( -- parser )
[ "\\^*+?|(){}[" fast-member? not ] satisfy [ "\\^*+?|(){}[$" fast-member? not ] satisfy
[ [ = ] curry ] <@ ; [ [ = ] curry ] <@ ;
: 'octal-digit' ( -- parser ) [ octal-digit? ] satisfy ; : 'octal-digit' ( -- parser ) [ octal-digit? ] satisfy ;
@ -158,23 +159,39 @@ C: <group-result> group-result
'char' <|> 'char' <|>
'character-class' <|> ; 'character-class' <|> ;
: 'interval' ( -- parser ) : 'greedy-interval' ( -- parser )
'simple' 'integer' "{" "}" surrounded-by <&> [ first2 exactly-n ] <@ 'simple' 'integer' "{" "}" surrounded-by <&> [ first2 exactly-n ] <@
'simple' 'integer' "{" ",}" surrounded-by <&> [ first2 at-least-n ] <@ <|> 'simple' 'integer' "{" ",}" surrounded-by <&> [ first2 at-least-n ] <@ <|>
'simple' 'integer' "{," "}" surrounded-by <&> [ first2 at-most-n ] <@ <|> 'simple' 'integer' "{," "}" surrounded-by <&> [ first2 at-most-n ] <@ <|>
'simple' 'integer' "," token <& 'integer' <&> "{" "}" surrounded-by <&> [ first2 first2 from-m-to-n ] <@ <|> ; 'simple' 'integer' "," token <& 'integer' <&> "{" "}" surrounded-by <&> [ first2 first2 from-m-to-n ] <@ <|> ;
: 'repetition' ( -- parser ) : 'interval' ( -- parser )
'greedy-interval'
'greedy-interval' "?" token <& [ "reluctant {}" print ] <@ <|>
'greedy-interval' "+" token <& [ "possessive {}" print ] <@ <|> ;
: 'greedy-repetition' ( -- parser )
'simple' "*" token <& [ <*> ] <@ 'simple' "*" token <& [ <*> ] <@
'simple' "+" token <& [ <+> ] <@ <|> 'simple' "+" token <& [ <+> ] <@ <|>
'simple' "?" token <& [ <?> ] <@ <|> ; 'simple' "?" token <& [ <?> ] <@ <|> ;
: 'repetition' ( -- parser )
'greedy-repetition'
'greedy-repetition' "?" token <& [ "reluctant" print ] <@ <|>
'greedy-repetition' "+" token <& [ "possessive" print ] <@ <|> ;
: 'term' ( -- parser ) : 'term' ( -- parser )
'simple' 'repetition' 'interval' <|> <|> 'simple' 'repetition' 'interval' <|> <|>
<+> [ <and-parser> ] <@ ; <+> [ <and-parser> ] <@ ;
LAZY: 'regexp' ( -- parser ) LAZY: 'regexp' ( -- parser )
'term' "|" token nonempty-list-of [ <or-parser> ] <@ ; 'term' "|" token nonempty-list-of [ <or-parser> ] <@
"^" token 'term' "|" token nonempty-list-of [ <or-parser> ] <@
&> [ "caret" print ] <@ <|>
'term' "|" token nonempty-list-of [ <or-parser> ] <@
"$" token <& [ "dollar" print ] <@ <|>
"^" token 'term' "|" token nonempty-list-of [ <or-parser> ] <@ &>
"$" token [ "caret dollar" print ] <@ <& <|> ;
TUPLE: regexp source parser ; TUPLE: regexp source parser ;

View File

@ -105,6 +105,7 @@ find_architecture() {
i386) ARCH=x86;; i386) ARCH=x86;;
i686) ARCH=x86;; i686) ARCH=x86;;
*86) ARCH=x86;; *86) ARCH=x86;;
*86_64) ARCH=x86;;
"Power Macintosh") ARCH=ppc;; "Power Macintosh") ARCH=ppc;;
esac esac
} }
@ -142,6 +143,9 @@ echo_build_info() {
set_build_info() { set_build_info() {
if ! [[ -n $OS && -n $ARCH && -n $WORD ]] ; then if ! [[ -n $OS && -n $ARCH && -n $WORD ]] ; then
echo "OS: $OS"
echo "ARCH: $ARCH"
echo "WORD: $WORD"
echo "OS, ARCH, or WORD is empty. Please report this" echo "OS, ARCH, or WORD is empty. Please report this"
exit 5 exit 5
fi fi
@ -170,6 +174,7 @@ git_clone() {
} }
git_pull_factorcode() { git_pull_factorcode() {
echo "Updating the git repository from factorcode.org..."
git pull git://factorcode.org/git/factor.git git pull git://factorcode.org/git/factor.git
check_ret git check_ret git
} }
@ -216,7 +221,7 @@ bootstrap() {
} }
usage() { usage() {
echo "usage: $0 install|update" echo "usage: $0 install|install-x11|update"
} }
install() { install() {
@ -244,8 +249,13 @@ update() {
bootstrap bootstrap
} }
install_libraries() {
sudo apt-get install libc6-dev libfreetype6-dev wget git-core git-doc libx11-dev glutg3-dev
}
case "$1" in case "$1" in
install) install ;; install) install ;;
install-x11) install_libraries; install ;;
update) update ;; update) update ;;
*) usage ;; *) usage ;;
esac esac