current position

At any given time when playing through a game, CQL has a concept of the current position . The current position is the position that CQL is currently examining. Any filter is always evaluated with respect to the current position.

Thus, CQL successively sets the current position to each position it examines.

For example, consider the pgn file

    1. e4 e5 2. Nf3 Nc6 3. Bg5 a6
When run on this game, the current position will be set successively to the start position, the position after 1. e4, and so on, for seven positions in total (the position after each of the six moves, plus the initial position).

If the filter is say

    Bg5
Then that filter will match exactly two of those seven positions, namely the positions following White's third move.

filters that modify the current position

Most filters are evaluated in a way that does not change the current position. However, some filters temporarily modify the current position in order evaluate their arguments with respect to some new current position. Once such a filter is finished, of course, the current position returns to what it was before the filter was evaluated.

The filters that modify the current position are next, next2, nextstar, previous, previous2, previous*, and relation.

current position and variations

If the variations parameter is not set in the CQL header, the current position will always be set to a mainline position. Otherwise, the current position will also include positions in variation.