diff --git a/extra/parser-combinators/parser-combinators-tests.factor b/extra/parser-combinators/parser-combinators-tests.factor index 546eb84c98..8d55cc5770 100644 --- a/extra/parser-combinators/parser-combinators-tests.factor +++ b/extra/parser-combinators/parser-combinators-tests.factor @@ -149,9 +149,3 @@ IN: scratchpad { { } } [ "234" "1" token <+> parse list>array ] 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 - diff --git a/extra/regexp/regexp.factor b/extra/regexp/regexp.factor index f1f2d3b1e4..55d15aed42 100755 --- a/extra/regexp/regexp.factor +++ b/extra/regexp/regexp.factor @@ -2,6 +2,7 @@ USING: arrays combinators kernel lazy-lists math math.parser namespaces parser parser-combinators parser-combinators.simple promises quotations sequences combinators.lib strings macros assocs prettyprint.backend ; +USE: io IN: regexp : or-predicates ( quots -- quot ) @@ -40,7 +41,7 @@ MACRO: fast-member? ( str -- quot ) dup alpha? swap punct? or ; : 'ordinary-char' ( -- parser ) - [ "\\^*+?|(){}[" fast-member? not ] satisfy + [ "\\^*+?|(){}[$" fast-member? not ] satisfy [ [ = ] curry ] <@ ; : 'octal-digit' ( -- parser ) [ octal-digit? ] satisfy ; @@ -158,23 +159,39 @@ C: group-result 'char' <|> 'character-class' <|> ; -: 'interval' ( -- parser ) +: 'greedy-interval' ( -- parser ) 'simple' 'integer' "{" "}" surrounded-by <&> [ first2 exactly-n ] <@ 'simple' 'integer' "{" ",}" surrounded-by <&> [ first2 at-least-n ] <@ <|> 'simple' 'integer' "{," "}" surrounded-by <&> [ first2 at-most-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 <& [ ] <@ <|> ; +: 'repetition' ( -- parser ) + 'greedy-repetition' + 'greedy-repetition' "?" token <& [ "reluctant" print ] <@ <|> + 'greedy-repetition' "+" token <& [ "possessive" print ] <@ <|> ; + : 'term' ( -- parser ) 'simple' 'repetition' 'interval' <|> <|> <+> [ ] <@ ; LAZY: 'regexp' ( -- parser ) - 'term' "|" token nonempty-list-of [ ] <@ ; + 'term' "|" token nonempty-list-of [ ] <@ + "^" token 'term' "|" token nonempty-list-of [ ] <@ + &> [ "caret" print ] <@ <|> + 'term' "|" token nonempty-list-of [ ] <@ + "$" token <& [ "dollar" print ] <@ <|> + "^" token 'term' "|" token nonempty-list-of [ ] <@ &> + "$" token [ "caret dollar" print ] <@ <& <|> ; TUPLE: regexp source parser ; diff --git a/misc/factor.sh b/misc/factor.sh index 98f9104549..7511b3d83d 100755 --- a/misc/factor.sh +++ b/misc/factor.sh @@ -105,6 +105,7 @@ find_architecture() { i386) ARCH=x86;; i686) ARCH=x86;; *86) ARCH=x86;; + *86_64) ARCH=x86;; "Power Macintosh") ARCH=ppc;; esac } @@ -142,6 +143,9 @@ echo_build_info() { set_build_info() { 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" exit 5 fi @@ -170,6 +174,7 @@ git_clone() { } git_pull_factorcode() { + echo "Updating the git repository from factorcode.org..." git pull git://factorcode.org/git/factor.git check_ret git } @@ -216,7 +221,7 @@ bootstrap() { } usage() { - echo "usage: $0 install|update" + echo "usage: $0 install|install-x11|update" } install() { @@ -244,8 +249,13 @@ update() { bootstrap } +install_libraries() { + sudo apt-get install libc6-dev libfreetype6-dev wget git-core git-doc libx11-dev glutg3-dev +} + case "$1" in install) install ;; + install-x11) install_libraries; install ;; update) update ;; *) usage ;; esac