9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Inferno shell
@ 2007-01-02  4:43 lucio
  2007-01-08 15:37 ` rog
  0 siblings, 1 reply; 2+ messages in thread
From: lucio @ 2007-01-02  4:43 UTC (permalink / raw)
  To: 9fans

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



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [9fans] Inferno shell
  2007-01-02  4:43 [9fans] Inferno shell lucio
@ 2007-01-08 15:37 ` rog
  0 siblings, 0 replies; 2+ messages in thread
From: rog @ 2007-01-08 15:37 UTC (permalink / raw)
  To: 9fans

[-- 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-01-08 15:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-02  4:43 [9fans] Inferno shell lucio
2007-01-08 15:37 ` rog

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).