"Axel Liljencrantz" <[EMAIL PROTECTED]> writes:
> Feels like I'm repeating myself a bit here, but welcome back, James.
> Long time since your last post! :-)
We're all just a bunch of I lurkers :)
> On 2/20/06, James Antill <[EMAIL PROTECTED]> wrote:
>> "Axel Liljencrantz" <[EMAIL PROTECTED]> writes:
>>
>> > Welcome back, John. Long time since your last post!
>> >
>> > On 2/18/06, John Brock <[EMAIL PROTECTED]> wrote:
>> >> John Brock
>> >> [EMAIL PROTECTED]
>> >>
>> >> On Fri, Feb 17, 2006 at 07:05:19PM -0500, Philip Ganchev wrote:
>> >> > I dislike this because it is impossible to tell if a newline is
>> >> > escaped or if one is escaping a space character. Though I've thought
>> >> > about this for a bit and have come to the conclusion that this is an
>> >> > editor issue. An editor could, if it wanted to, differentiatte between
>> >> > the two, for example by highlighting the backslashed newline using a
>> >> > different background color.
>> >> >
>> >> > I guess an otherwise rather sane syntax should not be punished because
>> >> > editors are stupid.
>>
>> A much bigger problem IMO is that fish doesn't parse \\, and to add
>> compatibility you'd basically need a full \ parser (you'd at least
>> need to understand \ EOL and \\, at which point you might as well add
>> \n \t \b \r \0xx \xxx etc.).
>
> ?
>
> Fish _does_ have a \ parser. \n, \t, \\ and friends all work, as do
> \$, \{, \% \(, and other characters used for argument expansion. Fish
> even supports \xXX, \oOOO, \uXXXX, etc for arbitrary symbols, e.g.
> 'echo \u2026' writes out an unicode ellipsis character to stdout.
Ahh, I had tried it with quotes Ie. "a\nb" and even "a\"b" (which is
a syntax error) ... and tr does \ processing itself, so I just assumed
the rest.
> Actually, though, one of the above _is_ missing, namely \0. Fish
> internally uses null-terminated strings, it would take a bit of work
> to handle \0 correctly, though I suppose that this should be done.
http://www.and.org/vstr/security ;)
Also note that \000 is just the normal octal encoding though,
Ie. from the tr man page:
\NNN character with octal value NNN (1 to 3 octal digits)
>> Also, personally, I don't see:
>>
>> echo a |; cat
>>
>> ...as anymore weird than:
>>
>> echo a ;;; ;;; echo b
>
> The way I see it, (and the way fish currently sees it,
> implementation-wise) is that a newline is exactly equivalent to a ';'.
> The tokenizer (fish uses an internally implemented tokenizer since
> there is (was?) no flex-lookalike with support for wchar_t) returns
> exactly the same symbol for both, TOK_END, when either of these is
> encountered in an unquoted context. I think that this is a very sane,
> simple and intuitive way to look at things.
>
> The above code example is, as fish sees it, equivalent to
I think there's a mis-communication ... I wasn't implying that the
above should be removed but that given it does work I see no reason to
disallow |; (both work in zsh, and I've never seen people use them
... if that helps).
>> >> So why
>> >> not just make it the rule that fish discards all whitespace at the
>> >> end of a line (unless you are inside a quote or something)?
>>
>> Which would make it's behaviour different from anything else that
>> does \ processing.
>>
>> > That is an interesting idea. The benefits you outline above are
>> > desirable. The result is however somewhat unintuitive in other cases.
>> > Say that you want to replace all tabs in the output of grep with
>> > spaces. An easy way to do this would be:
>> >
>> > grep WHATEVER | tr \t \
>>
>> Even better is:
>>
>> foo | tr \t\ \\\
>
> I'm missing something here. How is this better and what would this do?
It's a better example of something bad, to see it one token (roughly)
per line:
"foo"
"|"
"tr"
"\t\ "
"\\\ "
EOL
...here the final "\\\ " would be treated as a single \ and the
previous "\t\ " would be treated as a tab followed by a space
--
James Antill -- [EMAIL PROTECTED]
http://www.and.org/and-httpd
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users