From: Daniel Berlin <dberlin@redhat.com>
To: Michael Elizabeth Chastain <chastain@cygnus.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [PATCH] Handle comments in the C expression parser
Date: Tue, 13 Feb 2001 21:30:00 -0000 [thread overview]
Message-ID: <x7n1bprfw5.fsf@dynamic-addr-83-177.resnet.rochester.edu> (raw)
In-Reply-To: <200102140501.VAA27824@bosch.cygnus.com>
Michael Elizabeth Chastain <chastain@cygnus.com> writes:
> Hi Daniel,
>
> ! while (*lexptr != '*')
> ! lexptr++;
>
> What happens if the user opens a comment with '/*' and does not close it?
> It looks like lexptr will go off into the weeds.
Yes, I assumed they would close it.
I'll fix it.
it's a simple fix anyway, i'd rather someone review the patch assuming
that bug will be fixed (change it to while (*lexptr && *lexptr !=
'*')).
>
> Also I do not know if lexptr has access to the whole input in contiguous
> memory, or if it gets fed chunks of characters as they arrive.
It has to, it's the lexer. It's doing the tokenizing.
The parser will see and exp, then ask for the next token. We only say
"/" if it's not a /*. Otherwise, we say it's the first thing after the
comment.
That was the only use of "/" in the entire parser, (exp '/' exp). So
this is safe.
> I can do stuff like this in gdb:
>
> (gdb) print 1 + \
> 2
> $1 = 3
>
(gdb) print 1 + \
/* this is a test */ \
3
$1 = 4
(gdb)
(gdb) print 1 + \
/* this is \
a test \
of \
comments \
*/ 3
$2 = 4
(gdb)
:)
Push up, after typing that in, and see what your line got transformed into.
> On the design level, I am not opposed to adding in C style comments
> in a C parser. But I am skeptical about the planned use for:
>
> break 'Foo::Foo /* base */ (int)'
>
> ... which is what I presume you are working towards.
Not in particular, I added it when someone suggested that, and wanted
to get it into the tree before it became a casualty of bitrot on one
of my trees, like the ternary search tree stuff i have that helps
demangled minsym lookups, and demangled name lookups, and memory
usage, a *ton*.
:)
next prev parent reply other threads:[~2001-02-13 21:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-02-13 21:01 Michael Elizabeth Chastain
2001-02-13 21:30 ` Daniel Berlin [this message]
-- strict thread matches above, loose matches on Subject: below --
2001-02-13 22:50 Michael Elizabeth Chastain
2001-02-13 22:49 Michael Elizabeth Chastain
2001-02-13 22:09 Michael Elizabeth Chastain
2001-02-13 22:25 ` Daniel Berlin
2001-02-13 21:43 Michael Elizabeth Chastain
2001-02-13 22:03 ` Daniel Berlin
2001-02-13 20:07 Daniel Berlin
2001-02-13 23:28 ` Eli Zaretskii
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=x7n1bprfw5.fsf@dynamic-addr-83-177.resnet.rochester.edu \
--to=dberlin@redhat.com \
--cc=chastain@cygnus.com \
--cc=gdb-patches@sources.redhat.com \
/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