From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 86651 invoked by alias); 19 Oct 2017 07:51:10 -0000 Mailing-List: contact fortran-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: fortran-owner@gcc.gnu.org Received: (qmail 86627 invoked by uid 89); 19 Oct 2017 07:51:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-7.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_2,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=Janne, U*aldot, aldotgccgnuorg, sk:aldot@g X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-wr0-f178.google.com Received: from mail-wr0-f178.google.com (HELO mail-wr0-f178.google.com) (209.85.128.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 19 Oct 2017 07:51:08 +0000 Received: by mail-wr0-f178.google.com with SMTP id p46so7324315wrb.0; Thu, 19 Oct 2017 00:51:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=c6iPVw522XXDYWGLETRCUJsV4/T25mIKfGmw6eh7g6c=; b=P24+1OUKK8A2yK8GMTKAOdyE05EFztTg8AMjpXjgN4oKN6PjhdJBdJA5RAWkXaBM9R ehrnML7WuY4lh/8fm+2DDgS5mDH+DJBsSdScvvgu35xswAsISm1uadTRDsKnObLHgRdN cVttpZtHnOja/s0cO8KYafAf89WCScELngp93Fpb+DTnXikYCoB9Omy5ljNSfn5sEnE4 pfkPg3NYxVhaBEQOqzXcrdvvloET5a8AOcuhcdM6FgGj+N6krTRrY1ttRxVUsYT/grP3 OH2J/gDbS4dY3p0ZS9ru46HqCAU4JPzC8LvEncQRV389/sR6hc+xWug99XfrvHX6e+9Z OeqQ== X-Gm-Message-State: AMCzsaUJ9fxEDyAU1kVEfCRNOj7kUESnEZGue+D8MsnWFI5YR9jqiiBl QAG0bFU4rCZogi+LE9vcgFByzg== X-Google-Smtp-Source: ABhQp+RCmIpcQo9V41I9ZSDlUbbU0gKHsG1iweCy/nzO1eT2aAQbBCb/9JzG35Ra3egAfyYrkgfKCQ== X-Received: by 10.223.157.136 with SMTP id p8mr741367wre.28.1508399465488; Thu, 19 Oct 2017 00:51:05 -0700 (PDT) Received: from nbbrfq.cc.univie.ac.at (91-119-106-232.dsl.dynamic.surfer.at. [91.119.106.232]) by smtp.gmail.com with ESMTPSA id 68sm957195wmh.2.2017.10.19.00.51.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Oct 2017 00:51:04 -0700 (PDT) Date: Thu, 19 Oct 2017 07:51:00 -0000 From: Bernhard Reutner-Fischer To: fortran@gcc.gnu.org Cc: gcc-patches@gcc.gnu.org, David Malcolm , VandeVondele Joost Subject: Re: [PATCH, fortran, v4] Use Levenshtein spelling suggestions in Fortran FE Message-ID: <20171019075102.upre76kdh6mzoej6@nbbrfq.cc.univie.ac.at> References: <1461604041.4417.14.camel@redhat.com> <1466279927-9661-1-git-send-email-rep.dot.nop@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1466279927-9661-1-git-send-email-rep.dot.nop@gmail.com> User-Agent: NeoMutt/20170609 (1.8.3) X-IsSubscribed: yes X-SW-Source: 2017-10/txt/msg00082.txt.bz2 [forgot to CC gcc-patches] On Sat, Jun 18, 2016 at 09:58:47PM +0200, Bernhard Reutner-Fischer wrote: > Hi, > > Ok for trunk? This was ACKed about a year ago by Janne and Jerry and since there were no objections in the meantime i've installed this first step towards providing spelling suggestions in the fortran FE as r253877. cheers, > > Changes for v4 -> v3: > > - rebased > - Use 4 argument levenshtein_distance() to save multiple strlen(typo) > calls as suggested by dmalcolm > > Changes for v2 -> v3: > > - rebased > > Changes for v1 -> v2: > > - subroutines using interfaces > - keyword arguments (named parameters) > > Rewrite C++ autovec in plain C. > Factor out levenshtein distance handling into a commonly used > gfc_closest_fuzzy_match(). > > gcc/fortran/ChangeLog > > 2015-12-27 Bernhard Reutner-Fischer > > * gfortran.h (gfc_lookup_function_fuzzy): New declaration. > (gfc_closest_fuzzy_match): New declaration. > (vec_push): New definition. > * misc.c (gfc_closest_fuzzy_match): New definition. > * resolve.c: Include spellcheck.h. > (lookup_function_fuzzy_find_candidates): New static function. > (lookup_uop_fuzzy_find_candidates): Likewise. > (lookup_uop_fuzzy): Likewise. > (resolve_operator) : Call lookup_uop_fuzzy. > (gfc_lookup_function_fuzzy): New definition. > (resolve_unknown_f): Call gfc_lookup_function_fuzzy. > * interface.c (check_interface0): Likewise. > (lookup_arg_fuzzy_find_candidates): New static function. > (lookup_arg_fuzzy ): Likewise. > (compare_actual_formal): Call lookup_arg_fuzzy. > * symbol.c: Include spellcheck.h. > (lookup_symbol_fuzzy_find_candidates): New static function. > (lookup_symbol_fuzzy): Likewise. > (gfc_set_default_type): Call lookup_symbol_fuzzy. > (lookup_component_fuzzy_find_candidates): New static function. > (lookup_component_fuzzy): Likewise. > (gfc_find_component): Call lookup_component_fuzzy. > > gcc/testsuite/ChangeLog > > 2015-12-27 Bernhard Reutner-Fischer > > * gfortran.dg/spellcheck-operator.f90: New testcase. > * gfortran.dg/spellcheck-procedure_1.f90: New testcase. > * gfortran.dg/spellcheck-procedure_2.f90: New testcase. > * gfortran.dg/spellcheck-structure.f90: New testcase. > * gfortran.dg/spellcheck-parameter.f90: New testcase. > > --- > > David Malcolm's nice Levenshtein distance spelling check helpers > were used in some parts of other frontends. This proposed patch adds > some spelling corrections to the fortran frontend. > > Suggestions are printed if we can find a suitable name, currently > perusing a very simple cutoff factor: > /* If more than half of the letters were misspelled, the suggestion is > likely to be meaningless. */ > cutoff = MAX (strlen (typo), strlen (best_guess)) / 2; > which effectively skips names with less than 4 characters. > For e.g. structures, one could try to be much smarter in an attempt to > also provide suggestions for single-letter members/components. > > This patch covers (at least partly): > - user-defined operators > - structures (types and their components) > - functions > - symbols (variables) > > If anybody has a testcase where a spelling-suggestion would make sense > then please pass it along so we maybe can add support for GCC-7.