Coder Social home page Coder Social logo

language-fortran's People

Contributors

cbcoutinho avatar dparkins avatar elezar avatar jhenneberg avatar michaelkonecny avatar oyarzun avatar paulxicao avatar tomedunn avatar trihedral avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

language-fortran's Issues

'Fortran - Fixed Form' highlights after column 72

The 'Fortran - Fixed Form' grammar highlights even after column 72. And the highlight seems to depend on the particular Fortran statement.

I recommend applying the comment highlight to anything after column 72.

Thanks.

72column

Package.loadSettings is deprecated.

Store package settings files in the settings/ directory instead of scoped-properties/

Package.loadSettings (/usr/share/atom/resources/app.asar/src/package.js:584:9)
<unknown> (/usr/share/atom/resources/app.asar/src/package.js:186:43)
Package.measure (/usr/share/atom/resources/app.asar/src/package.js:165:15)
Package.load (/usr/share/atom/resources/app.asar/src/package.js:179:12)
PackageManager.loadPackage (/usr/share/atom/resources/app.asar/src/package-manager.js:372:14)
PackageManager.loadPackages (/usr/share/atom/resources/app.asar/src/package-manager.js:336:14)

auto-indent gets wrong if a line contains the word "function"

Hello,
It's been a while I'm having trouble with auto-indent in a very long module. I didn't take the time to track back the bug in language-fortran's auto-indent. Here it is! :)

Let's type this in my favorite Atom editor:

program toto
    implicit none
    real :: x
    real :: y ! no problem
    real :: z ! this line contains the word "function" in the comment.
    real :: q ! <= this is sufficient to mess the auto-indent
    real :: messy
end program toto

Now, let's apply Edit > Lines > Auto-Indent ...

program toto
    implicit none
    real :: x
    real :: y ! no problem
    real :: z ! this line contains the word "function" in the comment.
        real :: q ! <= this is sufficient to mess the auto-indent
        real :: messy
    end program toto

Now let's replace function in the declaration of z by anything else and apply again Auto-Indent ...

program toto
    implicit none
    real :: x
    real :: y ! no problem
    real :: z ! this line contains the word "anything else" in the comment.
    real :: q ! <= this is sufficient to mess the auto-indent
    real :: messy
end program toto

Conclusion

When the word function is found in a line, even if it is in a comment, then auto-indent gets wrong.

Variables names with "end" in them terminate the current block

See the attached image, where the function block is prematurely terminated due the presence of a local variable an_end.

Looking at the match rules in https://github.com/dparkins/language-fortran/blob/master/grammars/fortran%20-%20punchcard.cson, it would seem as if the end rule for the function-definition (and other blocks, program, subroutine, etc.) should include ^\\s* before the capture of (end). For example:

      'end': '(?i)^\\s*(end)(?:\\s*(\\1)(\\s+\\2)?\\b)?\\s*([^;!\\n]+)?'

image

Publishing

Could you publish this package so that it is downloadable from apm?

Highlight C preprocessor directives in .f90 files

Hi, this is more a question than an issue.. I'm new to atom. I have fortran code in files with .F90 and .f90 extension, which have some C preprocessor directives. These look like

define CVAR 1

ifdef CVAR

Some Fortran code...

endif

for example. I see that code between # symbols is left of color white in atom with the language-fortran package.
So, my question is: can we highlight with a particular color (say red) all lines that start with the symbol # (i.e. preprocessor directives) and leave the fortran code inside preprocessor conditionals with its usual colors?

Thank you!

Marcos

`type` variable confuse syntax highlighting

A variable called type confused syntax highlighting when assigned from a fucntion call, but not when assign from a literal.
syntax highlighting error

(I discovered with this that type is not a reserved word. Fortran parsing must be so hard ...)

Auto-Indent Loop termination

There seems to be an issue with loop indentation. In emacs:

do i = 1, Ntot
    ...
end do

In atom using this package:

do i = 1, Ntot
    ...
    end do 

This seems to be at least for if and do loops. Not sure if it effects anything else.

Missing highlight

I'm having some problems with the 'do concurrent' statement
do concurrent (i=1:n)
! code here
end do
the 'concurrent' part has no highlight.

I'm also having problem with the following lines:

interface setGaussLegendre
module procedure setGaussLegendre01, setGaussLegendreAB
end interface setGaussLegendre

I always get a highlighted 'end' inside the 'setGaussLegendre01'.

Thanks!

Folding code doesn't follow program structure

Atom correctly indents different statements within a module or subroutine as expected. The contain statement is also indented at the level of the procedure it is contained, which I didn't expect but I actually really like:

screenshot from 2016-10-17 23-12-11

The issue is, when folding code that contains a contain statement, the folding stops at the contain statement instead of down to where it should fold at end module. This seems to me like atom is repeating some behavior I would expect from python, where everything is progressively nested; however in Fortran that isn't the case.

See gif:

out

end if

Is it possible to disable the autocompletion of the if statement if it is proceeded by an end? Every time I type end if and hit Enter, it does the following, and then I have to undo.

endif

endif2

Un-typed variable with dimension causes atom to hang

I have found that if I have a line like this in my code (the third one in the code snippet)

implicit none
integer, parameter :: MAXITER=20,MAXJ=5
dimension g(MAXJ+1)

where the variable g has no assigned type, the atom editor will just hang, and will require a restart. It is very bad coding form, but I would like it if the formatting package didn't crash the editor. Any suggestions?

colouring of module names

Hi there, once again : a big thank for all the efforts :), especially to you @tomedunn !

Is this colouring correct?
screenshot from 2015-10-19 17 07 56

Modules names should be coloured, shouldn't they?

sub <TAB> inserting broken regex

I've just updated to the latest version of Atom. Now using the fortran bundle when I type sub :
screen shot 2015-06-05 at 17 25 47

I get this autoinsert into the document:

screen shot 2015-06-05 at 17 26 02

coloring of subroutine calls

Hi there :)

Is this coloring expected? Seems strange to me.
screenshot from 2015-10-15 18 16 07

I suspect case 1 to be incoherent with the subroutine definitions and so on.

Type bound subroutines not being highlighted in call statements

This was discussed in issue #57 which is now closed so I wanted to give it it's own issue. To summarize, subroutines called via the call statement are highlighted whether they are intrinsic or not with the exception of type bound subroutines as illustrated below

screen shot 2015-10-15 at 9 12 27 pm

Frankly I'm not sure if it's possible to make a rule that will correctly highlight these without also highlighting the variable part as well. But for now I'll just leave this issue open as a reminder.

DO construct rules not consistent with Fortran standards.

The current rules for do-constructs work perfectly well for standard modern Fortran syntax but there are two use cases missing from the older punchcard Fortran (Fortran 77) standards.

In most cases do-constructs are writen like

do i = 1, 10, 1
  ...
end do

However, one could also replace the enddo statement with a continue statement

do i = 1, 10, 1
  ...
continue

and still be correct. This change on it's own would be rather trivial to make in the rules however there is one last form of the do-construct that complicates things significantly.

The previous two examples are both forms of un-labeled do-constructs. A do-construct can also be written as a labeled do-construct, such as:

       do 99 i = 1, 10, 1
         ...
99     k = k + i

When written in this format the line terminating the loop can be almost any executable statement (including continue and end do). Furthermore multiple labeled do-constructs can terminate on the same line. For instance

       do 99 i = 1, 10, 1
         do 99 j = 2, 20, 2
           ...
99     k = k + i

where both the inner and outer loop terminate on line 99.

I've spent a little time toying around with fixed for this but I haven't come up with anything particularly satisfying that didn't involved abandoning the more structured rules approach (i.e., getting rid of the multi-line do-construct rules and replacing them with the old do/enddo keywords.

Extension of language

In the Fortran code that I develop, we use our own custom preprocessor, and I would like to extend the language-fortran syntax to add support for this, as well as our custom file extensions.

I have tried the simple "include" solution given here: http://stackoverflow.com/questions/22363070/how-do-i-make-a-default-syntax-by-filetype-in-atom-text-editor, but in this case, no highlighting works -- even if I don't yet add the support for the preprocessor directives.

What would be the correct way to go about this?

Toggle comment in fixed-form grammar

What's the way to indicate how toggle comment should work (Command-/) in fixed-form source files? Currently, Command-/ inserts C-style comments. I tried adding this to my config.cson:

".fixed.fortran.source":
  editor:
    commentStart: "^C "
    commentEnd: ""

but clearly, that's not the way to insert a C in column 1... Any ideas?

Enums are not highlighted in Fortran modern

The following code is is for an enum, which is not detected/highlighted by the grammar:

!-----------------------------------------------------------------------------------------
! Enum type definitions
!-----------------------------------------------------------------------------------------
! Return codes
  enum, bind(c)
    enumerator :: &
         METIS_OK = 1, &            ! Returned normally
         METIS_ERROR_INPUT = -2, &  ! Returned due to erroneous inputs and/or options
         METIS_ERROR_MEMORY = -3, & ! Returned due to insufficient memory
         METIS_ERROR = -4           ! Some other errors
  end enum

Deprecation warning due to the use of scoped_properties instead of setings

The Atom.io deprecation cop shows the following deprecation warning:

Store package settings files in the settings/ directory instead of scoped-properties/
Called 2 times:

Package.loadSettings - C:\Users\lezar\AppData\Local\atom\app-0.189.0\resources\app\src\package.js:565:9
<unknown> - C:\Users\lezar\AppData\Local\atom\app-0.189.0\resources\app\src\package.js:187:43

variable attributes being skipped

For some reason attributes in type definition statements are being arbitrarily skipped in some cases as shown below
image
This bug was not present in earlier versions of Atom and I believe it's a bug in first-mate possibly related to this issue. I'll see what I can do about fixing this but we may have to wait for a newer release of Atom to fix it.

Atom freezes when I start typing the word "Class"

I start typing the word "class" and it gets to "clas" and then atom freezes and the Atom Helper process consumes 100% cpu. I've narrowed it down to this package after disabling everything else and then trying them one by one. I've only been using Atom for a few days and it was working fine before and I was able to type the "Class" without issue and it just started.

It seems to affect all my .f90 files regardless of their directory. I did a fresh install of Atom, making sure to delete the app, preference files, hidden files, restarted my computer, etc and I'm still encountering this issue with no other non-default packages installed.

I'm running OSX 10.10.3, Atom 0.194.0 and language-fortran 1.5.1

`bind` statement is not formatted

Howdy @dparkins,

was just messing around with some c-bindings in atom and noticed that this package doesn't pick up the bind statement as needing some tlc. See below:

module example
  use iso_c_binding, only: c_double
  implicit none

contains

  subroutine square(a, out) bind(c) <-- See here
    real(c_double), intent(in) :: a
    real(c_double), intent(out) :: out

    out = a*a

    return
  end subroutine square

end module example

I'm not sure how this language is structured - if it is only a part of the modern grammar or if you need to include in all of them. I think we it should be included only in the modern grammar because the c-binding was added in F2003.

Cheers!
C

& in derived type declarations

That's not an important issue, but since I came across... here it is.
& character in first place of a declaration inside a type declaration seems to mess it up:

screenshot from 2015-10-20 17 38 34

Update change log

I just noticed there is a change log file in the main directory. Sadly it stops at v0.3.0. I feel it's time to update it so I'm putting this here mostly as a note to myself to do so. Of course if anyone else wants to comb through my old commit messages they're more than welcome to! ๐Ÿ˜„

Slowness / freeze when opening large program

I'm trying to open an arguably large source code (~5000 lines of code) and the syntax highlighting makes Atom slower and slower until freezing completely the more I scroll down in the file.

I've tried disabling the syntax highlighting to make sure it was indeed the issue, and it works perfectly fine without syntax highlighting.

If you want to try with the same file, you can download this archive http://s-provencher.com/pub/contin/contin.for.gz that contains the .for file that I was working on.

Auto-indent of line continuation

Hi,

I'm surprised that the auto-indentation does not take into account the ampersand "&" at the end of a given line to add an additional indentation at the beginning of the next one, so as to be able to distinguish between new lines and lines being continuation of previous ones. For instance, after having key-binded tab to the auto-indent command, here is what I get when I only use tab :

1

Wouldn't something like this be more confortable :

2

?

class variable types not highlighted

class variables are not highlighted as shown below. This should be pretty easy to implement. I'll probably get around to it this weekend if someone else hasn't.
image of class type declaration in 1.2

source statement not highlighted

Hi,

First of all I'm sorry since I can't manage to install the very last package of language-fortran. I'm stuck to the one that is installed by default with atom 0.146.

The issue is that source is not highlighted, for instance during allocations:

screenshot from 2014-11-19 08 57 24

if-then-end-if highlighting broken under line continuation

Consider the following code snippet:

function hello()

  IF ( (condition1) .AND. &
    (condition2) ) THEN
    CALL DUMMY (1, 32544, &
    'DUMMY1', &
    'DUMMY2')
  END IF

end function hello

function hello()

  IF ( (condition1) .AND. (condition2) ) THEN
    CALL DUMMY (1, 32544, &
    'DUMMY1', &
    'DUMMY2')
  END IF

end function hello

as can be seen from the attached figure, the if-then block does not work correctly when the condition is split over multiple lines.

Considering the the 'begin' match for the if-then-construct`` in https://github.com/dparkins/language-fortran/blob/master/grammars/fortran%20-%20punchcard.cson where(?=[^\n]*\bthen)``` is part of the match, would this net not exclude new-lines?

I am still new at the definitions of grammars in this way, but by replacing the remainder of the match with a .*? the syntax highlighting is corrected.

image

preprocessor directives not highlighted correctly

I'm opening a file with .f extension, the grammer is "Fortran - Fixed Form". There are several #include statements which are not highlighted correctly. Also, when adding e.g. #ifdef statements they are not highlighted correctly either.

atom 1.3.3, language-fortran 2.0.8

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.