Howdy, Terrence:
Neat stuff. Planning on making web page out of the result?
> In order to improve my skills with the REBOL parse word, I thought I would go
> through "Mastering Regular Expressions" by Jeffrey Freidl and do all the
> examples in REBOL. Here is my first attemp
using thru did not result in correct parsing
>= Original Message From [EMAIL PROTECTED] =
>terrence-brannon wrote:
>> rules: [
>> to "resetsize" (size-cmds: size-cmds - 1)
>> |
>> to "setsize" (size-cmds: size-cmds + 1)
>> ]
>
>Try 'thru instead of 'to.
>
>Note that "setsize" is equal to
terrence-brannon wrote:
> rules: [
> to "resetsize" (size-cmds: size-cmds - 1)
> |
> to "setsize" (size-cmds: size-cmds + 1)
> ]
Try 'thru instead of 'to.
Note that "setsize" is equal to last seven letters of "resetsize".
Me: [
"Andrew Martin"
ICQ: 26227169
http://members.ncbi.com/
In order to improve my skills with the REBOL parse word, I thought I would go
through "Mastering Regular Expressions" by Jeffrey Freidl and do all the
examples in REBOL. Here is my first attempt and it does not work.
The script is supposed to take a list of files and indicate whether the word
Ingo,
I noticed several people had posted parse versions, so I'm sure you'll see
them by the time you see this mail. If not, let me know and I'll write one.
I'm pretty sure Elan wrote one at least.
Later!
On 24-Nov-1999/13:51:44+1:00, [EMAIL PROTECTED] wrote:
>Hi Bo,
>
>I am a bit behind with
Hi Bo,
I am a bit behind with reading my email, so this solution
seems perfect, but I also want to learn something about
parse, so if you please could the parse version, too?
thanks
Ingo
Those were the words of Bohdan Bo Lechnowsky:
>
> Ingo,
>
> Assuming your input line looks like this:
>
Hi Ingo,
you wrote:
>Now here's a real life example ...
>
>Just a descriptive line that noone needs
>NOTU=6, NLOC=15, NALL=5;
>(fortran format string)
The following works rather painlessly. Is it possible to reduce the size
using parse? Hmmm, don't know!
data: {Just a descriptive line that noon
Hi Allen, Elan and all,
sorry for the late answer, but I had no net-access the last
days.
I see, it is not easy to give a short, but thorough description,
So let me try again :-)
The data is used to describe the format of an input file, to compute
genetic data, that I don't at all understand. I
On Fri, 8 Oct 1999 [EMAIL PROTECTED] wrote:
> Hi
> The question:
>
> Why if
> parse "the radio" ["the" "radio"]
> parse "the radio" ["the" "radio"]
> parse " the radio" ["the" "radio"]
>
> are all true,
>
> parse " the radio " ["the" "
t;all" refinement makes the parse command whitespace-sensitive. There's
also a "case" refined to make comparisons case-sensitive. Note that I'm
using ? and + as part of the words s? and s+, they aren't reserved as
"operators" as they may be in other language
These cases might also be informative:
>> parse " the radio " ["the" "radio" any space]
== true
>> parse " the radio " [thru "the" "radio" to end]
== true
>> parse " the big radio " [thru "the" "radio" to end]
== false
Seems (to me) when there is no space following "radio" (in the string be
[EMAIL PROTECTED] wrote:
> Hi
> The question:
>
> Why if
> parse "the radio" ["the" "radio"]
> parse "the radio" ["the" "radio"]
> parse " the radio" ["the" "radio"]
>
> are all true,
>
> parse " the radio " ["the" "radio"]
>
>
Hi
The question:
Why if
parse "the radio" ["the" "radio"]
parse "the radio" ["the" "radio"]
parse " the radio" ["the" "radio"]
are all true,
parse " the radio " ["the" "radio"]
is false?
Thank you
--
Luis Marzulli
e-mail: [
> > > > Have a nice day/night/evening/morning!
> > > Considering the 'random/seed help' thread: Is this a path? ;-)
> > > If so the order confuses me a little...
> >
> > It's function refinements... ^_^
>
> And morning! is a new datatype?
Just different dialects for the 'net and rebol
[EMAIL PROTECTED] wrote:
>
> > > Have a nice day/night/evening/morning!
> > Considering the 'random/seed help' thread: Is this a path? ;-)
> > If so the order confuses me a little...
>
> It's function refinements... ^_^
And morning! is a new datatype?
> > Have a nice day/night/evening/morning!
> Considering the 'random/seed help' thread: Is this a path? ;-)
> If so the order confuses me a little...
It's function refinements... ^_^
Andrew Martin
[EMAIL PROTECTED]
http://members.xoom.com/AndrewMartin/
Online @ 33,600 Baud!
-><-
[EMAIL PROTECTED] wrote:
...
> Have a nice day/night/evening/morning!
Considering the 'random/seed help' thread: Is this a path? ;-)
If so the order confuses me a little...
Tom
Personally, I've found restarting REBOL to be a very healthy thing to do...
when it's not doing what seems reasonable. I'm sure some of the newbie
things I ask of it drive IT's "mind" insane! :) Taking breaks is also good
medicine.. sigh, when one can tear themselves away from a notion and MAKE
Sometimes it's good to take a break, and restart REBOl. ^_^
Have a nice day/night/evening/morning!
Andrew Martin
[EMAIL PROTECTED]
http://members.xoom.com/AndrewMartin/
Online @ 33,600 Baud!
-><-
--
> From: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> Subject: [R
... so you only need word: :word if you want to go back to the index
of the beginning of the sought after characters. Parse automagically
moves the index just beyond the set of characters in the parse
statement ...
Hrrrmm
Cheerfulness,
[EMAIL PROTECTED] wrote:
> I didn't follow the conversation but:
> Why traverse the string again? You already traversed it by "--- ".. then you can
> leave out the mark: :mark clause.. also you should use [thru newline] to prevent
> another 'dumb' loop of the parser...
>
> rule: [
> "==="
I didn't follow the conversation but:
Why traverse the string again? You already traversed it by "--- ".. then you can
leave out the mark: :mark clause.. also you should use [thru newline] to prevent
another 'dumb' loop of the parser...
rule: [
"===" copy header thru newline
[EMAIL PROTECTED] wrote:
>
> EAT, I think this is what you need:
>
> headrule: [
> some [
> thru "=== " copy head to newline (
> append head " (FIRST LEVEL)" append full-contents head
> )
> |
>
[EMAIL PROTECTED] ha scritto:
>
> Near as I can tell, this rule matches the principle shown in Carl's
> stuff below:
>
> headrule: [ some [newline |
> "===" [[copy header to newline]
> ( append header " (FIRST LEVEL)"
> append full-contents header)]
[EMAIL PROTECTED] wrote:
> I hope this helps!
>
> >> str: "--- three dash!"
> == "--- three dash!"
> >> ble: copy ""
> == ""
> >> parse str [some [thru "---" copy rest to end (ble: rest) | thru
> "===" copy rest to end (ble: rest)]]
Marking the input?
1) if str is some 100 and more kbs of mem
EAT, I think this is what you need:
headrule: [
some [
thru "=== " copy head to newline (
append head " (FIRST LEVEL)" append full-contents head
)
|
thru "--- " copy head to newline (
I hope this helps!
>> str: "--- three dash!"
== "--- three dash!"
>> ble: copy ""
== ""
>> parse str [some [thru "---" copy rest to end (ble: rest) | thru
"===" copy rest to end (ble: rest)]]
== true
>> ble
== " three dash!"
>> str: "=== three equals!"
== "=== three equals!"
>> parse str [some [t
e parts done]
> write join file ".html" html
Write the file.
> quit
Stop!
Andrew Martin
[EMAIL PROTECTED]
http://members.xoom.com/AndrewMartin/
Online @ 33,600 Baud!
-><-
--
> From: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> Subject: [REBOL
Andrew,
By the time I posted that, my various combinations involved in trying
to make it work were getting a bit convoluted. It's called "desperation".
I want to understand how this works BADLY. It's been gnawing away at me
to sit down and figure it out one of these days... So, with docs
Near as I can tell, this rule matches the principle shown in Carl's
stuff below:
headrule: [ some [newline |
"===" [[copy header to newline]
( append header " (FIRST LEVEL)"
append full-contents header)] |
"---" [[copy header to newline]
Petr,
Thanks, actually dug that post up already and been trying to
decypher it... My closest approximations still aren't working.
Perhaps someone will be kind enough to do a full step by
step breakdown of the stuff below? Feel like I understand it
pretty well, it's just not working w
[EMAIL PROTECTED] wrote:
> [EMAIL PROTECTED] wrote:
>
> > Okay, granted. Here's the same rule with a different word...
> >
> > headrule: [some
> > [thru "=== " copy header to newline
> > ( append header " (FIRST LEVEL)"
> > append full-contents header)
> Aha, so I am sorry as I am not too skilled in grammar creation. The problem
> seems to be with "find this value OR that value", as string will be parsed
> thru first occurance of "===", and if "---" occured first, it will not be
> reflected. That would require some "parralel" searching for pars
EAT wrote:
> Here's the question. Why does the above only find and append to
full-contents lines with "=== " and completely ignore lines with "---
"?
^_^ Because that's the way you wrote it?
headrule: [
some [
[
[EMAIL PROTECTED] wrote:
> Okay, granted. Here's the same rule with a different word...
>
> headrule: [some
> [thru "=== " copy header to newline
> ( append header " (FIRST LEVEL)"
> append full-contents header)|
> thru "--- " copy head
Okay, granted. Here's the same rule with a different word...
headrule: [some
[thru "=== " copy header to newline
( append header " (FIRST LEVEL)"
append full-contents header)|
thru "--- " copy header to newline
( append h
[EMAIL PROTECTED] wrote:
> Okay, question is simple:
>
> Here's my rule:
>
> headrule: [some [
> [thru "=== " copy head to newline
> ( append head " (FIRST LEVEL)"
> append full-contents head) ] |
> some
> [thru "--- " copy he
Okay, question is simple:
Here's my rule:
headrule: [some [
[thru "=== " copy head to newline
( append head " (FIRST LEVEL)"
append full-contents head) ] |
some
[thru "--- " copy head to newline
( append head "
Ingo,
Assuming your input line looks like this:
inline: "a1=1, a2=2, a3=3, a4"
Here is a one-line solution to do what you want:
do replace replace/all replace/all inline "," " " "=" ": " "a4" "a4: true"
It works for any ordering of inline, and also if the values are separated by
spaces, comm
At 11:41 PM 11/18/99 +0100, you wrote:
>I've got a little parse problem. I try to parse something like
>a1=1, a2=2, a3=3, a4
>where a1 to a3 have to be present, a4 may or may not be there,
>it is unspecified, which is at which position, and they may be
>on subsequent lines, without the commas sepe
At 11:41 PM 11/18/99 +0100, you wrote:
>I've got a little parse problem. I try to parse something like
>a1=1, a2=2, a3=3, a4
>where a1 to a3 have to be present, a4 may or may not be there,
Two questions:
1. If we have a1= does the next digit have to be 1, or could we have:
a1=2, a2=3, a3=8 ...?
Hi Rebols,
I've got a little parse problem. I try to parse something like
a1=1, a2=2, a3=3, a4
where a1 to a3 have to be present, a4 may or may not be there,
it is unspecified, which is at which position, and they may be
on subsequent lines, without the commas seperating them.
Any ideas on how t
42 matches
Mail list logo