Use Levenshtein spelling suggestions in Fortran FE
authorBernhard Reutner-Fischer <aldot@gcc.gnu.org>
Thu, 19 Oct 2017 07:24:33 +0000 (09:24 +0200)
committerBernhard Reutner-Fischer <aldot@gcc.gnu.org>
Thu, 19 Oct 2017 07:24:33 +0000 (09:24 +0200)
commitbcc478b9647e2af4b715fda6676d98f1e129d16b
tree78eb982a4151306d46381aacdf1b5298544bdac2
parentfba832054d9467a296d126754cc3a5efca707bdf
Use Levenshtein spelling suggestions in Fortran FE

gcc/fortran/ChangeLog

2017-10-19  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>

* 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) <INTRINSIC_USER>: 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

2017-10-19  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>

* 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.

From-SVN: r253877
12 files changed:
gcc/fortran/ChangeLog
gcc/fortran/gfortran.h
gcc/fortran/interface.c
gcc/fortran/misc.c
gcc/fortran/resolve.c
gcc/fortran/symbol.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/spellcheck-operator.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/spellcheck-parameter.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/spellcheck-procedure_1.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/spellcheck-procedure_2.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/spellcheck-structure.f90 [new file with mode: 0644]