[REBOL] Re: Complex Series Parsing (Part 2)
Nope. It's just one of those things. You could always: replace/all string "> <" "><" if you knew that was safe to do on the original string so that the load/markup wouldn't make the whitespace values. But that still doesn't solve the string with more than one space (or tabs). It's best to iterate the block and remove items that TRIM to EMPTY?: for x length? blk 1 -1 [if empty? trim blk/:x [remove at blk x]] If you don't want any strings in the block permanently trimmed then make it "trim copy blk/:x" instead. Sterling > > You can get rid of the whitespace-only strings if you want to that are > > created due to whitespace between the tags. > > OK, is there easy way of how to do it without using iteration? If I will use > e.g. replace/all blk " " none, it will just replace whitespace with 'none, > but we want simply to remove the whitespace :-) > -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with "unsubscribe" in the subject, without the quotes.
[REBOL] Re: Complex Series Parsing (Part 2)
- Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, March 09, 2001 8:03 PM Subject: [REBOL] Re: Complex Series Parsing (Part 2) > > Well, before anybody goes further into the "here's something that > works for the last input you posted" followed by "but then there's > this input that doesn't work" path, lets go back to the definition of > input and output. > > If you use load.markup and trat the REBOL words you have in your block > as strings like Andrew suggests (which is a better way to deal with > them), then you have these input elements: > * -- open text tag > * "???" -- some arbitrary string > *-- some other open tag > * -- some close tag > * -- a close text tag > > Your input looks like this: > probe input: load/markup { this and that > those and > theseThere and > then} > == [ " " " this and that^/" "those " > "and > these" "There and^/then" > ] > > You can get rid of the whitespace-only strings if you want to that are > created due to whitespace between the tags. OK, is there easy way of how to do it without using iteration? If I will use e.g. replace/all blk " " none, it will just replace whitespace with 'none, but we want simply to remove the whitespace :-) > Now write the spec: > * any combination of input elements up to > * open > * any combination of "???", , where whould be > inserted if front of each "???" > * > * start the whole process over > Done. > > That's all you've told us so far. Each item above is essentially a > parse rule already. Some can be joined together: > * [thru ] > * [any [ > [thru ] > | tag! > | string! mark: (insert back mark ) string! > ] > ] > > Now we just assemble: > ; skip the immediate string after so we don't add a second one > start-rule: [thru [string! | none]] > parse imput [ > start-rule > any [ > start-rule ; start over > | tag! ; eat any random tags > | string! mark: (insert back mark ) string! > ] > ] > So you prefer to work with XML-like data in block mode rather than in string mode? Cheers, -pekr- > probe input > > And presto! > > Sterling -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with "unsubscribe" in the subject, without the quotes.
[REBOL] Re: Complex Series Parsing (Part 2)
Well, before anybody goes further into the "here's something that works for the last input you posted" followed by "but then there's this input that doesn't work" path, lets go back to the definition of input and output. If you use load.markup and trat the REBOL words you have in your block as strings like Andrew suggests (which is a better way to deal with them), then you have these input elements: * -- open text tag * "???" -- some arbitrary string *-- some other open tag * -- some close tag * -- a close text tag Your input looks like this: probe input: load/markup { this and that those and > theseThere and then} == [ " " " this and that^/" "those " "and > these" "There and^/then" ] You can get rid of the whitespace-only strings if you want to that are created due to whitespace between the tags. Now write the spec: * any combination of input elements up to * open * any combination of "???", , where whould be inserted if front of each "???" * * start the whole process over Done. That's all you've told us so far. Each item above is essentially a parse rule already. Some can be joined together: * [thru ] * [any [ [thru ] | tag! | string! mark: (insert back mark ) string! ] ] Now we just assemble: ; skip the immediate string after so we don't add a second one start-rule: [thru [string! | none]] parse imput [ start-rule any [ start-rule ; start over | tag! ; eat any random tags | string! mark: (insert back mark ) string! ] ] probe input And presto! Sterling > This is on the right track. But more complexity would arise... here is an > advanced XML structure... > > y: [ this and that those and > theseThere and then] > output would be... > out: [ > > > this and that > > those > > and these > > > > There and then > > ] > > > There is method to the madness, I've got the "madness" part down pat, now if > I could only come up with "the method". > > Thanks > Terry Brownell > > - Original Message - > From: <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Thursday, March 08, 2001 4:17 PM > Subject: [REBOL] Re: Complex Series Parsing (Part 2) > > > > > > I'm not sure I understand what you are really trying to do. Usually > > with parse, once you describe the format of what you want to parse and > > the output wou desire, the parse rules just fall out onto the screen. > > Correct me if I'm wrong: > > > > Input is a block with the following format: > > A tag followed by a series of words with any number of non > > or tags interspersed and ends with a tag. > > > > The desired output is the same block except that every place there is > > a non tag in the block a tag should be placed after it > > and before the next series of words. The ending tag should be > > removed. > > > > For this you don't need parse at all. Just march through the block > > and insert the new tag as needed: > > y: [ > > This is some text with a tag added and then some text > > > ] > > > > forall y [ > > all [tag? y/1 y/1 <> y/1 <> insert next y ] > > all [y/1 = remove y y: back y] > > ] > > > > probe y: head y > > > > Perhaps your rules are a bit more complicated in which caase you need > > to define them and then see what's the best way to do it. Parse may > > be necessary but this simple case can be done quickly another way. > > > > Sterling > > -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with "unsubscribe" in the subject, without the quotes.
[REBOL] Re: /view example doesn't work
Hi Michael, [EMAIL PROTECTED] wrote: > > The following example from the /view doc doesn't work, or when I try to use > the 'choice button in my script: > > view layout [choice "Choose" data ["Happy" "Joyous" "Free"]] > > > I get the button displayed, but no list of choices. I expect a list of > choices to "pop-up" somehow on its own. Do I have to do something else to > get this? /View documentation is quite old and out of date for some parts. With /View version 0.9.9, it works well. On View 0.10.38, the following line will work : view layout [size 200x200 choice "Choose" "Happy" "Joyous" "Free"] It's not exactly the same than with 0.9.9. If you want more info on what 'choice style can do and how it works : save %choice-style.r get-style 'choice (You'll get the source of the 'choice style.) HTH, DocKimbel. -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with "unsubscribe" in the subject, without the quotes.
[REBOL] Re: Complex Series Parsing (Part 2)
cont... This method makes the xml coding much cleaner... This xml... "some text this is a bit of text with some stuff and some more stuff and then some final text " is better than "some text this is a bit of text with some stuff and some more stuffand then some final text" Terry Brownell - Original Message - From: "Petr Krenzelok" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, March 09, 2001 4:06 AM Subject: [REBOL] Re: Complex Series Parsing (Part 2) > > - Original Message - > From: Terry Brownell <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Friday, March 09, 2001 10:25 AM > Subject: [REBOL] Re: Complex Series Parsing (Part 2) > > > > This is on the right track. But more complexity would arise... here is an > > advanced XML structure... > > > > y: [ this and that those and > > theseThere and then] > > output would be... > > out: [ > > > > > > this and that > > > > those > > > > and these > > > > > > > > There and then > > > > ] > > I am sorry but I can't understand the reason you want the input in above > state. It's imo buggy. So you manually insert tag in fron of each > text, while real tag exists too? Just look at your output - you have > 3 tags while you have only one closing tag. Is that correct? > > -pekr- > > > > > > > There is method to the madness, I've got the "madness" part down pat, now > if > > I could only come up with "the method". > > > > Thanks > > Terry Brownell > > > > - Original Message - > > From: <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Thursday, March 08, 2001 4:17 PM > > Subject: [REBOL] Re: Complex Series Parsing (Part 2) > > > > > > > > > > I'm not sure I understand what you are really trying to do. Usually > > > with parse, once you describe the format of what you want to parse and > > > the output wou desire, the parse rules just fall out onto the screen. > > > Correct me if I'm wrong: > > > > > > Input is a block with the following format: > > > A tag followed by a series of words with any number of non > > > or tags interspersed and ends with a tag. > > > > > > The desired output is the same block except that every place there is > > > a non tag in the block a tag should be placed after it > > > and before the next series of words. The ending tag should be > > > removed. > > > > > > For this you don't need parse at all. Just march through the block > > > and insert the new tag as needed: > > > y: [ > > > This is some text with a tag added and then some > text > > > > > ] > > > > > > forall y [ > > > all [tag? y/1 y/1 <> y/1 <> insert next y ] > > > all [y/1 = remove y y: back y] > > > ] > > > > > > probe y: head y > > > > > > Perhaps your rules are a bit more complicated in which caase you need > > > to define them and then see what's the best way to do it. Parse may > > > be necessary but this simple case can be done quickly another way. > > > > > > Sterling > > > > > > > Hello all. > > > > > > > > How do you parse this... > > > > y: [ > > > > This is some text with a tag added and then some > > text > > > > ] > > > > > > > > > > > > So that you get this > > > > > > > > n: [ > > > > This is some text > > > > > > > > with a tag added > > > > > > > > and then some text > > > > ] > > > > > > > > I tried this... > > > > > > > > n: [] > > > > z: parse y none > > > > > > > > foreach val z [ > > > > either find val "<" [append n val] [append n rejoin [{ } val]] > > > > ] > > > > > > > > But then I get > > > > > > > > n: [ > > > > > > > > This > > > > is > > > > some > > > > text > > > > > > > > with > > > > a > > > > tag > > > > added > > > > > > > > and > > > > then > > > > some > > > > text > > > > > > > > ] > > > > > > > > So how do I "collect" all the text until the next "tag"? > > > > > > > > Terry Brownell > > > > > > > > -- > > > > 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. > > > > > > > -- > > 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. > -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with "unsubscribe" in the subject, without the quotes.
[REBOL] Re: Complex Series Parsing (Part 2)
The entire string represents a series of events over time, starting at the top of the output, and making its way down. The tags "fire" as they are processed, and the corresponding ending tags represent "stop" The tag is can have these other "events" embedded. In my particular case, no non tags will have other non tags embedded within, but I imagine one day they would. y: [ this and that those and theseThere and then] out: [ ; fire ; stop this and that ;fire ;fire those ;continue ;stop and these ;continue ;stop ; fire ;stop There and then;fire ;stop ] - Original Message - From: "Petr Krenzelok" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, March 09, 2001 4:06 AM Subject: [REBOL] Re: Complex Series Parsing (Part 2) > > - Original Message - > From: Terry Brownell <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Friday, March 09, 2001 10:25 AM > Subject: [REBOL] Re: Complex Series Parsing (Part 2) > > > > This is on the right track. But more complexity would arise... here is an > > advanced XML structure... > > > > y: [ this and that those and > > theseThere and then] > > output would be... > > out: [ > > > > > > this and that > > > > those > > > > and these > > > > > > > > There and then > > > > ] > > I am sorry but I can't understand the reason you want the input in above > state. It's imo buggy. So you manually insert tag in fron of each > text, while real tag exists too? Just look at your output - you have > 3 tags while you have only one closing tag. Is that correct ? > > -pekr- > > > > > > > There is method to the madness, I've got the "madness" part down pat, now > if > > I could only come up with "the method". > > > > Thanks > > Terry Brownell > > > > - Original Message - > > From: <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Thursday, March 08, 2001 4:17 PM > > Subject: [REBOL] Re: Complex Series Parsing (Part 2) > > > > > > > > > > I'm not sure I understand what you are really trying to do. Usually > > > with parse, once you describe the format of what you want to parse and > > > the output wou desire, the parse rules just fall out onto the screen. > > > Correct me if I'm wrong: > > > > > > Input is a block with the following format: > > > A tag followed by a series of words with any number of non > > > or tags interspersed and ends with a tag. > > > > > > The desired output is the same block except that every place there is > > > a non tag in the block a tag should be placed after it > > > and before the next series of words. The ending tag should be > > > removed. > > > > > > For this you don't need parse at all. Just march through the block > > > and insert the new tag as needed: > > > y: [ > > > This is some text with a tag added and then some > text > > > > > ] > > > > > > forall y [ > > > all [tag? y/1 y/1 <> y/1 <> insert next y ] > > > all [y/1 = remove y y: back y] > > > ] > > > > > > probe y: head y > > > > > > Perhaps your rules are a bit more complicated in which caase you need > > > to define them and then see what's the best way to do it. Parse may > > > be necessary but this simple case can be done quickly another way. > > > > > > Sterling > > > > > > > Hello all. > > > > > > > > How do you parse this... > > > > y: [ > > > > This is some text with a tag added and then some > > text > > > > ] > > > > > > > > > > > > So that you get this > > > > > > > > n: [ > > > > This is some text > > > > > > > > with a tag added > > > > > > > > and then some text > > > > ] > > > > > > > > I tried this... > > > > > > > > n: [] > > > > z: parse y none > > > > > > > > foreach val z [ > > > > either find val "<" [append n val] [append n rejoin [{ } val]] > > > > ] > > > > > > > > But then I get > > > > > > > > n: [ > > > > > > > > This > > > > is > > > > some > > > > text > > > > > > > > with > > > > a > > > > tag > > > > added > > > > > > > > and > > > > then > > > > some > > > > text > > > > > > > > ] > > > > > > > > So how do I "collect" all the text until the next "tag"? > > > > > > > > Terry Brownell > > > > > > > > -- > > > > 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. > > > > > > > -- > > 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. > -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with "unsubscribe" in the subject, without the quotes.
[REBOL] /view example doesn't work
The following example from the /view doc doesn't work, or when I try to use the 'choice button in my script: view layout [choice "Choose" data ["Happy" "Joyous" "Free"]] I get the button displayed, but no list of choices. I expect a list of choices to "pop-up" somehow on its own. Do I have to do something else to get this? I am on Windows NT running REBOL/View 0.10.38.3.1 26-Jan-2001. - Michael Jelinek -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with "unsubscribe" in the subject, without the quotes.
[REBOL] Release date for core 2.5 ?
Sorry I know everybody is really busy! Thank you very much. Will Arp -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with "unsubscribe" in the subject, without the quotes.
[REBOL] Re: OT Request for reference
I would except I don't really feel like I'm qualified enough. If nobody more qualified than I helps then I will. Regards, Anton. > OT Request for reference > I need a technical reference on my abilities for an employment agency. If > anyone feels like giving one, could they email it to: > [EMAIL PROTECTED] > and cc a copy to me at [EMAIL PROTECTED] please? > Thank you. > Andrew Martin -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with "unsubscribe" in the subject, without the quotes.
[REBOL] Re: Spreadsheet
Hi Volker, I'm sorry about taking a while to reply. > What do you think about my %rebheet3.r on the Volker-rebpage? > (function, not q&d-coding :) I think it is great! You certainly have put a lot of work into it. Implementing your own dialects for extra spreadsheet niceties was a great idea. I had fun playing with it. Putting in rebol expressions into one cell and then having another reference it worked really well. For example I read the contents of a directory into one cell, the next cell iterated over each file in the block contained in the first cell and did some silly processing. The only thing was I couldn't see the result when it was too long - otherwise it could be useful now. It shows great promis don't you think? It certainly gives ideas. Brett. -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with "unsubscribe" in the subject, without the quotes.
[REBOL] Re: Complex Series Parsing (Part 2)
- Original Message - From: Terry Brownell <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, March 09, 2001 10:25 AM Subject: [REBOL] Re: Complex Series Parsing (Part 2) > This is on the right track. But more complexity would arise... here is an > advanced XML structure... > > y: [ this and that those and > theseThere and then] > output would be... > out: [ > > > this and that > > those > > and these > > > > There and then > > ] I am sorry but I can't understand the reason you want the input in above state. It's imo buggy. So you manually insert tag in fron of each text, while real tag exists too? Just look at your output - you have 3 tags while you have only one closing tag. Is that correct? -pekr- > > > There is method to the madness, I've got the "madness" part down pat, now if > I could only come up with "the method". > > Thanks > Terry Brownell > > - Original Message - > From: <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Thursday, March 08, 2001 4:17 PM > Subject: [REBOL] Re: Complex Series Parsing (Part 2) > > > > > > I'm not sure I understand what you are really trying to do. Usually > > with parse, once you describe the format of what you want to parse and > > the output wou desire, the parse rules just fall out onto the screen. > > Correct me if I'm wrong: > > > > Input is a block with the following format: > > A tag followed by a series of words with any number of non > > or tags interspersed and ends with a tag. > > > > The desired output is the same block except that every place there is > > a non tag in the block a tag should be placed after it > > and before the next series of words. The ending tag should be > > removed. > > > > For this you don't need parse at all. Just march through the block > > and insert the new tag as needed: > > y: [ > > This is some text with a tag added and then some text > > > ] > > > > forall y [ > > all [tag? y/1 y/1 <> y/1 <> insert next y ] > > all [y/1 = remove y y: back y] > > ] > > > > probe y: head y > > > > Perhaps your rules are a bit more complicated in which caase you need > > to define them and then see what's the best way to do it. Parse may > > be necessary but this simple case can be done quickly another way. > > > > Sterling > > > > > Hello all. > > > > > > How do you parse this... > > > y: [ > > > This is some text with a tag added and then some > text > > > ] > > > > > > > > > So that you get this > > > > > > n: [ > > > This is some text > > > > > > with a tag added > > > > > > and then some text > > > ] > > > > > > I tried this... > > > > > > n: [] > > > z: parse y none > > > > > > foreach val z [ > > > either find val "<" [append n val] [append n rejoin [{ } val]] > > > ] > > > > > > But then I get > > > > > > n: [ > > > > > > This > > > is > > > some > > > text > > > > > > with > > > a > > > tag > > > added > > > > > > and > > > then > > > some > > > text > > > > > > ] > > > > > > So how do I "collect" all the text until the next "tag"? > > > > > > Terry Brownell > > > > > > -- > > > 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. > > > > -- > 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.
[REBOL] Re: Complex Series Parsing (Part 2)
Terry wrote: > y: [ this and that those and > theseThere and then] Have you considered the effects of haveing "bare" words in your block? Wouldn't it be better if your text words were inside strings? Like: y: [ {this and that} "those " {and these} "There and then" ] Then strings with punctuation and invalid rebol words won't stop your script from running. Then it becomes a simple matter to pick out strings and tags in the block. Andrew Martin ICQ: 26227169 http://members.nbci.com/AndrewMartin/ -><- -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with "unsubscribe" in the subject, without the quotes.
[REBOL] Re: Complex Series Parsing (Part 2)
This is on the right track. But more complexity would arise... here is an advanced XML structure... y: [ this and that those and theseThere and then] output would be... out: [ this and that those and these There and then ] There is method to the madness, I've got the "madness" part down pat, now if I could only come up with "the method". Thanks Terry Brownell - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, March 08, 2001 4:17 PM Subject: [REBOL] Re: Complex Series Parsing (Part 2) > > I'm not sure I understand what you are really trying to do. Usually > with parse, once you describe the format of what you want to parse and > the output wou desire, the parse rules just fall out onto the screen. > Correct me if I'm wrong: > > Input is a block with the following format: > A tag followed by a series of words with any number of non > or tags interspersed and ends with a tag. > > The desired output is the same block except that every place there is > a non tag in the block a tag should be placed after it > and before the next series of words. The ending tag should be > removed. > > For this you don't need parse at all. Just march through the block > and insert the new tag as needed: > y: [ > This is some text with a tag added and then some text > ] > > forall y [ > all [tag? y/1 y/1 <> y/1 <> insert next y ] > all [y/1 = remove y y: back y] > ] > > probe y: head y > > Perhaps your rules are a bit more complicated in which caase you need > to define them and then see what's the best way to do it. Parse may > be necessary but this simple case can be done quickly another way. > > Sterling > > > Hello all. > > > > How do you parse this... > > y: [ > > This is some text with a tag added and then some text > > ] > > > > > > So that you get this > > > > n: [ > > This is some text > > > > with a tag added > > > > and then some text > > ] > > > > I tried this... > > > > n: [] > > z: parse y none > > > > foreach val z [ > > either find val "<" [append n val] [append n rejoin [{ } val]] > > ] > > > > But then I get > > > > n: [ > > > > This > > is > > some > > text > > > > with > > a > > tag > > added > > > > and > > then > > some > > text > > > > ] > > > > So how do I "collect" all the text until the next "tag"? > > > > Terry Brownell > > > > -- > > 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. > -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with "unsubscribe" in the subject, without the quotes.