I'm writing a codeless language module for the DTrace scripting language.
My comment pattern is:
(\A#!.*$)|((?s)/\*.*?\*/)|(//.*$)
Which is to say, the shebang line that may be at the beginning of the file, or
anything enclosed in /**/, or anything from // to the end of the line.
My function pattern is:
<string><![CDATA[(?xs)
(?P<function>
(?P<function_name>
[-a-zA-Z0-9_:*?.$]+
)\s*
(/[^/]*/)?\s*
((\{.*?\})|,)
)]]></string>
(Great thanks to Thane Norton, whose Alloy CLM put me onto using CDATA for
regular expressions.)
This pattern matches this function:
tick-10sec
{
// etc.
}
And this one:
pid$1:*:*realloc*:entry
/ arg0 > 100000 /
{
// etc.
}
But not this one:
pid$1::memset:entry // the pid is the first passed parameter
{
// etc.
}
Instead, BBEdit thinks the name of the function is "parameter". My pattern does
not handle comments within the function declaration.
If I add a skip pattern of:
(?P>comment)
Functions with comments in the declaration don't get matched at all.
Is there an easy way out of this? Or do I have to repeat the comment pattern
(possibly several times) in the function pattern? And if I do, is there a way
to use the (?P>comment) pattern to shorten the expression?
— F
--
You received this message because you are subscribed to the
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem,
please email "[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>