From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Engster Newsgroups: gmane.emacs.devel Subject: Re: Is intellisense features integration in Emacs technically possible? Date: Wed, 22 Jan 2014 18:36:00 +0100 Message-ID: <87lhy7q5q7.fsf@engster.org> References: <1390269670.2888.14.camel@localhost.localdomain> <83zjmpf80o.fsf@gnu.org> <83vbxcfzaa.fsf@gnu.org> <87eh40fx9j.fsf@wanadoo.es> <87txcwotp2.fsf@engster.org> <87fvoghr7q.fsf@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1390412264 19887 80.91.229.3 (22 Jan 2014 17:37:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 22 Jan 2014 17:37:44 +0000 (UTC) Cc: =?iso-8859-1?Q?=D3scar?= Fuentes , emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jan 22 18:37:51 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1W61kK-000613-VP for ged-emacs-devel@m.gmane.org; Wed, 22 Jan 2014 18:37:49 +0100 Original-Received: from localhost ([::1]:36789 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W61kK-00063j-9M for ged-emacs-devel@m.gmane.org; Wed, 22 Jan 2014 12:37:48 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44800) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W61ik-0004B3-If for emacs-devel@gnu.org; Wed, 22 Jan 2014 12:36:16 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W61ie-0006YA-CP for emacs-devel@gnu.org; Wed, 22 Jan 2014 12:36:10 -0500 Original-Received: from randomsample.de ([5.45.97.173]:44760) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W61ie-0006Y6-2V for emacs-devel@gnu.org; Wed, 22 Jan 2014 12:36:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=randomsample.de; s=a; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To:Subject:Cc:To:From; bh=wUuCMmr0hK9fH9aS+0AKshdUdCY4Djg/4B7kpwJbcJ8=; b=k7Yy6VETMeCQZnbMcFn4F8+LdwY7dtssV+0wMbVrm/uEby2oDHLXDUEw/gTb5d1JMrd5onfjo23UVefHaElEWbnRL5HlgXWl/qh0NZ8me8zk62thpKiWBSkHdoWTxOq/; Original-Received: from dslc-082-083-061-166.pools.arcor-ip.net ([82.83.61.166] helo=spaten) by randomsample.de with esmtpsa (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1W61ic-0003qM-SC; Wed, 22 Jan 2014 18:36:03 +0100 In-Reply-To: <87fvoghr7q.fsf@yandex.ru> (Dmitry Gutov's message of "Wed, 22 Jan 2014 19:16:41 +0200") User-Agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3 (gnu/linux) Mail-Followup-To: Dmitry Gutov , =?iso-8859-1?Q?=D3scar?= Fuentes , emacs-devel@gnu.org X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 5.45.97.173 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:168910 Archived-At: Dmitry Gutov writes: > David Engster writes: > >>> Writing a C++ parser and semantic analyzer from scratch requires several >>> man-years of work for world-class compiler writers. >> >> You don't need a full parser. For providing completions, it is >> sufficient to parse only a small subset of the code (declarations, most >> importantly). > > You may not have to parse every line of code, but you should be able to, no? > > Otherwise, how would you know which type the variable at point has, By scanning the function's body for local variable declarations, and simply ignore everything else. The C++ grammar simply has a bunch of pretty generic expression rules without any actions, so we can skip over the uninteresting stuff. So yes, I wasn't specific enough: technically, we do parse function bodies. But practically, we ignore most of it. Of course there's a drawback that we don't fully parse the body - we might get the local context wrong, for instance. But at least from my experience it's working very well. > or the return type of the method it calls By parsing the declaration of the method. -David