|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I'm trying to come up with a regular expression to use in an editor for syntax highlighting. I need one for continuation lines and lines past column 72 in fortran source. I can match something in column 6 with: ^.{5}\S but this highlights all six columns. I want to highlight only column 6. Does anyone have a way to do this? I have tried various negations but what I really need is a regular expression that will start checking in a certain column and ignore all others.
Tom |
|
#2
|
|||
|
|||
|
It's probably me, but I do not understand what it is you want.
You talk about syntax higlighting, if you use vim, that's already taken care of (fortran is only one of the many sources that is recognized). Can you give an example of the 'continuation lines and lines past column 72'. From the top of my head: It's not possible to tell a reg exp to only search between col x and col y. But maybe I can come up with a solution if I understood the question a bit better. |
|
#3
|
|||
|
|||
|
more explanation
I don't use VIM and don't want to. I'm using a new editor (to me) called EditPad Pro and want to develp a highlighting scheme for fortran77. There is one for fortran90 and I am changing it. In fortran77 a continuation line is denoted by any character in column 6 and nothing in columns 1 through 5. I just want to highlight any non-whitespace character in column 6 and ingnore columns 1 to 5.
Examples: 12345678901234567890 900 > anything else > anything else The first violates the fortran77 continuation syntax but I don't want to flag that, I just want column 6 highlighted. The expression ^.{5}\S with highlight columns 1 to 6 if there is something in column 6, but that is not exactly what I want. |
|
#4
|
|||
|
|||
|
Like I said, you can't tell a regular expression to start searching at position x (and/or stop at position y).
But can't you work around the problem? From the (maybe incomplete. i'm not familiar with fortran) example that you gave I see that > is always present. Ok, you end up with a highlight that includes the starting >, but I don't see how to solve this otherwise. Isn't there a clue in the fortran99 example you have? |
|
#5
|
|||
|
|||
|
example not unique
The ">" in the example is just the character I use for continuation lines. The rules is any character in column 6. Fortran90 has a different method for continuation of lines. I have solutions that do highlight continuation lines and long lines but they are unsatisfying.
I guess I'll just have to live with it. |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > regular expression |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|