0
I need to find the occurrence of a chain function call, but I need to include the case where there is more than one past parameter, such as:
Tower.getType(i,j).initialPrice(f,g);
So far I have only been able to formulate the regex of when there is only one parameter:
[\\w]+([\\.]+[\\w]+[(]+[\\w]*+[)]){2,}+[;]
The excerpt from the code:
public static void verificaMessageChain (String s) {
if (s!=null && s.matches("[\\w]+([\\.]+[\\w]+[(]+[\\w]*+[)]){2,}+[;]")) {
System.out.println("\nÉ Message Chain para "+s+"\n");
splitMessageChain(s); // {0,} equivale a *
} else if (s!=null && s.matches("[\\w] + ([\\.] + [\\w] + [(] + [\\w]* + ([\\,] + [\\w])* + [)]) {2,} + [;]")) {
System.out.println("\nÉ Message Chain para "+s+"\n");
splitMessageChain(s);
} else {
System.out.println("\nNão é Message Chain para "+s+"\n");
}
}
Note the expression
metodo(a.b(c, (d + e.f(g, h(i) + j, k) * m), n.o(p, q, r.s().t(u.v())), w), x, y + z)
- The conclusion is that to handle it properly you would need a context-free language, not regular.– Victor Stafusa
But what for a simple one? As a method(a, b, c), I do not need to be able to analyze all the cases, but some simple at least.
– Raquel Romão