From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/15291 Path: main.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: Wrapping \type{} Date: Tue, 01 Jun 2004 20:33:41 +0200 Sender: ntg-context-admin@ntg.nl Message-ID: <6.1.1.1.2.20040601203125.07daf140@server-1> References: <20040529232021.GA3268@puritan.pcp.ath.cx> Reply-To: ntg-context@ntg.nl NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Trace: sea.gmane.org 1086117020 25774 80.91.224.253 (1 Jun 2004 19:10:20 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 1 Jun 2004 19:10:20 +0000 (UTC) Original-X-From: ntg-context-admin@ntg.nl Tue Jun 01 21:10:14 2004 Return-path: Original-Received: from ref.vet.uu.nl ([131.211.172.13] helo=ref.ntg.nl) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BVEeL-0001H3-00 for ; Tue, 01 Jun 2004 21:10:13 +0200 Original-Received: from ref.ntg.nl (localhost.localdomain [127.0.0.1]) by ref.ntg.nl (Postfix) with ESMTP id 0570D10B5C; Tue, 1 Jun 2004 21:05:19 +0200 (MEST) Original-Received: from mailrelay02.solcon.nl (maillb.solcon.nl [212.45.32.200]) by ref.ntg.nl (Postfix) with ESMTP id 55AB410B4C for ; Tue, 1 Jun 2004 21:00:41 +0200 (MEST) Original-Received: from server-1.pragma-net.nl (dsl-212-84-128-085.solcon.nl [212.84.128.85]) by mailrelay02.solcon.nl (8.12.11/SQL-8.12.11-5/8.12.11) with ESMTP id i51J5S4Q024971 for ; Tue, 1 Jun 2004 21:05:28 +0200 Original-Received: by server-1.pragma-net.nl (Postfix, from userid 65534) id 7B69B2197D; Tue, 1 Jun 2004 21:05:31 +0200 (CEST) Original-Received: from laptop-3.wxs.nl (unknown [10.100.1.191]) by server-1.pragma-net.nl (Postfix) with ESMTP id B6A191B2AE for ; Tue, 1 Jun 2004 19:05:24 +0000 (UTC) X-Sender: hagen-mail@server-1 X-Mailer: QUALCOMM Windows Eudora Version 6.1.1.1 Original-To: ntg-context@ntg.nl In-Reply-To: <20040529232021.GA3268@puritan.pcp.ath.cx> Original-References: <20040529232021.GA3268@puritan.pcp.ath.cx> X-Virus-Scanned: clamd / ClamAV version 0.70, clamav-milter version 0.70j Errors-To: ntg-context-admin@ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.0.13 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.comp.tex.context:15291 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:15291 At 01:20 30/05/2004, you wrote: >In my BNF module I use " as an active character that begins and ends >terminals in the grammar: > >: ; , "\|", . > >Now, the above doesn't quite work as written, as \ is still active (and >so is, in fact | as we're really inside a \starttabulate. > >What I would like for the "" pair to do is work as a wrapper for >\type{}, so that everything in-between is passed on to \type{}. >Is there a way of getting them to do that? > >This is my current definition: > >\gdef"% > {\ifBNFoutsidestring% > \global\BNFoutsidestringfalse% > \begingroup% > \BNFunsetcatcodes% > \catcode`\"\@@active% > \@@bnfterminalstart% > \else% > \@@bnfterminalstop% > \endgroup% > \global\BNFoutsidestringtrue% > \fi} > >I figured something like > >\long\gdef"#1"% > {\type{#1}} > >might work, but it didn't. It chokes on "." where . is also an >activated character for terminating a production in the grammar. > >Any suggestions on how to go about this? I mean, the obvious solution >is simply to write > >: ; , "\type{\|}", . > >instead, but I would like to keep the input as clean as possible. > nikolai \definestartstop[BNF][before=\startlines\setups{myBNF},after=\stoplines] \startsetups[myBNF] \defineactivecharacter " {\bgroup\tttf\setupinlineverbatim\defineactivecharacter " {\egroup}} \defineactivecharacter < {\mathematics{\string<}} \defineactivecharacter > {\mathematics{\string>}} \stopsetups \starttext \startBNF : ; , "|", . \stopBNF \stoptext (cross your fingers that this does not interfere with reading files, but normally < > " are taken care of) an alternative is to write a plugin forthe verbatim environment (see verb-ini to get an idea of what nasty things are involved with catcode changes). Hans