[REBOL] Expanding Rebol's definition of a word
From: AJMartin::orcon::net::nz at: 24-Dec-2003 22:43
I've found that it's possible to expand the definition of a Rebol word (but
not actually Rebol itself because I don't have the source). Here's my C#
code using regular expressions to parse out get-word!, set-word!, word! and
get-set-word! values.
String Separators = @"\s\[\]\(\)";
public class Get_Set_Word : Value {
public Get_Set_Word () {
Title = "Get-Set-Word";
Pattern = new Regex (@"\G:[^" + Separators + "]*:" + Delimiter);
}
}
public class Get_Word : Value {
public Get_Word () {
Title = "Get-Word";
Pattern = new Regex (@"\G:[^" + Separators + "]*" + Delimiter);
}
}
public class Set_Word : Value {
public Set_Word () {
Title = "Set-Word";
Pattern = new Regex (@"\G[^" + Separators + "]:*" + Delimiter);
}
}
public class Word : Value {
public Word () {
Title = "Word";
Pattern = new Regex (@"\G[^" + Separators + "]*" + Delimiter);
}
}
In my tests so far, I can get my R# to recognise these as get-word, set-word
and word values:
C# F# & ^ * = == && ++ ~ >: <: !: :~ ~#
Word :GetWord SetWord:
As well as email, issues, pairs, tags, tuples, dollars (money!), files,
urls, degree-minutes-seconds (12°34'56"), strings ("test"), percentages
(99.5%), scalar-like values (60Km/H).
I'd really like it if these definitions became a part of Rebol.
Andrew J Martin
Speaking in tongues and performing miracles.
ICQ: 26227169
http://www.rebol.it/Valley/
http://valley.orcon.net.nz/
http://Valley.150m.com/