9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: rog@vitanuova.com
To: 9fans@cse.psu.edu
Subject: Re: [9fans] Inferno shell
Date: Mon,  8 Jan 2007 15:37:20 +0000	[thread overview]
Message-ID: <7dad3a30eb20d372a782fa4ba0f756c7@vitanuova.com> (raw)
In-Reply-To: <a6013917637696eaea285a468964b6b6@proxima.alt.za>

[-- Attachment #1: Type: text/plain, Size: 709 bytes --]

you could do that, but it adds a fair amount of awkwardness
into the lexer; i'm not sure that's justified. rc uses ~ instead of ^
for the same reason, which i would have done in the inferno
shell, except that i wished to re-use the existing filepat module.

an alternative might be to scan the pattern before passing
to filepat, substituting [~ by [^; it would be quite simple,
just add something like the following to patquote()

	if(word[i] == '[' && i < len word - 1 && word[i+1] == '~')
		word[i+1] = '^';

although that does potentially break some existing shell scripts
and it's not clear whether ['^'b] should continue to have
the same meaning.

i'll do this if there's a consensus...

[-- Attachment #2: Type: message/rfc822, Size: 3110 bytes --]

From: lucio@proxima.alt.za
To: 9fans@cse.psu.edu
Subject: [9fans] Inferno shell
Date: Tue, 2 Jan 2007 06:43:30 +0200
Message-ID: <a6013917637696eaea285a468964b6b6@proxima.alt.za>

The Inferno shell man page says about a leading caret in a [ ] class:

	(As this character is special to the shell, it may only be
	included in a pattern if this character is quoted, as long as
	the leading [ is not quoted).

It seems to me that treating the unquoted leading string [^ as a
"token" would be a better alternative.  Would it be very difficult to
implement this rather than expect all exclusive classes to start ['^ ?
I presume it is a question of where in the parsing the [ and ^ take
precedence?

++L

      reply	other threads:[~2007-01-08 15:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-02  4:43 lucio
2007-01-08 15:37 ` rog [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7dad3a30eb20d372a782fa4ba0f756c7@vitanuova.com \
    --to=rog@vitanuova.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).