originalcomment
Theoriginalcomment filter has a string value equal to the comment appearing in the input file at the current position. If the current position has no comment, the originalcomment filter does not match.
x=originalcomment
originalcomment ~~ "Eval: (\d+)"
"bad" in originalcomment
By the phrase "a comment at a position" in CQL, we mean the comment in the PGN file that is associated with the move leading to that position. A comment to the initial position is not associated with a move, but appears before the first move in the PGN file for the game.
Compatibility note: originalcomment versus hascomment
Prior to CQL 6.1, the filterhascomment was used instead of originalcomment. The hascomment filter was just like originalcomment but required an argument.
hascomment is now only synonym for originalcomment. hascomment is back-compatible with CQL version 6.0: existing CQL 6.0 files will work unchanged as to hascomment.
optional string literal argument to originalcomment
Iforiginalcomment is immediately followed by a string literal, then:
- If the current position has no comment, the filter does not match.
- If the string literal represents a NAG, then the filter matches when the designated NAG appeared
- Otherwise, the string literal is treated as an implicit search: the original comment to the current position is searched for that string literal.
1. e4 {weakening f2} $6
Then the following filters would each match the position following White's move 1:
originalcomment "kenin"
originalcomment "$6"
originalcomment "?!"
"kening" in originalcomment
originalcomment ~~ "f\d"
Numeric Annotation Glyphs (NAGs)
The PGN specification allows moves to be annotated with "numeric annotation glyphs", or NAGs. These take the form of$ immediately followed by a positive integer smaller than 256, such as $2 or $5.
If the argument to originalcomment consists of the character $ immediately followed by one or more digits, then originalcomment searches for the corresponding NAG.
If the argument to originalcomment is equal to the string literal equivalent of a NAG value listed in the following table, then originalcomment searches for the corresponding NAG:
| chess representation | CQL representation | NAG number |
|---|---|---|
| ! | ! | 1 |
| ? | ? | 2 |
| !! | !! | 3 |
| ?? | ?? | 4 |
| !? | !? | 5 |
| ?! | ?! | 6 |
| = | = | 10 |
| ⩲ | +/= | 14 |
| ⩱ | =/+ | 15 |
| ± | +/- | 16 |
| ∓ | -/+ | 17 |
| +− | +- | 18 |
| −+ | -+ | 19 |
For example,
originalcomment "?"will match a position whose preceding move is annotated with the NAG of 2. It has the identical effect to
originalcomment "$2"
Likewise,
originalcomment "+/="will match a position whose preceding move is annotated with the NAG of 14, and is equivalent to
originalcomment "$14"
Limitation: multiple comments to the same move
CQL does not support multiple comments to the same move (or multiple comments before the first move) within a PGN file.