]> code.delx.au - gnu-emacs-elpa/log
gnu-emacs-elpa
12 years agoFix bug in parsing of dimension specifications
Lawrence Mitchell [Tue, 13 Sep 2011 16:42:29 +0000 (17:42 +0100)]
Fix bug in parsing of dimension specifications

A line of the form

  type(foo) :: foo(:,:)

would have the type and the modifiers in the wrong order:

  ("foo" ("dimension" . 2) "type(foo)")

rather than:

  ("foo" "type(foo)" ("dimension" . 2))

Introduce a test to exercise this case and fix it by appending the
dimension modifier to the type rather than pushing it on the front.

12 years agoCatch errors when evaluating a test form
Lawrence Mitchell [Tue, 13 Sep 2011 16:41:49 +0000 (17:41 +0100)]
Catch errors when evaluating a test form

12 years agoPopulate completion table lazily
Lawrence Mitchell [Tue, 13 Sep 2011 16:40:40 +0000 (17:40 +0100)]
Populate completion table lazily

Rather than prepopulating the completion table when invoking M-., do
so lazily when the user asks for a completion candidate.

12 years agoSet syntax table correctly in f90-arglist-types
Lawrence Mitchell [Tue, 13 Sep 2011 16:40:00 +0000 (17:40 +0100)]
Set syntax table correctly in f90-arglist-types

12 years agoRemove unused function f90-match-arglist-to-specialisers
Lawrence Mitchell [Tue, 13 Sep 2011 16:38:51 +0000 (17:38 +0100)]
Remove unused function f90-match-arglist-to-specialisers

12 years agoNew function to parse all files in a tree
Lawrence Mitchell [Mon, 18 Jul 2011 14:54:28 +0000 (15:54 +0100)]
New function to parse all files in a tree

Add a new interactive function that prompts for the top of a directory
tree to recurse into to look for Fortran files to parse.

12 years agoNew variable specifying what file extensions are Fortran 90 code
Lawrence Mitchell [Mon, 18 Jul 2011 14:49:37 +0000 (15:49 +0100)]
New variable specifying what file extensions are Fortran 90 code

Rather than hardcoding the regexp for .F90, .f90 and .fpp, add a new
variable `f90-file-extensions', a list of possible extensions that
match Fortran 90 files.  While we're at it, add a customisation group
to pull user options together.

12 years agoMinor optimisation to f90-normalise-string
Lawrence Mitchell [Mon, 18 Jul 2011 14:47:02 +0000 (15:47 +0100)]
Minor optimisation to f90-normalise-string

Separately try and match for whitespace at the beginning and end of
strings.  This makes the regexp simpler and can speed things up a bit.

12 years agoIgnore refcount templates when parsing interfaces
Lawrence Mitchell [Mon, 18 Jul 2011 14:46:13 +0000 (15:46 +0100)]
Ignore refcount templates when parsing interfaces

12 years agoAdd test framework and some unit tests
Lawrence Mitchell [Mon, 18 Jul 2011 11:04:20 +0000 (12:04 +0100)]
Add test framework and some unit tests

12 years agoSpeed up f90-split-arglist
Lawrence Mitchell [Mon, 18 Jul 2011 11:04:20 +0000 (12:04 +0100)]
Speed up f90-split-arglist

Previously we inserted the arglist into a temporary buffer and split
it there.  Since we're just using that to loop over the characters in
the string one at a time, do it in place by looping across the
characters of the array.  This latter method takes around 70% less
time than the former.  Since we split arglists thousands of times when
parsing a source tree, this is a worthwhile optimisation.

12 years agoMake dimension parsing more robust
Lawrence Mitchell [Fri, 15 Jul 2011 22:07:38 +0000 (23:07 +0100)]
Make dimension parsing more robust

Allow for whitespace in a "dimension(...)" declaration, and move the
parsing of TYPE :: foo(:) style dimension declarations into
f90-parse-single-type-declaration, rather than having it in
f90-make-type-struct.  This way argument matching when looking for
tags works better.

12 years agoDon't stomp on match data when normalising strings
Lawrence Mitchell [Fri, 15 Jul 2011 21:32:56 +0000 (22:32 +0100)]
Don't stomp on match data when normalising strings

f90-normalise-string needs to look for whitespace, but shouldn't
destroy the match-data, so wrap the body in save-match-data.

12 years agoIf no tags are loaded don't try and use tags completion
Lawrence Mitchell [Thu, 14 Jul 2011 15:18:08 +0000 (16:18 +0100)]
If no tags are loaded don't try and use tags completion

12 years agoCorrectly determine dimension specification
Lawrence Mitchell [Tue, 12 Jul 2011 14:51:46 +0000 (15:51 +0100)]
Correctly determine dimension specification

Previously, if we had a dimension spec like dimension(:, max(1, 10))
we thought the variable had rank 3.  Now we only count top-level
commas and correctly determine that it is rank 2.

12 years agoDefault to type-at-point in f90-show-type-definition
Lawrence Mitchell [Tue, 12 Jul 2011 14:32:25 +0000 (15:32 +0100)]
Default to type-at-point in f90-show-type-definition

Rather than just providing a completion table, try and guess a default
by looking for a type declaration on the current line, or (if that
fails) deriving the type of the variable at point.

12 years agoSpeed up f90-clean-comments
Lawrence Mitchell [Tue, 12 Jul 2011 12:10:13 +0000 (13:10 +0100)]
Speed up f90-clean-comments

Rather than moving through the buffer one character at a time, search
forward for a possible comment start (a ! character) and then use
parse-partial-sexp to decide if we're actually in a comment or not.

It turns out most of the time in parsing was actually cleaning
comments, so this makes the code run significantly faster overall.

12 years agoParse prefix arg through to find-tag from f90-find-tag-interface
Lawrence Mitchell [Tue, 12 Jul 2011 12:07:31 +0000 (13:07 +0100)]
Parse prefix arg through to find-tag from f90-find-tag-interface

If we're searching for a tag, rather than an interface we need to pass
the prefix arg through so that the find-tag invocation can jump to
subsequent definitions.

12 years agoRequire etags and cl at runtime
Lawrence Mitchell [Tue, 12 Jul 2011 12:06:24 +0000 (13:06 +0100)]
Require etags and cl at runtime

Since we create structs on the fly, we need cl at runtime, not just
compile time.  We need etags because we push things on to
find-tag-marker-ring which is not autoloaded.

12 years agoDocument INVOCATION-POINT argument to f90-browse-interface-specialisers
Lawrence Mitchell [Mon, 11 Jul 2011 16:01:33 +0000 (17:01 +0100)]
Document INVOCATION-POINT argument to f90-browse-interface-specialisers

12 years agoAdd more suffixes for likely Fortran files
Lawrence Mitchell [Mon, 11 Jul 2011 15:53:46 +0000 (16:53 +0100)]
Add more suffixes for likely Fortran files

Rather than just looking for .F90, also look for .f90 and .fpp.

12 years agoFix bug in f90-populate-specialisers
Lawrence Mitchell [Mon, 11 Jul 2011 15:51:16 +0000 (16:51 +0100)]
Fix bug in f90-populate-specialisers

If an interface had multiple "module procedure" lines, we would only
add the final line to the interface's specialisers.  Fix this by
initialising the specialisers hash table outside the search loop.

12 years agoHook into pop-tag-mark machinery when visiting definitions
Lawrence Mitchell [Mon, 11 Jul 2011 15:48:47 +0000 (16:48 +0100)]
Hook into pop-tag-mark machinery when visiting definitions

Make f90-find-definition behave more like find-tag by pushing the
invocation point onto find-tag-marker-ring when we visit a
definition.

12 years agoAllow f90-find-tag-interface to complete tags names
Lawrence Mitchell [Mon, 11 Jul 2011 14:10:13 +0000 (15:10 +0100)]
Allow f90-find-tag-interface to complete tags names

When binding f90-find-tag-interface to M-. we want to be able to
complete tag names (for find-tag) as well as interface names.  So
merge the tags completion table with the interface name completion
table.

12 years agoFix jumping to definitions if we jump past recorded location
Lawrence Mitchell [Mon, 11 Jul 2011 13:49:25 +0000 (14:49 +0100)]
Fix jumping to definitions if we jump past recorded location

In some cases, the cached location of a specialiser might be past the
definition, in this case we need to search backwards for the beginning
of the definition if we can't find it looking forwards.

12 years agoFix f90-get-slot-type for new struct definition
Lawrence Mitchell [Mon, 11 Jul 2011 13:35:51 +0000 (14:35 +0100)]
Fix f90-get-slot-type for new struct definition

12 years agoFix byte-compilation
Lawrence Mitchell [Mon, 11 Jul 2011 11:41:15 +0000 (12:41 +0100)]
Fix byte-compilation

Move inlineable functions before their use.  Change
f90-make-type-struct from a macro to a function (so we can eval its
result).

In addition, add "-varnames" slot to type structs so we don't have to
work the entire obarray when we want to show a type definition.

12 years agoDocstring fixes
Lawrence Mitchell [Mon, 11 Jul 2011 11:05:30 +0000 (12:05 +0100)]
Docstring fixes

12 years agoAdd function to show the parsed type definition
Lawrence Mitchell [Mon, 11 Jul 2011 10:47:18 +0000 (11:47 +0100)]
Add function to show the parsed type definition

This allows us to see all the slot names (although without the
documentation the actual sources have).

12 years agoNormalise type-parsing routines and make arglist matching work
Lawrence Mitchell [Mon, 11 Jul 2011 09:53:16 +0000 (10:53 +0100)]
Normalise type-parsing routines and make arglist matching work

We now correctly match types in parsed arglists even in the case of
slot accesses.  Function calls and array accesses are still not
handled (we just pass UNION-TYPE through).  But, we do get some more
specialisation.  For example with some type definitions:

 type foo
   type(bar) :: slot
 end type foo

 type bar
   real, dimension(:), pointer :: n=>null()
 end type bar

and some code:

  type(foo) :: foo
  integer, dimension(10) :: x

  call some_function(x%slot, x%slot%n, x(1))

we derive the types of the arguments as:

 type(bar); real, dimension(:), pointer; UNION-TYPE

which is significantly better than the previous:

 UNION-TYPE; UNION-TYPE; UNION-TYPE

12 years agoFurther work on type parsing
Lawrence Mitchell [Sat, 9 Jul 2011 21:10:32 +0000 (22:10 +0100)]
Further work on type parsing

We're now able to correctly determine argument types that specify
slots of derived types.  This allows us to be better at specifying
subsets of the available interfaces.  Needs more work on the approx
arglist matching code to be really useful.

12 years agoWhitespace fixes
Lawrence Mitchell [Fri, 8 Jul 2011 23:21:51 +0000 (00:21 +0100)]
Whitespace fixes

12 years agoAdd sketch of type definition parsing
Lawrence Mitchell [Fri, 8 Jul 2011 22:47:49 +0000 (23:47 +0100)]
Add sketch of type definition parsing

We can now parse a derived type definition into its component slots
and produce a lisp struct mapping on to it. For example with a type
definition of:

 type foo
    integer, dimension(:), pointer :: n=>null()
    real, dimension(:, :), allocatable :: p
    character :: char
    integer :: len
 end type foo

We produce a struct defined by:

 (defstruct f90-type.foo
   (n '("integer" ("dimension" . 1) "pointer") :read-only t)
   (p '("real" ("dimension" . 2) "allocatable") :read-only t)
   (char '("character") :read-only t)
   (len '("integer") :read-only t)

The aim of this is to do better argument type derivation.  So that if
we have:

 ...
 type(foo) :: a
 ...
 call add(a%len)

we can figure out that add is being called with an integer argument.

12 years agoRequire thingatpt (for word-at-point)
Lawrence Mitchell [Fri, 8 Jul 2011 13:54:28 +0000 (14:54 +0100)]
Require thingatpt (for word-at-point)

12 years agoFix setting of public/private attribute on interfaces
Lawrence Mitchell [Fri, 8 Jul 2011 13:49:17 +0000 (14:49 +0100)]
Fix setting of public/private attribute on interfaces

12 years agoAdd more function documentation
Lawrence Mitchell [Fri, 8 Jul 2011 13:49:07 +0000 (14:49 +0100)]
Add more function documentation

12 years agoInitial commit
Lawrence Mitchell [Fri, 8 Jul 2011 13:25:57 +0000 (14:25 +0100)]
Initial commit