diff --git a/core/bootstrap/syntax.factor b/core/bootstrap/syntax.factor index 76b1bcb11f..623c6f0e74 100644 --- a/core/bootstrap/syntax.factor +++ b/core/bootstrap/syntax.factor @@ -18,6 +18,8 @@ IN: bootstrap.syntax "[[" "[=[" "[==[" "factor[[" "factor[=[" "factor[==[" "factor\"" + "resource\"" "vocab\"" "home\"" + "resource`" "vocab`" "home`" "PRIVATE<" "B{" "BV{" diff --git a/core/io/pathnames/pathnames.factor b/core/io/pathnames/pathnames.factor index 0d84f181a2..51c7c8cf9a 100644 --- a/core/io/pathnames/pathnames.factor +++ b/core/io/pathnames/pathnames.factor @@ -1,9 +1,32 @@ ! Copyright (C) 2004, 2009 Slava Pestov, Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors combinators io.backend kernel math math.order -namespaces sequences splitting strings system ; +USING: accessors arrays combinators io.backend kernel math +math.order namespaces sequences sequences.private splitting +strings system ; IN: io.pathnames +TUPLE: pathname string ; +C: pathname ; + +M: pathname nth string>> nth ; +M: pathname nth-unsafe string>> nth-unsafe ; +M: pathname length string>> length ; +M: pathname like drop dup pathname? [ ] unless ; +M: pathname string-lines normalize-path 1array ; + +TUPLE: resource-path < pathname ; +C: resource-path ; + +TUPLE: vocab-path < pathname ; +C: vocab-path ; + +TUPLE: home-path < pathname ; +C: home-path ; + +M: resource-path like drop dup pathname? [ ] unless ; +M: vocab-path like drop dup pathname? [ ] unless ; +M: home-path like drop dup pathname? [ ] unless ; + SYMBOL: current-directory : path-separator? ( ch -- ? ) os windows? "/\\" "/" ? member? ; @@ -163,10 +186,6 @@ M: string absolute-path M: object normalize-path ( path -- path' ) absolute-path ; -TUPLE: pathname string ; - -C: pathname ; - M: pathname absolute-path string>> absolute-path ; M: pathname <=> [ string>> ] compare ; diff --git a/core/syntax/syntax.factor b/core/syntax/syntax.factor index 83dfaff127..0462245510 100644 --- a/core/syntax/syntax.factor +++ b/core/syntax/syntax.factor @@ -124,6 +124,30 @@ IN: bootstrap.syntax "]==]" parse-multiline-string suffix! ] define-core-syntax + "resource\"" [ + "\"" parse-multiline-string-new suffix! + ] define-core-syntax + + "resource`" [ + lexer get parse-spaceless-payload suffix! + ] define-core-syntax + + "vocab\"" [ + "\"" parse-multiline-string-new suffix! + ] define-core-syntax + + "vocab`" [ + lexer get parse-spaceless-payload suffix! + ] define-core-syntax + + "home\"" [ + "\"" parse-multiline-string-new suffix! + ] define-core-syntax + + "home`" [ + lexer get parse-spaceless-payload suffix! + ] define-core-syntax + "PRIMITIVE:" [ current-vocab name>> scan-word scan-effect ";" expect ensure-primitive