At 11:04 AM +0200 on 6/27/99, M. Uli Kusterer wrote:
>> find expression "hello" & [a] [minimal | maximal] string [<container>]\
>> in [<search_container>]
>
>Anthony,
>
> sounds cool to me. Just one note: the "in <search_container>" part should
>be an optional parameter to all veriants of "Find".
>
>>"Find expression" so we don't have to implement infinite-lookahead parsers,
>
> that's what I thought.
>
>>minimal vs. maximal allows a greedy (i.e., eat up all characters possible)
>>vs. non-greedy match
>
> OK. But non-greedy should be the default. instead of "minimal" and
>"maximal", I'd propose using "shortest" and "longest", though. See how
>English it suddenly becomes :-)
No, because that's not what it means, unless we go to "shortest possible
string" and "longest possible string".
But by that time, we'd wind up with long, long, long lines -- or rather a
bunch of option-L's (�) in there. It'd become less readable than a
standard-issue perl regexp (at least to me ;-) ).
Perhaps "short string" and "long string" ? Might be confusing, though.
Maybe "shorter" and "longer". But that does not say that it will find the
shortest possible and the longest possible, respectivly. So I think we're
back to "maximal" and "minimal".
BTW: The shortest string is an empty string, and the longest string is one
that eats every last byte of RAM. Clearly not what we want.
>
>>Also, if <container> is provided,
>>the matched text is stored to <container>.
>
> Yes, that pretty much sums up what we came up with by now. So, here's my
>formal syntax proposal:
>
> find expression <expr> [or expression <expr> [or ...]] [in <container>]
> Result is output to the foundChunk, foundText etc.
>
> an expr may be:
> <expr> & <expr>
> <expr> && <expr>
> [a] [{shortest|longest}] string [<destContainer>]
See above.
> [a] string [<destContainer>] [of length <integer>]
> [a] number [<destContainer>] [from <min> to <max>]
> [an] integer [<destContainer>] [from <min> to <max>]
These look like you're telling it position. How about "between <min> and <max>"
> [a] boolean [<destContainer>]
Is boolean used anywhere else in HyperTalk? Can one say "if x is a
boolean"? I'd think quite hard before introducing a new concept -- there
are many other places it'd need ot be added.
> [a] character [destContainer] [in <string>]
> <string> -- may be integers, booleans, obj. descriptors that auto-convert
>to string