[: ... :]
rather than simple square brackets
([...]
); unlike an ordinary pattern, an assertion does not
“consume” a token when it is matched; it can be thought of as a part of
the global constraint that is tested in between two tokens
DEFINE MACRO np_agr(0) a:[pos="ART"] b:[pos="ADJA"]* c:[pos="NN"] [: ambiguity(/unify[agr, a,b,c]) >= 1 :] ;(in this simple case, the constraint could also have been added to the last pattern)
_
) is used in an assertion, it refers
to the corpus position of the following token; the same holds for
direct references to attributes
> [pos = "NNS?"]{2,} [:pos != "NNS?":];
MACRO region($0=Att $1=Key1 $2=Val1 $3=Key2 $4=Val2) <$0> [: _.$0_$1="$2" :] [: _.$0_$3="$4" :] []* </$0> ;
[]
, the matchall assertion [::]
is always satisfied; since it does not “consume” a token either, it is a
no-op (an operation that does nothing) that can freely be inserted at any
point in a query expression; in this way,
a label or target marker can be added to positions which are
otherwise not accessible, e.g. an XML tag or the start/end position of a
disjunction
> ... @[::] /region[np] ... ;
> ... a:[::] ( ... | ... | ... ) b:[::] ...;
starting a query with a matchall assertion is extremely inefficient: use the match anchor or the implicit match label instead