* 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
* Re: Wrapping \type{}
2004-05-29 23:20 Wrapping \type{} Nikolai Weibull
@ 2004-06-01 18:33 ` Hans Hagen
2004-06-01 21:24 ` Nikolai Weibull
0 siblings, 1 reply; 8+ messages in thread
From: Hans Hagen @ 2004-06-01 18:33 UTC (permalink / raw)
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:
>
><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
\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
<regex>: <branch> ; <branch>, "|", <regex>.
\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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Wrapping \type{}
2004-06-01 18:33 ` Hans Hagen
@ 2004-06-01 21:24 ` Nikolai Weibull
2004-06-23 11:40 ` Patrick Gundlach
0 siblings, 1 reply; 8+ messages in thread
From: Nikolai Weibull @ 2004-06-01 21:24 UTC (permalink / raw)
* Hans Hagen <pragma@wxs.nl> [Jun 01, 2004 21:20]:
> \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
> <regex>: <branch> ; <branch>, "|", <regex>.
> \stopBNF
>
> \stoptext
>
> (cross your fingers that this does not interfere with reading files, but
> normally < > " are taken care of)
It actually worked! Thank you so much for the example. I'll probably
rewrite my module a bit to work more like your example above actually,
but it even worked in the context of my module. Wow, this really saved
my ass.
> 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).
Yeah, I was thinking of that actually, but didn't realize it as a
possibility until I'd written a lot of code...guess I should rethink
now.
Thank you Hans,
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
* Re: Wrapping \type{}
2004-06-01 21:24 ` Nikolai Weibull
@ 2004-06-23 11:40 ` Patrick Gundlach
2004-06-23 18:15 ` Nikolai Weibull
0 siblings, 1 reply; 8+ messages in thread
From: Patrick Gundlach @ 2004-06-23 11:40 UTC (permalink / raw)
Nikolai Weibull <context-list@pcppopper.org> writes:
[...]
>> \startBNF
>> <regex>: <branch> ; <branch>, "|", <regex>.
>> \stopBNF
[...]
> It actually worked! Thank you so much for the example. I'll probably
> rewrite my module a bit to work more like your example above
> actually,
[...]
So, did you complete your module? Is it ready for the public yet?
Patrick
--
texshow-web: http://members.ping.de:8061
ConTeXt wiki: http://members.ping.de:8062
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Wrapping \type{}
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
0 siblings, 1 reply; 8+ messages in thread
From: Nikolai Weibull @ 2004-06-23 18:15 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 596 bytes --]
* Patrick Gundlach <pg@levana.de> [Jun 23, 2004 17:12]:
> So, did you complete your module? Is it ready for the public yet?
Yes. I haven't put it anywhere yet, but here's the 0.3 version of it.
It even includes working module documentation! Read the =README for
more information.
Thank you for showing interest,
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);}
[-- Attachment #2: bnf-context-module-0.3.tar.bz2 --]
[-- Type: application/octet-stream, Size: 44244 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* BNF module (was: Wrapping \type{})
2004-06-23 18:15 ` Nikolai Weibull
@ 2004-12-02 14:27 ` Patrick Gundlach
2004-12-02 14:43 ` Nikolai Weibull
0 siblings, 1 reply; 8+ messages in thread
From: Patrick Gundlach @ 2004-12-02 14:27 UTC (permalink / raw)
Hello Nikolai,
after I loooong time I finally managed to try your bnf module. It
looks very good. And it even works with \mainlanguage[de] (it wasn't
obvious, because you use "..." as a delimiter).
Thanks for it,
Patrick
--
ConTeXt wiki: http://contextgarden.net
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: BNF module (was: Wrapping \type{})
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
0 siblings, 1 reply; 8+ messages in thread
From: Nikolai Weibull @ 2004-12-02 14:43 UTC (permalink / raw)
(Hehe, one has to love age-old threads that are still active ;-)
* Patrick Gundlach <patrick@gundla.ch> [Dec 02, 2004 15:30]:
> after I loooong time I finally managed to try your bnf module. It
> looks very good. And it even works with \mainlanguage[de] (it wasn't
> obvious, because you use "..." as a delimiter).
Thank you, I hope to make it _the_ BNF module for ConTeXt some day ;-).
About the delimiters, if you know of a better way to do this, then
please tell me, I've gone through about 3 different ways of doing this,
but the current one, using \defineactivecharacter, has worked best so
far.
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
* Re: BNF module
2004-12-02 14:43 ` Nikolai Weibull
@ 2004-12-02 14:55 ` Hans Hagen
0 siblings, 0 replies; 8+ messages in thread
From: Hans Hagen @ 2004-12-02 14:55 UTC (permalink / raw)
Nikolai Weibull wrote:
> (Hehe, one has to love age-old threads that are still active ;-)
>
> * Patrick Gundlach <patrick@gundla.ch> [Dec 02, 2004 15:30]:
>
>>after I loooong time I finally managed to try your bnf module. It
>>looks very good. And it even works with \mainlanguage[de] (it wasn't
>>obvious, because you use "..." as a delimiter).
>
>
> Thank you, I hope to make it _the_ BNF module for ConTeXt some day ;-).
> About the delimiters, if you know of a better way to do this, then
> please tell me, I've gone through about 3 different ways of doing this,
> but the current one, using \defineactivecharacter, has worked best so
> far.
i haven't looked into it but since it's a language, i can imagine that you
misuse that fact: \language[bnf] or so, since languages can have specifics
(active things) and encodings associated; you just don't have patterns then
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
^ 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).