PGN parser null semantic actions. This is useful only for testing and documentation purposes.
More...
#include <pgnparser.h>
|
| void | gameStart () |
| | Called on game start before anything else.
|
| |
| void | pgnTag (const std::string_view &key, const std::string_view &value) |
| | Called on PGN tag pair.
|
| |
| void | moveTextSection () |
| | Called between the end of the tag pair section and the beginning of the move text section.
|
| |
| void | comment (const std::string_view &str) |
| | Called on comment.
|
| |
| void | nag (std::uint8_t nagNum) |
| | Called on numeric annotation glyph.
|
| |
| void | moveNum (std::uint32_t moveNum) |
| | Called on move number.
|
| |
| void | movePawn (SquareSet srcMask, Square dst) |
| | Pawn advancing move (non-promoting)
|
| |
| void | movePawnCapture (SquareSet srcMask, Square dst) |
| | Pawn capturing move (non-promoting)
|
| |
| void | movePawnPromo (SquareSet srcMask, Square dst, Piece promo) |
| | Pawn advancing move (promoting)
|
| |
| void | movePawnPromoCapture (SquareSet srcMask, Square dst, Piece promo) |
| | Pawn capturing move (promoting)
|
| |
| void | moveKnight (SquareSet srcMask, Square dst, bool capture) |
| | Knight move.
|
| |
| void | moveBishop (SquareSet srcMask, Square dst, bool capture) |
| | Bishop move.
|
| |
| void | moveRook (SquareSet srcMask, Square dst, bool capture) |
| | Rook move.
|
| |
| void | moveQueen (SquareSet srcMask, Square dst, bool capture) |
| | Queen move.
|
| |
| void | moveKing (SquareSet srcMask, Square dst, bool capture) |
| | King move.
|
| |
| void | moveShortCastle () |
| | Short castling move.
|
| |
| void | moveLongCastle () |
| | Long castling move.
|
| |
| void | variationStart () |
| | Beginning of a recursive annotation variation (RAV)
|
| |
| void | variationEnd () |
| | End of a recursive annotation variation (RAV)
|
| |
| void | gameTerminated (PgnResult result) |
| | Called on game end.
|
| |
| void | endOfPGN () |
| | Called at the end of the PGN after everything else.
|
| |
PGN parser null semantic actions. This is useful only for testing and documentation purposes.
The overall sequence of the callbacks is as follows:
gameStart() – invoked at the beginning of each game
pgnTag() – invoked once per PGN tag pair
- Any number of comments may precede a PGN tag pair
- Escapes of tag pair values are processed before the callback is invoked
moveTextSection() – after PGN tag section and before the first move
- Note that the any comments between the last PGN tag and the first move are deferred after this callback
- Move numbers, moves, NAGs, comments, variations
- The move-related callbacks are:
moveNum(), movePawn(), movePawnCapture(), movePawnPromo(), movePawnPromoCapture(), moveKnight(), moveBishop(), moveRook(), moveQueen(), moveKing(), moveShortCastle(), moveLongCastle(). There are no ordering restrictions.
- Any number of NAGs may follow a move. One callback to
nag() per NAG.
- A variation starts with
variationStart() and ends with variationEnd().
- Variations may be nested. The parser will ensure that
variationStart()/variationEnd() call pairs are balanced or an exception is thrown.
- The parent line must have at least one move before a variation can start. The variation represents an alternative to that move. However, after the variation has ended, another variation can begin immediately, representing another alternative to the parent line move.
- Single line comments and block comments are not distinguished.
- A block comment triggers a
comment(). Newlines are replaced with a single '\n' regardless of whether they used '\n', '\r', '\n\r', or '\r\n'
- A non-empty single line comment triggers a
comment()
- Escapes are not processed
- Comments may appear anywhere except between a move and its NAG(s).
gameTerminated() – game end with a result. No other callbacks related to the game can occur.
endOfPGN() – invoked at the end of the PGN file
- Possible trailing comments
◆ comment()
| void hoover_chess_utils::pgn_reader::PgnParser_NullActions::comment |
( |
const std::string_view & |
str | ) |
|
|
inline |
Called on comment.
- Parameters
-
| [in] | str | Comment string. May be multiline string for multiline block comments. |
◆ endOfPGN()
| void hoover_chess_utils::pgn_reader::PgnParser_NullActions::endOfPGN |
( |
| ) |
|
|
inline |
Called at the end of the PGN after everything else.
◆ gameStart()
| void hoover_chess_utils::pgn_reader::PgnParser_NullActions::gameStart |
( |
| ) |
|
|
inline |
Called on game start before anything else.
◆ gameTerminated()
| void hoover_chess_utils::pgn_reader::PgnParser_NullActions::gameTerminated |
( |
PgnResult |
result | ) |
|
|
inline |
Called on game end.
- Parameters
-
| [in] | result | Result of the game |
◆ moveBishop()
| void hoover_chess_utils::pgn_reader::PgnParser_NullActions::moveBishop |
( |
SquareSet |
srcMask, |
|
|
Square |
dst, |
|
|
bool |
capture |
|
) |
| |
|
inline |
Bishop move.
- Parameters
-
| [in] | srcMask | Set of allowed squares as specified by the move |
| [in] | dst | Destination square |
| [in] | capture | Whether the move is a capture |
◆ moveKing()
| void hoover_chess_utils::pgn_reader::PgnParser_NullActions::moveKing |
( |
SquareSet |
srcMask, |
|
|
Square |
dst, |
|
|
bool |
capture |
|
) |
| |
|
inline |
King move.
- Parameters
-
| [in] | srcMask | Set of allowed squares as specified by the move |
| [in] | dst | Destination square |
| [in] | capture | Whether the move is a capture |
◆ moveKnight()
| void hoover_chess_utils::pgn_reader::PgnParser_NullActions::moveKnight |
( |
SquareSet |
srcMask, |
|
|
Square |
dst, |
|
|
bool |
capture |
|
) |
| |
|
inline |
Knight move.
- Parameters
-
| [in] | srcMask | Set of allowed squares as specified by the move |
| [in] | dst | Destination square |
| [in] | capture | Whether the move is a capture |
◆ moveLongCastle()
| void hoover_chess_utils::pgn_reader::PgnParser_NullActions::moveLongCastle |
( |
| ) |
|
|
inline |
◆ moveNum()
| void hoover_chess_utils::pgn_reader::PgnParser_NullActions::moveNum |
( |
std::uint32_t |
moveNum | ) |
|
|
inline |
Called on move number.
- Parameters
-
◆ movePawn()
| void hoover_chess_utils::pgn_reader::PgnParser_NullActions::movePawn |
( |
SquareSet |
srcMask, |
|
|
Square |
dst |
|
) |
| |
|
inline |
Pawn advancing move (non-promoting)
- Parameters
-
| [in] | srcMask | Set of allowed squares as specified by the move |
| [in] | dst | Destination square |
◆ movePawnCapture()
| void hoover_chess_utils::pgn_reader::PgnParser_NullActions::movePawnCapture |
( |
SquareSet |
srcMask, |
|
|
Square |
dst |
|
) |
| |
|
inline |
Pawn capturing move (non-promoting)
- Parameters
-
| [in] | srcMask | Set of allowed squares as specified by the move |
| [in] | dst | Destination square |
◆ movePawnPromo()
| void hoover_chess_utils::pgn_reader::PgnParser_NullActions::movePawnPromo |
( |
SquareSet |
srcMask, |
|
|
Square |
dst, |
|
|
Piece |
promo |
|
) |
| |
|
inline |
Pawn advancing move (promoting)
- Parameters
-
| [in] | srcMask | Set of allowed squares as specified by the move |
| [in] | dst | Destination square |
| [in] | promo | Promotion piece |
◆ movePawnPromoCapture()
| void hoover_chess_utils::pgn_reader::PgnParser_NullActions::movePawnPromoCapture |
( |
SquareSet |
srcMask, |
|
|
Square |
dst, |
|
|
Piece |
promo |
|
) |
| |
|
inline |
Pawn capturing move (promoting)
- Parameters
-
| [in] | srcMask | Set of allowed squares as specified by the move |
| [in] | dst | Destination square |
| [in] | promo | Promotion piece |
◆ moveQueen()
| void hoover_chess_utils::pgn_reader::PgnParser_NullActions::moveQueen |
( |
SquareSet |
srcMask, |
|
|
Square |
dst, |
|
|
bool |
capture |
|
) |
| |
|
inline |
Queen move.
- Parameters
-
| [in] | srcMask | Set of allowed squares as specified by the move |
| [in] | dst | Destination square |
| [in] | capture | Whether the move is a capture |
◆ moveRook()
| void hoover_chess_utils::pgn_reader::PgnParser_NullActions::moveRook |
( |
SquareSet |
srcMask, |
|
|
Square |
dst, |
|
|
bool |
capture |
|
) |
| |
|
inline |
Rook move.
- Parameters
-
| [in] | srcMask | Set of allowed squares as specified by the move |
| [in] | dst | Destination square |
| [in] | capture | Whether the move is a capture |
◆ moveShortCastle()
| void hoover_chess_utils::pgn_reader::PgnParser_NullActions::moveShortCastle |
( |
| ) |
|
|
inline |
◆ moveTextSection()
| void hoover_chess_utils::pgn_reader::PgnParser_NullActions::moveTextSection |
( |
| ) |
|
|
inline |
Called between the end of the tag pair section and the beginning of the move text section.
◆ nag()
| void hoover_chess_utils::pgn_reader::PgnParser_NullActions::nag |
( |
std::uint8_t |
nagNum | ) |
|
|
inline |
◆ pgnTag()
| void hoover_chess_utils::pgn_reader::PgnParser_NullActions::pgnTag |
( |
const std::string_view & |
key, |
|
|
const std::string_view & |
value |
|
) |
| |
|
inline |
Called on PGN tag pair.
- Parameters
-
| [in] | key | PGN tag key |
| [in] | value | PGN tag value (escapes processed) |
◆ variationEnd()
| void hoover_chess_utils::pgn_reader::PgnParser_NullActions::variationEnd |
( |
| ) |
|
|
inline |
End of a recursive annotation variation (RAV)
◆ variationStart()
| void hoover_chess_utils::pgn_reader::PgnParser_NullActions::variationStart |
( |
| ) |
|
|
inline |
Beginning of a recursive annotation variation (RAV)
The documentation for this class was generated from the following file: