UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 19th, 2003, 10:07 AM
twlaub twlaub is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 3 twlaub User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question regular expression

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

Reply With Quote
  #2  
Old December 19th, 2003, 11:20 AM
druuna druuna is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 137 druuna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 37 sec
Reputation Power: 0
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.

Reply With Quote
  #3  
Old December 19th, 2003, 11:54 AM
twlaub twlaub is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 3 twlaub User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #4  
Old December 19th, 2003, 12:23 PM
druuna druuna is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 137 druuna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 37 sec
Reputation Power: 0
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?

Reply With Quote
  #5  
Old December 19th, 2003, 03:26 PM
twlaub twlaub is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 3 twlaub User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > regular expression


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT