ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Wrapping \type{}
@ 2004-05-29 23:20 Nikolai Weibull
  2004-06-01 18:33 ` Hans Hagen
  0 siblings, 1 reply; 8+ messages in thread
From: Nikolai Weibull @ 2004-05-29 23:20 UTC (permalink / raw)


In my BNF module I use " as an active character that begins and ends
terminals in the grammar:

<regex>: <branch> ; <branch>, "\|", <regex>.

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

<regex>: <branch> ; <branch>, "\type{\|}", <regex>.

instead, but I would like to keep the input as clean as possible.
	nikolai


--
::: name: Nikolai Weibull    :: aliases: pcp / lone-star / aka :::
::: born: Chicago, IL USA    :: loc atm: Gothenburg, Sweden    :::
::: page: www.pcppopper.org  :: fun atm: gf,lps,ruby,lisp,war3 :::
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}

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

end of thread, other threads:[~2004-12-02 14:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-29 23:20 Wrapping \type{} Nikolai Weibull
2004-06-01 18:33 ` Hans Hagen
2004-06-01 21:24   ` Nikolai Weibull
2004-06-23 11:40     ` Patrick Gundlach
2004-06-23 18:15       ` Nikolai Weibull
2004-12-02 14:27         ` BNF module (was: Wrapping \type{}) Patrick Gundlach
2004-12-02 14:43           ` Nikolai Weibull
2004-12-02 14:55             ` BNF module Hans Hagen

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).