Making Expect syntax file

Discuss syntax highlighting or submit new syntax files.
Post Reply
DrSpyware
Posts: 2
Joined: 09 May 2008 14:47

Making Expect syntax file

Post by DrSpyware »

I'm fairly new to RJ TextEd, so I'll apologize up front for any stupid questions I ask in the future. ;)

I have been doing some work with the Expect language, and want to create a syntax file for it. I'm trying to add the capability of folding up my functions in order to save time, but am having a hard time getting it right. The basic synatx of a function (proc) is:

proc <procName> { var-1 [var-2] [var-n] } {
<body of proc/function>
}

As an example here is a very basic proc.

proc rand {n} {
expr {int($n*rand())}
}

Thanks for any help.
User avatar
Rickard Johansson
Site Admin
Posts: 6628
Joined: 19 Jul 2006 14:29

Post by Rickard Johansson »

The problem is the extensive use of the {} - characters. Something like this works perfectly

Code: Select all

proc rand (n) { 
expr {int($n*rand())} 
}
It might be difficult to make this work in a future version, but I'll look into it. Maybe some simple option to ignore the first {} pair after the proc statement.
DrSpyware
Posts: 2
Joined: 09 May 2008 14:47

Post by DrSpyware »

Rickard Johansson wrote:The problem is the extensive use of the {} - characters.
That's what I was thinking, but had to check.

Thanks for your consideration on this.
User avatar
Rickard Johansson
Site Admin
Posts: 6628
Joined: 19 Jul 2006 14:29

Post by Rickard Johansson »

Functions like

Code: Select all

proc rand {n} { 
expr {int($n*rand())} 
}
should work in the next release. No option is needed. You can use the same fold options as in the C++ syntax file.
Post Reply