First, let me correct the solution from previous exchange, because identifying a single argument does't really requires ancestor-descendant relation. You example
d := to_date( f('xyz'), 'DD-mon-yyyy', 'nls setting' );
is false positive, because 'xyz' is a single argument which is descendant of to_date(...). The corrected query is:
( [node^) function_call
| [node^) datetime_literal
| [node^) function_expression
) & ?node = 'TO_DATE'
& ([arg) expr
| [arg) string_literal
| [arg) pls_expr )
& arg^-1 = node
& [arg+1) ')'
& [arg-1) '('
It is only when we have unknown number of arguments, so that those arguments can be positioned at arbitrary depth in the parse tree, then we need ancestor descendant.
Second, the failure to match string literal is a bug, for example the predicate ?node = '''5-may-19''' should find the three ocurrencies in the pl/sql snippet above. Fixed for 19.2.
Next, a significant Arbori amendment is coming in 19.2, where you would be able to add query post processing rules in java script. It is technically implemented via java nashorn engine; so for each tuple you can analyse its fields and leverage either JS or Java regular expression facilities.
Finally, to answer your question "Can we have more than 3 syntax highlighting rules?" In 19.2 the syntax colorizing functionality has been reorganized, so that you can specify any number of rules. As soon as the release is out I will write an article how to do that (together with description of JS nashorn amendment).
Finding potential usage of 2-digit years (through a Regular Expression) would be an excellent example of using the post processing feature.
It would make EdStevens happy ( Re: Sql query to retrieve some data )
Many thanks for the help!