On 05/20/2011 04:57 PM, Peter Willis wrote:
Hello,
Hi Peter
I have made an IDL syntax highlight file:
rsiidl.lang
One of the included files is 'function.lang'.
This works fine for functions that return a value
since the call syntax for functions is:
VARIABLE = SOMEFUNC(variable , variable, ...)
I now want to define 'procedure.lang' where
the call syntax is:
SOMEPROC, variable, variable, ...
As you can see the call to a procedure in IDL does
not include parenthesis.
please keep in mind that source-highlight does not perform real parsing
(only scanning with some state functionalities), thus it can only
highlight parts of a program that can be recognized through regular
expressions...
'function.lang' reads as follows:
vardef FUNCTION = '(?:[[:alpha:]]|_)[[:word:]]*[[:blank:]]*(?=\()'
function = $FUNCTION
What format (of regex ??) is being used here?
How might I change this to test just the 'procedure' case?
that regular expression uses "Forward Lookahead Asserts" (see also
http://www.gnu.org/software/src-highlite/source-highlight.html#Notes-on-regular-expressions),
i.e., which are included in (?= )
(?=\()
checks whether after the name there's a ( but does not consume it
can the syntax of your procedure definition be identified with a regular
expression?
Can you make some examples of procedures?
cheers
Lorenzo
--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net
_______________________________________________
Help-source-highlight mailing list
Help-source-highlight@gnu.org
https://lists.gnu.org/mailman/listinfo/help-source-highlight