9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] minor glitch with free carets
@ 1999-06-10 16:01 Tom
  0 siblings, 0 replies; 8+ messages in thread
From: Tom @ 1999-06-10 16:01 UTC (permalink / raw)


On Jun 10, 10:04am, Elliott Hughes wrote:
> Subject: Re:  [9fans] minor glitch with free carets
> with Byron's rc:
>
> % echo while'b'
> whileb

I spoke to Rob Pike yesterday and mentioned that I thought
that free carets were the single stupidest thing in rc.
Don't use them.  Take them out of the code.  (Apparently
I always knew this.  There's a comment in the code where
this is implemented that uses the word `embarassing.')

BTW, the bug is on line 318 of /sys/src/cmd/rc/lex.c:

	if(t->type!=WORD) lastword=0;

I think that changing this to

	lastword=0;

fixes it (I don't have a plan 9 machine, so I can't test it.)
d


--
Tom Duff.  If UNIX is the great novel, Perl is the Cliff's Notes.




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

* [9fans] minor glitch with free carets
@ 1999-08-26 18:46 rob
  0 siblings, 0 replies; 8+ messages in thread
From: rob @ 1999-08-26 18:46 UTC (permalink / raw)


i'm glad you fixed this, but please pass changes to such
central services past me beforehand.  rc is not well enough
understood to be edited at will, and much depends on its
consistent behavior.





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

* [9fans] minor glitch with free carets
@ 1999-08-26 18:20 Russ
  0 siblings, 0 replies; 8+ messages in thread
From: Russ @ 1999-08-26 18:20 UTC (permalink / raw)


	i just got bitten by this...

	% echo a'b'
	ab
	% echo fn
	fn
	% echo fn'b'
	fn b
	% 

A fix is to change the word: production in /sys/src/cmd/rc/syn.y from
	word:	keyword			{$1->type=WORD;}
to
	word:	keyword			{lastword=1; $1->type=WORD;}

And you'll have to add "int lastword;" to rc.h
so that lex.c's lastword is visible.

Russ




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

* [9fans] minor glitch with free carets
@ 1999-06-10 16:40 James
  0 siblings, 0 replies; 8+ messages in thread
From: James @ 1999-06-10 16:40 UTC (permalink / raw)


> i just got bitten by this...
>
> % echo a'b'
> ab
> % echo fn
> fn
> % echo fn'b'
> fn b
> %

Interesting -- it works under the unix rc:

    #aubrey:$h
    ;  echo a'b'
    ab
    #aubrey:$h
    ; echo fn'b'
    fnb
    #aubrey:$h
    ;




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

* [9fans] minor glitch with free carets
@ 1999-06-10 16:25 Tom
  0 siblings, 0 replies; 8+ messages in thread
From: Tom @ 1999-06-10 16:25 UTC (permalink / raw)


> BTW, the bug is on line 318 of /sys/src/cmd/rc/lex.c:
>
> 	if(t->type!=WORD) lastword=0;
>
> I think that changing this to
>
> 	lastword=0;
>
> fixes it (I don't have a plan 9 machine, so I can't test it.)
Bah!  This doesn't work.  (Rob tested it for me, thanks!)
There's no easy fix.  Put a note in the BUGS section.

--
Tom Duff.  If UNIX is the great novel, Perl is the Cliff's Notes.




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

* [9fans] minor glitch with free carets
@ 1999-06-10  8:04 Elliott
  0 siblings, 0 replies; 8+ messages in thread
From: Elliott @ 1999-06-10  8:04 UTC (permalink / raw)


with Byron's rc:

% echo while'b'
whileb

does this mean we need an extra line in BUGS section
of Byron's rc's man page?

;-)

--
"Act Swiss. Be Global." -- ABB Werbung, 1999.




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

* [9fans] minor glitch with free carets
@ 1999-06-09 14:57 rob
  0 siblings, 0 replies; 8+ messages in thread
From: rob @ 1999-06-09 14:57 UTC (permalink / raw)


Yes, this appears to happen when the word is a keyword:

% echo while'b'
while b
% echo fn'b'
fn b
%

I can't get very excited about it.  As a matter of habit,
I have learned to put the carets in.

-rob




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

* [9fans] minor glitch with free carets
@ 1999-06-09 13:32 rog
  0 siblings, 0 replies; 8+ messages in thread
From: rog @ 1999-06-09 13:32 UTC (permalink / raw)


i just got bitten by this...

% echo a'b'
ab
% echo fn
fn
% echo fn'b'
fn b
%




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

end of thread, other threads:[~1999-08-26 18:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-10 16:01 [9fans] minor glitch with free carets Tom
  -- strict thread matches above, loose matches on Subject: below --
1999-08-26 18:46 rob
1999-08-26 18:20 Russ
1999-06-10 16:40 James
1999-06-10 16:25 Tom
1999-06-10  8:04 Elliott
1999-06-09 14:57 rob
1999-06-09 13:32 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).