ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: luigi scarso <luigi.scarso@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Bug: Segmentation fault
Date: Wed, 11 Dec 2019 09:48:57 +0100	[thread overview]
Message-ID: <CAG5iGsCPjo2C2xmO9DJUYyyhmMn0u7WhsVRJ1uo+N8LMk6bF=g@mail.gmail.com> (raw)
In-Reply-To: <6bf2d70c-b606-3833-8b91-6c84607c0f53@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1616 bytes --]

On Wed, Dec 11, 2019 at 1:28 AM Henri Menke <henrimenke@gmail.com> wrote:

> In this case I wanted to generate the thin space (\,).  My expectation
> (which worked elsewhere) was that full expansion will turn "\string\\,"
> into "\\," where the two backslashes have catcode 12 and will not be
> expanded further.  Then the Lua string will turn the escape sequence \\
> into a single backslash, therefore ending up with \, in the Lua string.
>
>


\directlua{token.set_macro("foo","\relax")}
(gdb) x/7c str
0x555559376c18: 13 '\r' 101 'e' 108 'l' 97 'a'  120 'x' 32 ' '  0 '\000'
(gdb) p lstr
$24 = 6
where \foo is
 \foo=macro:
->#!.

vs
\directlua{token.set_macro("foo",[==[\relax]==])}
(gdb) x/8c str
0x555559376ea8: 92 '\\' 114 'r' 101 'e' 108 'l' 97 'a'  120 'x' 32 ' '  0
'\000'
(gdb) p lstr
$25 = 7
\foo=macro:
->\relax .

Another example is
\directlua{token.set_macro("foo","\medskip")}\show\foo
which gives the error:   invalid escape sequence near '"^^Kskip \m'.
vs
\directlua{token.set_macro("foo",[==[\medskip]==])}\show\foo
 which gives
\foo=macro:
->\vskip \medskipamount .

Your example:
\directlua{token.set_macro("foo","\string\\,")}\show\foo
gives
(gdb) x/3c str
0x5555593765a8: 92 '\\' 44 ','  0 '\000'
(gdb) p lstr
$29 = 2
 \foo=macro:
->BAD,.

vs
\directlua{token.set_macro("foo",[==[\,]==])}\show\foo
(gdb) x/20c str
0x555559376908: 92 '\\' 109 'm' 115 's' 107 'k' 105 'i' 112 'p' 32 ' '  92
'\\'
0x555559376910: 116 't' 104 'h' 105 'i' 110 'n' 109 'm' 117 'u' 115 's' 107
'k'
0x555559376918: 105 'i' 112 'p' 32 ' '  0 '\000'
(gdb) p lstr
$31 = 19
 \foo=macro:
->\mskip \thinmuskip .


-- 
luigi

[-- Attachment #1.2: Type: text/html, Size: 2932 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2019-12-11  8:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-10 20:26 Henri Menke
2019-12-10 20:36 ` luigi scarso
2019-12-10 22:36 ` Hans Hagen
2019-12-10 23:03 ` luigi scarso
2019-12-10 23:10   ` Hans Hagen
2019-12-10 23:23     ` luigi scarso
2019-12-11  0:28       ` Henri Menke
2019-12-11  8:48         ` luigi scarso [this message]
2019-12-11  9:11         ` Hans Hagen
2019-12-11 10:57     ` luigi scarso

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='CAG5iGsCPjo2C2xmO9DJUYyyhmMn0u7WhsVRJ1uo+N8LMk6bF=g@mail.gmail.com' \
    --to=luigi.scarso@gmail.com \
    --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).