From mboxrd@z Thu Jan 1 00:00:00 1970 References: Message-Id: <355A8710-222E-45FA-9B28-6FB58565A7C2@gmail.com> From: "J. R. Mauro" To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (iPhone Mail 7A341) Date: Fri, 21 Aug 2009 09:58:59 -0400 Cc: "9fans@9fans.net" <9fans@9fans.net> Subject: Re: [9fans] Recursive structural expressions? Topicbox-Message-UUID: 5006678c-ead5-11e9-9d60-3106f5b1d025 On Aug 20, 2009, at 21:01, erik quanstrom wrote: >> Here's an example. Let's make the syntax extra pukey: @#, where # is >> 1-9, defines a `named procedure', which is the same thing as putting >> something in braces in Sam. >> >> x/.*\n/ @1{ ( @1 ) | @1 ( @1 ) ( ) | } >> > > x/re/ repeatedly sets . with matches until the input > is exhausted. so i don't think i understand your example. > how does /.*\n/{(.*\n)|.*\n(.*\n)|} match anything > but the tautological .*\n|? for example, if the input > is "line1\nline2\n", then . is in turn "line1\n" and "line2\n", > and both match .*\n|. > > where do the actions go in your example? I guess I botched the example a bit. The whole part after the @ should be in an x//, and the actions would come after. Something more complicated would allow you to match any parenthetical expression on a line and alter it, which could be useful. > > - erik >