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: > > > > > > > > > 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