my Rebol version is: 1.2.1.3.1
is that suitable such that what you provided should function?
Dick
> ** Original Subject: [REBOL] Re: Embedded macros ..
> ** Original Sender: "Andrew Martin" <[EMAIL PROTECTED]>
> ** Original Date: Mon, 9 Sep 2002 04:08:36 -0500
> ** Original Message follows...
>
> Try something like:
> [
> Rebol []
>
> Embed: function [String [string!]] [Rule Start Word End] [
> parse String: copy String Rule: [
> any [
> [
> Start: [#"$" | #"%"] #"(" [copy Word [Alpha some Alphadigit]
> | Rule] #")" End: (
> End: change/part Start get to-word Word End
> ) :End
> ]
> | skip
> ]
> end
> ]
> String
> ]
>
> a: "A"
> n: "N"
> s: "S"
> ans: "Answer"
> home: "HOME"
> dir: "DIR"
>
> homedir: "HOMEDIR"
>
> foreach String [
> "The answer is: $(ans)"
> "The homedir is: %(homedir)"
> "The answer is: $($(a)$(n)$(s))"
> "The homedir is: %($(home)$(dir))"
> ] [
> print Embed String
> ]
>
> halt
>
> ]
>
> Which gives results like:
>
> The answer is: Answer
> The homedir is: HOMEDIR
> The answer is: $($(a)$(n)$(s))
> The homedir is: %(HOMEDIR)
>
> I haven't got the recursion part right.
>
> Andrew Martin
> ICQ: 26227169 http://valley.150m.com/
> -><-
>
> ----- Original Message -----From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, September 09, 2002 1:58 PM
> Subject: [REBOL] Embedded macros ..
>
>
> > Could someone give me an idea on how to parse something like embedded
> macros in Rebol?
> >
> > Assume there are at least two types of macros one might find in a string:
> > $(RebolVariableorExpression)
> > %(EnvironmentVariable)
> >
> > Examples:
> >
> > "The answer is: $(ans)"
> > "The homedir is: %(homedir)"
> >
> > Embedded examples:
> >
> > "The answer is: $($(a)$(n)$(s))"
> > "The homedir is: %($(home)$(dir))
> >
> > where the variables:
> >
> > a:"a"
> > n:"n"
> > s:"s"
> > ans:"Answer"
> > home:"home"
> > dir:"dir"
> >
> > Must be the age ??
> > Dick
> >
> >
> > Download NeoPlanet at http://www.neoplanet.com
> >
> > --
> > To unsubscribe from this list, please send an email to
> > [EMAIL PROTECTED] with "unsubscribe" in the
> > subject, without the quotes.
> >
>
> --
> To unsubscribe from this list, please send an email to
> [EMAIL PROTECTED] with "unsubscribe" in the
> subject, without the quotes.
>** --------- End Original Message ----------- **
>
Download NeoPlanet at http://www.neoplanet.com
--
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the
subject, without the quotes.