9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: Re: [9fans] p9p mk(1) syntax
Date: Sat,  7 Sep 2013 09:52:13 -0400	[thread overview]
Message-ID: <3caa188579ff2a78ca7f01d49ae68690@kw.quanstro.net> (raw)
In-Reply-To: <522AE229.5070603@gmx.de>

On Sat Sep  7 04:23:05 EDT 2013, f.psiorz@gmx.de wrote:
> I don't think that the behavior is really unexpected ... the `{...} part
> is interpreted by mk, but not the text between the braces. You probably
> need to quote it if it contains braces itself.
>

after looking at the code, it appears to me that this is an oversight,
that does not effect bourne-shell compatabiles.  we simply need to
count the `{s and subtract the }s, and when the count reachs 0
we're done.

(it appears that ' quoting is incorrect for bourne shell compatables,
and the interpretation of \ is incorrect for rc.)

- erik

; diffy -c lex.c
/n/dump/2013/0907/sys/src/cmd/mk/lex.c:67,73 - lex.c:67,73
  static int
  bquote(Biobuf *bp, Bufblock *buf)
  {
- 	int c, line, term;
+ 	int c, line, term, depth;
  	int start;

  	line = mkinline;
/n/dump/2013/0907/sys/src/cmd/mk/lex.c:79,88 - lex.c:79,91
  			;
  	} else
  		term = '`';		/* sh style */
+ 	depth = 1;

  	start = buf->current-buf->start;
  	for(;c > 0; c = nextrune(bp, 0)){
- 		if(c == term){
+ 		if(term == '}' && c == '`')
+ 			depth++;
+ 		if(c == term && --depth == 0){
  			insert(buf, '\n');
  			insert(buf,0);
  			buf->current = buf->start+start;



  reply	other threads:[~2013-09-07 13:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-06 11:03 dexen deVries
2013-09-07  8:22 ` Friedrich Psiorz
2013-09-07 13:52   ` erik quanstrom [this message]
2013-09-07 15:05     ` cinap_lenrek
2013-09-07 16:18       ` dexen deVries
2013-09-07 16:21       ` erik quanstrom
2013-09-09  4:30         ` arisawa
2013-09-09 12:37           ` erik quanstrom
2013-09-06 14:37 dexen deVries

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=3caa188579ff2a78ca7f01d49ae68690@kw.quanstro.net \
    --to=quanstro@quanstro.net \
    --cc=9fans@9fans.net \
    /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).