# Nested list of patterns in SyntaxInformation “ArgumentsPattern”

I have a function with the following input structure:

f[{{a1, n1}, {a2, n2}...}, {i1, i2,...}]


The first argument is a List of Lists, each with exactly two elements, and the second argument is a list of symbols.

So I thought the appropriate SyntaxInformation to provide is

SyntaxInformation[f] = {  "ArgumentsPattern" -> {{{_, _} ...}, {___}}  };


Now let's look at some input examples (in v9.0.1)

In the first example, it is correctly able to indicate the missing argument. But in the second example, it is not highlighting the c and h in red (since these lists don't have exactly two arguments).

So, my guess is that SyntaxInformation is unable to recognize patterns that are too deep. Is this correct? If not, what can be done to get the right syntax highlighting?

The documentation says:

Your form is not one of these so it cannot be expected to work. (It would be nice if it did of course.)

I cannot think of a way to get the syntax highlighting you seek, given this apparent limitation, but I will think about it.

I ma not sure if this help or not but you may use SyntaxInformation twice but with two head functions:

SyntaxInformation[f] = {"ArgumentsPattern" -> {_, {___}}};
SyntaxInformation[g] = {"ArgumentsPattern" -> {{_, _} ...}};


• @Mr.Wizard, Thanks. your (+1) is like (+10) from others:) – Basheer Algohi Oct 24 '14 at 21:37