[REBOL] another parsing problem: converting dos filenames to rebol
From: princepawn:mailandnews at: 15-Sep-2000 12:49
Could someone please fix this? It hung my interpreter:
REBOL [
Title: "DOS-REBOL File Name Conversion Routines"
File: %dosbol.r
Author: "Terrence Brannon"
Email: [princepawn--yahoo--com]
Purpose: "Ease working with dos filename in REBOL programs"
Category: 'file
]
dosbol: make object! [
char: make string! 0
out: make string! 0
drive-letter: charset [ #"A" - #"F" ]
rules: [ copy char drive-letter ":" (out: rejoin [ "/" dl ]) |
"\" (append out "/") |
copy char (append out char)
]
d2r: func [
dos-fn [string!] "takes a dos filename and converts to rebol format"]
[
parse/all dos-fn [ any rules ]
out
]
]
>> dosbol/d2r "c:\temp\file"
terrence-brannon: [[princepawn--yahoo--com] perl-refugee myth-gamer]
free-email: http://www.MailAndNews.com
free-usenet: http://www.mailAndNews.com
; all the above is real REBOL code, believe it or not.