From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Sat, 7 Sep 2013 09:52:13 -0400 To: 9fans@9fans.net Message-ID: <3caa188579ff2a78ca7f01d49ae68690@kw.quanstro.net> In-Reply-To: <522AE229.5070603@gmx.de> References: <12773354.WkoI8jKRLR@coil> <522AE229.5070603@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] p9p mk(1) syntax Topicbox-Message-UUID: 7bbf74d8-ead8-11e9-9d60-3106f5b1d025 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;