r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[I'm new] Ask any question, and a helpful person will try to answer.

mhinson
14-May-2009
[2258]
Ladislav, I am not sure I understand your terminology. record: [random-part 
whitespace repeated-part any ["," repeated-part]]
random-part may be absent
repeated-part is a number between 1 & 13 followed by "/" 
any is the bit we want and will be a number or a range
,
 is not present at the end of the line

repeated-part  is the same as above, but will not be the last thing 
on the line.
PeterWood
14-May-2009
[2259]
I need to go now but your in good hands.
Ladislav
14-May-2009
[2260x3]
mhinson: OK, let's proceed further
so you are saying, that random-part may be a-word a-number or absent. 
This is it:

random-part: [a-word | a-number | none]
is this understood?
mhinson
14-May-2009
[2263x2]
Thanks for your help Peter.  I am taking notes & understanding it 
I think.
Yes, that sounds a good description of the random part.
Ladislav
14-May-2009
[2265x2]
fine, we need to describe further, what is a-word:

a-word: [some alpha]

, is this adequate?
alpha: charset [#"a" - #"z" #"A" - #"Z"]
mhinson
14-May-2009
[2267]
yes
Ladislav
14-May-2009
[2268]
fine, now for the a-number part. how big a number can it be?
mhinson
14-May-2009
[2269]
1 to 2000 will cover it
Ladislav
14-May-2009
[2270]
a-number: [one-to-two 3 digit | non-zero-digit 0 2 digit]
Steeve
14-May-2009
[2271]
hum..
a-number: [1 4 digit]
is that not enough ?
Ladislav
14-May-2009
[2272x2]
that allows for 0
as well as for 9999
mhinson
14-May-2009
[2274]
that would be fine
Ladislav
14-May-2009
[2275]
ok then, you pick what is appropriate
Steeve
14-May-2009
[2276x2]
yep but it's an average limit that mhinson gave
no need to be strict here, i think
Ladislav
14-May-2009
[2278x3]
repeated-part will not be the last thing on the line
: fine, what will be the last thing on the line?
(except for the newline character, of course)
will the newline character be actually there?
mhinson
14-May-2009
[2281]
the final wanted bit of data will be the last thing, then the end 
of the line because the data has been read from the file with read/lines
Ladislav
14-May-2009
[2282x4]
how do you call the last part of the data, isn't it the same part 
that may repeat more than once?
(divided by comma, of course)
one more thing we need to make agreement on: do we want to rely on 
the default whitespace handling or be more specific and say exactly 
where whitespace may be?
well, it looks, that I will have to run soon
Maxim
14-May-2009
[2286]
mhinson... If I can encourage you... once you will "get" it... it 
will all become <really> simple.  you mind is just adapting to maping 
rules and seeing the inherent stack of what they imply.  

Don't give up, it will all become clear.  I think we all feel the 
same anxiety at first.  Most don't follow through, its a good thing 
that you persevere.  :-)
mhinson
14-May-2009
[2287]
the white space is not present in the intresting part of the data 
so would that suggest the default handleing would be ok?
Maxim
14-May-2009
[2288]
you mean not using /all?
Ladislav
14-May-2009
[2289]
probably yes
mhinson
14-May-2009
[2290]
yes
Ladislav
14-May-2009
[2291x2]
the rule

line: [random-part repeated-part any ["," repeated-part]]


just means, that at the start there is a special random-part, and 
then we have more repeated-part's separated by comma
notice, that the comma isn't at the end!
mhinson
14-May-2009
[2293]
I dont understand why we need the repeated-part in twice?
Ladislav
14-May-2009
[2294x2]
we didn't specify what exactly is in the repeated-part, so we can 
continue:

repeated-part: [one-to-thirteen "/" a-range]
repeated-part twice: good question. we stated it so, to describe 
the situation, when the quantity of repeated-part's is one less than 
the quantity of commas
Maxim
14-May-2009
[2296]
because of the comma (",")
Ladislav
14-May-2009
[2297]
sorry, "one more"
Maxim
14-May-2009
[2298]
there is no comma before the first repeated-part, basically.
Ladislav
14-May-2009
[2299]
ok, bye, it's yours
Steeve
14-May-2009
[2300]
Probably that would be enough:
line: [random-part any [repeated-part opt #","]]
But it can failed, dependening what is in repeated-part
Ladislav
14-May-2009
[2301]
well, that does not exactly describe what mhinson said
Maxim
14-May-2009
[2302]
steeve, that means it will not require a comma, which means the repeated 
part can match some wrong pattern
Steeve
14-May-2009
[2303]
agree, but if repeated part begins and ends with digits, it will 
not failed
Maxim
14-May-2009
[2304x2]
hehe its hard not to help new users here.
but it WONT fail when they are missing, in which case your parse 
rules can wreak havoc.
Steeve
14-May-2009
[2306]
the question there is, can the comma be missing ?
mhinson
14-May-2009
[2307]
real test data
     3/1-2,3/4,3/7,3/26-30,3/34-38,3/48

3    4/1-2,4/4-13,4/15-17,4/19-21,4/23-25,4/27-28,4/30-33,4/35,4/40,4/48
4/36-39,4/41-47
35   4/29
40   4/18,4/22,4/26,4/34
999  4/3,4/14
disable     4/3,4/5,4/9,4/14,4/19,4/26,4/28,4/34,4/47