Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backslash breaks highlighting #39

Open
jpc2 opened this issue Dec 30, 2018 · 2 comments
Open

Backslash breaks highlighting #39

jpc2 opened this issue Dec 30, 2018 · 2 comments

Comments

@jpc2
Copy link

jpc2 commented Dec 30, 2018

I maintain a bunch of legacy FORTRAN (at least I'm older than it is!)
Finally got around to trying Sublime yesterday. So there is a lot I don't know about it. It is working rather well after about a day...
I install SublimeFortran and it mostly seems to work. However, the code runs on Windows and that means backslashes are generally real. The code often builds a path name and will contain one or more sequences like " ,'\', ". As soon as the highlighting hits the first one , the remainder of the file turns yellow! Yes, if I double the backslashes, the yellow moves to the next one. Vim does not have the problem.
I suspect it is something fairly easy to correct but where?
Here is a short bit that causes the problem

            if (debug_on) then
              user_debug_pathName = trim(user_iniDir)//'\'// &
                    trim(progName)//'_dbg.txt'
            end if
          end if

Everything after the '' turns yellow.

Note: I'm primarily using the Lahey F95 compiler.

@jwortmann
Copy link

Hi, maybe this comment is a bit late for your problem, but I think the lines 944 & 945 (for single quoted strings) and 952 & 953 (for double quoted strings) in the syntax definition file FortranModern.sublime-syntax (I assume you are using modern Fortran syntax for your code) are causing the problem. So if you delete or comment out these lines, normal syntax highlighting should be applied for the rest of the file. I did not yet really dive into how syntax definitions work in Sublime Text and this was kind of a try and error fix, but it seems like that this doesn't break anything and it works with your example code.

The mentioned syntax file is contained inside a zipped .sublime-package file if you use Package control for installation of the Fortran package, but you can just copy the fixed file into your User directory (Preferences -> Browse Packages... -> open the folder 'User') and Sublime Text will then use that one instead of the original file. The fixed file is in my fork here.

@jpc2
Copy link
Author

jpc2 commented Mar 19, 2019

Thank you very much. Much better than the simple work around I was using.
A comment at the end of the offending line with a single (or double) quote.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants