intfiction.org

The Interactive Fiction Community Forum
It is currently Thu May 23, 2013 10:14 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Fri Aug 24, 2012 1:09 am 
Offline
User avatar

Joined: Mon Dec 12, 2011 7:03 pm
Posts: 109
I thought it might be fun to cook up a colorization nanorc file for use with Inform6 code. Starting from the file for C code (typically /usr/share/nano/c.nanorc), here's what I have so far. It seems okay except for the yellow string highlighting code. It doesn't want to highlight multi-line blocks of string text like this:
Code:
    "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."


Here's inf.nanorc:
Code:
syntax "inf" "\.inf$"

# Stuff typically declared with Constant are in all-caps
color brightred "\<[A-Z_][0-9A-Z_]+\>"

# ifdefs and such
icolor brightcyan "#[[:space:]]*((un|ifn?)def|endif|ifnot)"

# This catches stuff like "Object" and "Classname" that usually starts in the first column.
icolor cyan "^[a-z]+*"

# Functions
icolor green "^\[[[:space:]][a-z_]+*"
icolor green "^[[:space:]][a-z_]+*"

# Decisions
color brightyellow "\<(for|if|while|switch|else)\>"

## Comment highlighting
color brightblue "!.*"

# String highlighting.  I can't figure out how to make this span multiple lines.
color yellow "<[^= \t]*>" ""(\\.|[^"])*""
color yellow start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""

## Trailing whitespace
color ,green "[[:space:]]+$"

_________________
David Griffith


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group