From: Philipp Gesang <gesang@stud.uni-heidelberg.de>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: [mkvi] comment handling bug
Date: Mon, 14 May 2012 15:59:59 +0200 [thread overview]
Message-ID: <20120514135959.GC13838@phlegethon> (raw)
In-Reply-To: <20120514132238.GB13838@phlegethon>
[-- Attachment #1.1: Type: text/plain, Size: 2829 bytes --]
On 2012-05-14 15:22, Philipp Gesang wrote:
> On 2012-05-14 09:35, Hans Hagen wrote:
> > On 13-5-2012 13:12, Philipp Gesang wrote:
> > >Hi all,
> > >
> > >seems the mkvi-style macros have trouble with groups in comments:
> > >
> > >········································································
> > >% macros=mkvi
> > >\def\dosomething#content{%%%<= fine with “#1”
> > > % { %%% Open unbalanced brace breaks macros.
> > >}
> > >
> > >\starttext \dosomething {foo} \stoptext
> > >········································································
> > >
> > >Fails here with:
> > >
> > > <to be read again>
> > > c
> > > l.2 \def\dosomething#c
> > > ontent{%%%<= fine with “#1”
> > >
> > >Removing the comment, closing the group or reverting to TEX-style
> > >argument numbering makes this behavior disappear.
> >
> > Indeed there are some limitations to the parser. I'll note it down
> > as low priority issue.
>
> Would it be possible to modify the comment pattern so that it
> accept initial spaces? At least it fixes my problem.
I take that back, sorry for the noise. The better solution
appears to be adding the “leadingcomment” pattern to the rule
that handles balanced braces:
········································································
--- /home/laokoon/base/luat-mac.lua 2012-05-14 14:52:40.674091445 +0200
+++ luat-mac.lua 2012-05-14 15:55:50.683559201 +0200
@@ -110,7 +110,7 @@
local commenttoken = P("%")
local crorlf = S("\n\r")
-local commentline = commenttoken * ((Carg(1) * C((1-crorlf)^0))/function(strip,s) return strip and "" or s end)
+--local commentline = commenttoken * ((Carg(1) * C((1-crorlf)^0))/function(strip,s) return strip and "" or s end)
local commentline = commenttoken * ((1-crorlf)^0)
local leadingcomment = (commentline * crorlf^1)^1
local furthercomment = (crorlf^1 * commentline)^1
@@ -160,6 +160,7 @@
+ V("texcode")
+ V("braced")
+ furthercomment
+ + leadingcomment
+ nobrace
)^0
-- * rightbrace^-1, -- the -1 catches errors
········································································
Now definitions with commented-out unbalanced stuff like
\def\dosomething#content{%%% {{
% { }{{ %%
\bgroup\italic#content\egroup
}
will work too.
Philipp
[-- Attachment #1.2: Type: application/pgp-signature, Size: 198 bytes --]
[-- Attachment #2: Type: text/plain, Size: 485 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2012-05-14 13:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-13 11:12 Philipp Gesang
2012-05-14 7:35 ` Hans Hagen
2012-05-14 13:22 ` Philipp Gesang
2012-05-14 13:59 ` Philipp Gesang [this message]
2012-05-15 14:52 ` Hans Hagen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120514135959.GC13838@phlegethon \
--to=gesang@stud.uni-heidelberg.de \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).