Thanks, that solves my problem, and improved my understanding of metalua ASTs!
Now that this approach is working, I'm contemplating whether it might be possible to rather use the colon operator ":" instead of the double colon operator "::". This will bring it much closer to Matlab syntax.
I would appreciate it if you can comment on the possibility of such an approach.
It would be ambiguous, think for instance "a:f(x)" or "a:f(x):g(y)", which are valid Lua invocations, and would also make sense as ranges according to your syntax.
Generally speaking, most Lua constructs are introduced by a dedicated keyword. Respecting this principle ensures that independent extensions can cohabitate together. "[" is free as an initial keyword in an expression context, so "[a:b:c]" could have been readable and unambiguous. Unfortunately, you'd get into trouble in table contexts: "{ [a:f(x)]" could be either the beginning of the list "{ [a:f(x)] }" starting with a range element, or "{ [a:f(x)] = b }" a plain Lua table with one key which is an invocation.
I'd suggest that you use an available keyword, such as "#" or "::" indeed, for range denotations. Another possibility would be to disable method invocation, but I wouldn't advocate this either, it doesn't seem worth further breaking compatibility for such a cosmetic purpose.
Note that MLP isn't optimized to let you write arbitrary grammars: it tries to encourage you choosing syntaxes which respect "the Lua way", i.e. which are easy to disambiguate, according to simple rules. The support for rules which require big lookaheads is intentionally limited (I event wonder whether it's documented... :))