From: Eli Zaretskii <eliz@gnu.org>
To: Andreas Schwab <schwab@suse.de>
Cc: eggert@cs.ucla.edu, emacs-devel@gnu.org
Subject: Re: Help etags parse lisp.j
Date: Mon, 21 Mar 2016 18:10:41 +0200 [thread overview]
Message-ID: <83y49b6cce.fsf@gnu.org> (raw)
In-Reply-To: <mvm7fgwdrnd.fsf@hawking.suse.de> (message from Andreas Schwab on Mon, 21 Mar 2016 11:58:14 +0100)
> From: Andreas Schwab <schwab@suse.de>
> Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
> Date: Mon, 21 Mar 2016 11:58:14 +0100
>
> Paul Eggert <eggert@cs.ucla.edu> writes:
>
> > Eli Zaretskii wrote:
> >>> >Can't etags reset its parser state after a toplevel semicolon?
> >> No, evidently because it wants to support K&R function definition:
> >>
> >> void foo () int arg; { bar = arg; }
> >
> > OK, how about if it resets its state when it sees a toplevel semicolon not
> > immediately followed by "{"?
>
> void foo (a, b) int a; int b; {}
Right.
To expand on that, a K&R function definition generally looks like
this:
TYPE0 foo (arg1, arg2, arg3, ..., argN)
TYPE1 arg1;
TYPE2 arg2;
TYPE3 arg3;
...
TYPEN argN;
{
body...
}
Compare this with what we have in lisp.h:
extern Lisp_Object make_formatted_string (char *, const char *, ...)
ATTRIBUTE_FORMAT_PRINTF (2, 3);
extern Lisp_Object make_unibyte_string (const char *, ptrdiff_t);
SOMETHING;
SOMETHING-ELSE;
...
INLINE Lisp_Object
build_unibyte_string (const char *str)
{
return make_unibyte_string (str, strlen (str));
}
A tool that doesn't really parse C will have hard time discerning
between these two. In particular, by the time etags finds a top-level
semicolon not followed by a "{", it's too late, because the first
inline function (in this case, build_unibyte_string) was already
missed.
Hmm... can we use the fact that in a K&R definition, the last token
before the opening brace "{" of the body is always a semicolon? So if
there's no semi-colon there, then it's a function that needs to be
tagged? (Of course, the semicolon could be hidden behind some clever
macro, but I think we don't need to cater to such uses.)
next prev parent reply other threads:[~2016-03-21 16:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-20 17:19 Help etags parse lisp.j Eli Zaretskii
2016-03-20 17:34 ` Andreas Schwab
2016-03-20 17:59 ` Eli Zaretskii
2016-03-20 18:11 ` Help etags parse lisp.h Eli Zaretskii
2016-03-21 7:54 ` Help etags parse lisp.j Paul Eggert
2016-03-21 10:58 ` Andreas Schwab
2016-03-21 16:10 ` Eli Zaretskii [this message]
2016-03-22 12:46 ` Stefan Monnier
2016-03-22 16:24 ` Eli Zaretskii
2016-03-21 13:40 ` Stefan Monnier
2016-03-21 16:22 ` Eli Zaretskii
2016-03-21 17:40 ` Paul Eggert
2016-03-21 18:13 ` Eli Zaretskii
2016-03-21 21:28 ` John Wiegley
2016-03-22 12:25 ` Stefan Monnier
2016-03-21 18:10 ` Stefan Monnier
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=83y49b6cce.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=eggert@cs.ucla.edu \
--cc=emacs-devel@gnu.org \
--cc=schwab@suse.de \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.