another option to obtain the annotations of a literal is the operator =..

X = p[a,b];
...
X =.. [_,_,L];
...