The goal is to highlight all text before the function name.
=> I am looking for a regular expression to extract the text *before* the function name (that are the characters including the opening parenthesis '(')
Here for Java functions (similar later for e.g. C++)
===
E.g. if this Java function are given
private Data getEntry( String s ) {
private String getJnlp( HttpServletRequest req ) throws IOException
private StringBuffer getJnlpFromDisk( HttpServletRequest req, String
private int scaleY( double y ) {
private int[] uptriy( int p ) {
private static boolean isOperator(char charInfix)
private static int getPrecedence(char charInfix) {
private static void refresh(BufferedReader in ) throws IOException {
private void txtAnswerKeyPressed(java.awt.event.KeyEvent evt) {
public Stack() {
public boolean action( Event event, Object object ) {
public double FNDoubleZeroD() {
public float area() {
where I am looking for is a regular expression which does the following:
it should highlight the text *before* getEntry( -> thus 'private Data ' should be highlighted
it should highlight the text *before* getJnlp( -> thus 'private String ' should be highlighted
...
it should highlight the text *before* Stack( -> thus 'public ' should be highlighted
it should highlight the text *before* FNDoubleZeroD( -> thus 'public double ' should be highlighted
it should highlight the text *before* area( -> thus 'public float ' should be highlighted
===
For an overview of all the Java functions that I am testing, and for which the first characters before the function name should be highlighted:
http://www.knudvaneeden.com/temp/dddjavafunction.txt
it should work for about all functions in this file.
===
Tried until now:
1. Extracting all possibilities in front:
private String
private int
private int[]
private static boolean
private static int
private static void
private void
protected
public
public String
public Vector
public boolean
public char
public double
public float
public int
public long
public static String
public static void
public void
void
1. I tried e.g. to take put all possible first characters in a class, followed by all possible second characters, followed by all possible third characters, ... and so on
E.g.
[pv][ruo][iob][vtld][aei] *[ct] *[et ] *[SVbcdefilsv ] *[acinortu ] *[\[deilnot ] *[\]aceginr ] *[cng ] *
2. tried also to use ORs like this (one liner)
{private}|{public}|{protected}[ ]#{String}|{int}|{int\[\]}|{static}|{void}|{Vector}|{boolean}|{char}|{double}|{float}|{long}[ ]#{boolean}|{int}|{void}|{String}[ ]#
but I could not really find any TSE regular expression which highlights all the strings above.
3. I tried also the whole Java function list string from TSE, and put a '\c' to put the cursor there
(but it highlights the whole string, instead of only the front characters, or puts the cursor at the wrong position)
{private}|{protected}|{public}|{void}[ \t]+\c_@[a-zA-Z][\.a-zA-Z0-9_*@{\[\]}? \t]@([~;]*$
===
Search option always "ix"
Maybe it is just not possible, using a one liner regular expression (but that one liner is where I am looking for thus).
Does anybody have an idea or suggestion?
Thanks,
with friendly greetings,
Knud van Eeden