Nedit skill highlight revisited
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Nedit skill highlight revisited
Post new topic   Reply to topic    CADForums.net Forum Index -> Cadence

Author Message
Svenn Are Bjerkem
Guest





Posted: Wed Apr 06, 2005 3:06 pm    Post subject: Nedit skill highlight revisited Reply with quote

Hi,
I downloaded the skill highlight pats from www.nedit.org. This file has a
major flaw, it doesn't add syntax highlight because of one missing command
line that tells nedit about the highlight.

Here is a working version. You may need to fix some newlines because the
original is not limited to 75 characters per line.

! Syntax Highlighting Patterns for SKILL-Code (script-language of the
Cadence
! Design System).
!
! These are written for the "c" type syntax vs the lisp syntax. In these
! patterns a procedure call, "function(" will be highlighted differently
from
! a variable + paren, "function (" so you can tell if you have a white
space
! error.
!
! Contributed by Andrew Stanaski
!
! In NEdit Version 5.0.1 and beyond, load this pattern by starting nedit
with:
!
! nedit -import <name of this file>
!
! Then, check that the patterns were loaded correctly, and choose Save
Defaults
! from the Preferences menu. The new patterns will now be incorporated into
! your own .nedit file, so the next time you start NEdit, you will no longer
! need to use -import.
!
! In version 5.0, without -import, you must edit your .nedit file by hand
and
! add the contents of each resource below to the corresponding list in your
! .nedit file. Be sure to separate new entries with \n, and continue
resource
! strings by escaping all newlines within a resource value with \
(backslash),
! leaving only the last line of the resource value not ending in \.
!
nedit.highlightPatterns:\
Skill:1:0{\n\
comment:"/\\*":"\\*/"::Comment::\n\
skill comment:";":"$"::Comment::\n\
string:"""":"""":"\\n":String::\n\
string escape chars:"\\\\(.|\\n)":::String:string:\n\
numeric constant:"<((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\
[0-9]+))((e|E)(\\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f)?>":::Preprocessor::D\n\
procedure calls:"<(procedure|return)\\(":::Plain::D\n\
procedure color:"\\1":""::Storage Type:procedure calls:DC\n\
control calls:"<(if|when|unless|cond|case|caseq|while|for
foreach)\\(":::Plain::D\n\
control color:"\\1":""::Subroutine:control calls:DC\n\
control then else:"<(then|else)>":::Subroutine::D\n\
function calls:"<([a-zA-Z][a-zA-Z0-9_?]*)\\(":::Plain::D\n\
function color:"\\1":""::Identifier1:function calls:DC\n\
braces:"[{}]":::Comment::D\n\
}
nedit.languageModes: Skill:.il .tf::::::\n\

Back to top
Collin Weiss
Guest





Posted: Wed Apr 06, 2005 10:43 pm    Post subject: Re: Nedit skill highlight revisited Reply with quote

Thanks!
Back to top
fogh
Guest





Posted: Thu Apr 07, 2005 6:45 pm    Post subject: Re: Nedit skill highlight revisited Reply with quote

Collin Weiss wrote:
Quote:
Thanks!


One of these days we may even get an indent macro from Bracknell ;-)
Back to top
Andrew Beckett
Guest





Posted: Fri Apr 08, 2005 1:07 am    Post subject: Re: Nedit skill highlight revisited Reply with quote

On Thu, 07 Apr 2005 16:45:37 +0200, fogh
<cad_support@skipthisandunderscores.catena.nl> wrote:

Quote:
Collin Weiss wrote:
Thanks!


One of these days we may even get an indent macro from Bracknell ;-)

Well, personally I use vi, and since I write in LISP syntax, I use vi's lisp
mode (:set lisp ai) which does all the indentation for you. I did write my own
pp version a while ago which pp's using the same indentation rules as vi does.

The trouble with pp is that you lose the comments, so it's not a particularly
good approach.

If I write in C syntax, I use vi's autoindent mode too, with a shiftwidth of
4, to indent in 4 space chunks. I then use ^T and ^D in input mode to
indent or back out of an indent. In non-input mode, I use the < and >
commands to adjust indentation of existing code.

I do have a number of macros that I use in vi (others use them in nedit) to do
commenting neatly (for example, I have a program which allows me to put very
flexible boxes around text).

That said, I've never written a SKILL beautifier, which is probably what
you're after.

Most decent editors have functions to allow you to adjust indent levels
easily, so it's mainly a matter of discipline when you write the code. I
always think you should write your code beautifully in the first place, since
the layout of the code helps you understand it better as you're writing it.
Trying to fix it up automatically afterwards is never going to be as
effective.

It's much the same reason why you should comment as you go along - otherwise
you'll never go back and do it. Often commenting makes you think more
carefully about the code, and more likely to identify bugs early.

Two of my former colleagues, Ian Dobinson and James Kenney, wrote a style
checker, along the lines of SKILL Lint (which they were also involved in),
which allowed you to define a set of style rules, and then check that you'd
adhered to them. Quite neat!

Regards,

Andrew.
Back to top
hikom



Joined: 18 Feb 2005
Posts: 27
Location: Germany

Posted: Fri Apr 08, 2005 6:46 am    Post subject: Re: Nedit skill highlight revisited Reply with quote

Hi,
I started nedit with:" nedit -import skill.pats " and this message was printed in the terminal window

"NEdit: language mode must be specified in highlight pattern:
<=="

The Skill code was not highlighted. Does anybody know what the problem is? Do I have to configure some ohter properties (e.g in Preferences--> Default Settings --> Language Modes)

Greetings,
hikom
Back to top
View user's profile Send private message
Svenn Are Bjerkem
Guest





Posted: Fri Apr 08, 2005 2:27 pm    Post subject: Re: Nedit skill highlight revisited Reply with quote

hikom wrote:

Quote:
Hi,
I started nedit with:" nedit -import skill.pats " and this message was
printed in the terminal window

"NEdit: language mode must be specified in highlight pattern:
=="

The Skill code was not highlighted. Does anybody know what the problem
is? Do I have to configure some ohter properties (e.g in
Preferences--> Default Settings --> Language Modes)

Did you cut and paste from the article, or did you get it from
www.nedit.org? If you got it from the article, you may need to check the
newlines. If you got it from the web, you only need to add the line:

nedit.highlightPatterns:\

before the

Skill:1:0{\n\

line. I assume you have nedit version > 5.0

--
Svenn
Back to top
tzg6sa



Joined: 10 May 2010
Posts: 1

Posted: Mon May 10, 2010 9:50 am    Post subject: Reply with quote

After adding the line "nedit.highlightPatterns:\ " before the line "Skill:1:0{\n\" I got the following command line output:

Code:
NEdit: language mode must be specified in highlight pattern:
 <==


The file is opened, but the skill synthax highlighting does not work.

Could you help me figure out what's wrong?

Thanks!
Back to top
View user's profile Send private message
adynis



Joined: 08 Jul 2011
Posts: 1

Posted: Fri Jul 08, 2011 1:55 pm    Post subject: Reply with quote

after having the same problem with previous specified error, I finally got to an working sollution:
Code:
nedit.highlightPatterns: Skill:1:0{\n\
    comment:"/\\*":"\\*/"::Comment::\n\
    skill comment:";":"$"::Comment::\n\
    string:"""":"""":"\\n":String::\n\
    string escape chars:"\\\\(.|\\n)":::String:string:\n\
    numeric constant:"<((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f)?>":::Preprocessor::D\n\
    keywords:"(while|foreach|for|if|else|then|prog|let|procedure|when|unless|load|nil)|(db[A-Z][a-zA-Z]*)|(pc[A-Z][a-zA-Z]*)|(rod[A-Z][a-zA-Z]*)|(cdf[A-Z][a-zA-Z]*)":::Identifier1::\n\
    procedure calls:"<(procedure|return)\\(":::Plain::D\n\
    procedure color:"\\1":""::Storage Type:procedure calls:DC\n\
    control calls:"<(if|when|unless|cond|case|caseq|while|for|foreach)\\(":::Plain::D\n\
    control color:"\\1":""::Subroutine:control calls:DC\n\
    control then else:"<(then|else)>":::Subroutine::D\n\
    function calls:"<([a-zA-Z][a-zA-Z0-9_?]*)\\(":::Plain::D\n\
    function color:"\\1":""::Identifier1:function calls:DC\n\
    braces:"[{}]":::Comment::D\n\
    parameter:"\\?":"\\s|\\t"::Text Key::\n\
}
nedit.languageModes:    Skill:.il .ill::::::\n\



! Colors changed for highlighting
nedit.styles:    Plain:black:Plain\n\
    Comment:gray60:Italic\n\
    String:red:Plain\n\
    Preprocessor:RoyalBlue4:Plain\n\
    Identifier1:RoyalBlue4:Bold\n\
    Subroutine:brown:Plain\n\
    Text Key:VioletRed4:Bold
   

! Tab settings; (use 4 spaces in place of tabs)
nedit.tabDistance: 4
nedit.emulateTabs: 4
nedit.insertTabs: False


! Background color; this can be removed if you don't like

nedit.textBgColor: #F0F3FF
Back to top
View user's profile Send private message
 
Post new topic   Reply to topic    CADForums.net Forum Index -> Cadence All times are GMT
Page 1 of 1

 
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 vote in polls in this forum

Access Forum - Microsoft Office Forum - Electronics

Contact Us Powered by phpBB