pattern
$x
$(..x)
$(...x)
x
public static LNode GetCaptureIdentifier(LNode pattern, bool identifierRequired = true) { if (pattern.Calls(S.Substitute, 1)) { var arg = pattern.Args.Last; if (arg.Calls(S.DotDot, 1) || arg.Calls(S.DotDotDot, 1)) arg = arg.Args[0]; if (arg.IsId || !identifierRequired) return arg; } return null; }