[Sent to xTalk because it's an xTalk issue, to OODL because I'm writing
that interpreter, and to ufp because theu're supposed to deal with
high-level things like that. Please respond to on appropriate list.
Probably xTalk for general, high-level discussions and OODL for technical,
OpenCard-specific ones]
For those of you who want to read this quickly, a syntax summary. All will
be explained below. All single-quoted things are literals, and spaces can
be any amount of whitespace. An elipsis (three periods -- ...) indicates
continuations in the same fashion for however long the user feels like,
brackets indicate optional portions. A vertical bar, |, indicates different
options (of which one must be chosen). Unquoted words are expressions to be
filled in by the user. Assume the entire thing is on one line; it sort of
wrapped.
'put' '(' 'delim'|'delimiter'|'delimited' 'by'|'='|'is'
delimiter ['or' delimiter ...] ')'
Where the elipsis indicates multiple allowed delimiters and
delimiter is one of:
character...
'regexp'|'regular expression' <regular expression>
If I can get away with multicharacter delimiters and regular expression
deliters, I don't know; the proposal is still perfectly valid and
equally sensable with single-character delimiters.
We could make it long:
1) put item 3 (delimited by "3") of list into i...
which sounds like English.
Make 'of' optional and allow deliminted to be abbreviated, and you get:
2) put item 3 (delim "3") of list into i
Which still makes sence and doesen't kill your fingers typing. Also,
'delimiter' would be allowed, because that makes more sence when of is
omitted
Perhaps also allow 'of' to be replaced by '=' or 'is':
3) put item 3 (delim="3") of list into i -- or "delimiter="
4) put item 3 (delim is "3") of list into i -- or "delimiter is"
#1 and #4 sound like English -- it's as if we're talking to the
interpreter. #3 is the standard is/= replacement in HyperTalk, and is just
abbreviated a little.
But how does it look with long chunks, relative postitions (e.g., last) and
variables?
1) put item 1 (delimited by ".") of last item (delimited by pathDelim)�
of filePath into fileName
2) put item 1 (delim ".") of last item (delim pathDelim) of filePath�
into fileName
3) put item 1 (delim=".") of last item (delim=pathDelim) of filePath�
into fileName
4) put tiem 1 (delim is ".") of last item (delim is pathDelim) of�
filePath into fileName
(BTW: the last character on those line, should email eat it, is the
HyperCard continuation character, �, produced by option-L on the
Mac)
And this leads to a more powerfull feature as well: Multiple delimiters.
It's work with all the syntaxes above (I suggest all four be allowed):
put item 1 (delimted by "a" or "b" or "c" or...) of ...
put tiem 1 (delim "a" or "b" or "c" or...) of...
put item 1 (delim="a" or "b" or "c" or...) of...
put item 1 (delim is "a" or "b" or "c" or...) of...
The important question would be should we allow:
put item 1 (delimited by "ab") of...
In other words, should we allow multicharacter delimiters? I see no reason
why not!
And how long until we add in regexp support? It'd fit the syntax:
put item 1 (delimited by regexp "[a-zA-M]") of...
-- or "regular expression" or whatever
And lastly, how long until we tell Perl to get the h*ll out the the way? <g>
PS: Remember, I'm writing the OpenCard interpreter, so yes I will have to
parse this... I'm not one of those living in the DWIM-dreamland. It should
be easily (at least with Bison) doable.
PS(2): DWIM is the much-wanted command, "do what I mean!"