Hi
do procedure (and functions) are always called on a line?
I mean, is the procedure name always at the beginning of a line
(possibly with some spaces before)?
Are commas used also in other contexts besides function and procedure
invocation?
cheers
Lorenzo
P.S. some examples of programs might be useful to do some tests; have
you already a partial language definition for IDL to start from?
On 05/24/2011 05:27 PM, Peter Willis wrote:
On 5/23/2011 7:10 AM, Lorenzo Bettini wrote:
(?=\()
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
Hello,
In 'IDL' procedures are *called* in the following way:
PROCEDURE_NAME , ARGUMENT_1, ARGUMENT_2, ARGUMENT_3, .... , ARGUMENT_N
As you can see no brackets or parenthesis are used. The problem here is
a regex would need to deal with only the first case of the
comma positioned after 'PROCEDURE_NAME' and ignore all other groupings
until the end of the statement.
There is also on other problem in that statements can use continuation
where a '$' indicates the current statement continues on to the
next line:
PROCEDURE_NAME , ARGUMENT_1, $
ARGUMENT_2, ARGUMENT_3, $
.... , ARGUMENT_N
In this case regex needs to distinguish between the case of
'PRODEDURE_NAME' and cases where the statement has been continued.
ie: not highlight 'ARGUMENT_2' due to the comma following there.
Declarations for *both* functions and procedures are written in
similar ways. The difference is only the 'RETURN' value in the case
of functions:
FUNCTION function_name, arg_1, arg_2 $
arg_3, arg_4, ...., arg_n
....<PROGRAM STATEMENTS>...
RETURN, some_value
END
PRO procedure_name, arg_1, arg_2 arg_3, arg_4, ....,$
arg_n
....<PROGRAM STATEMENTS>...
END
Best Regards,
Peter
_______________________________________________
Help-source-highlight mailing list
Help-source-highlight@gnu.org
https://lists.gnu.org/mailman/listinfo/help-source-highlight
--
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