Scid  4.7.0
Classes | Functions
pgn_impl Namespace Reference

Classes

class  InputMemory
 

Functions

constexpr unsigned long long init_symbol_map (unsigned elem)
 Creates a 128 bits bitmap of PGN symbol characters. More...
 
bool is_PGNsymbol (unsigned char ch)
 Checks if the given character is a PGN symbol. More...
 
bool is_PGNdigit (unsigned char ch)
 Checks if the given character is one of the 10 decimal digits: 0123456789. More...
 
bool is_PGNwhitespace (unsigned char ch)
 Checks if the given character is a white space ("white space characters include space, newline, and tab characters"). More...
 
template<typename TView >
char is_PGNtermination (TView tok)
 Checks if a token is the game termination marker. More...
 
template<typename TInput , typename TVisitor >
bool parse_token (char ch, TInput &input, TVisitor &parser, int &section)
 Read a token and dispatch it to a PGN parser. More...
 

Function Documentation

◆ init_symbol_map()

constexpr unsigned long long pgn_impl::init_symbol_map ( unsigned  elem)

Creates a 128 bits bitmap of PGN symbol characters.

"A symbol token starts with a letter or digit character and is immediately followed by a sequence of zero or more symbol continuation characters. These continuation characters are letter characters ("A-Za-z"), digit characters ("0-9"), the underscore ("_"), the plus sign ("+"), the octothorpe sign ("#"), the equal sign ("="), the colon (":"), and the hyphen ("-")."

Parameters
elem0 for the lower 64 bits, 1 for the higher 64 bits.
Returns
the requested half of the bitmap.

Definition at line 52 of file pgn_lexer.h.

◆ is_PGNdigit()

bool pgn_impl::is_PGNdigit ( unsigned char  ch)
inline

Checks if the given character is one of the 10 decimal digits: 0123456789.

Parameters
chcharacter to classify.
Returns
true if the character is a numeric character, false otherwise.

Definition at line 101 of file pgn_lexer.h.

◆ is_PGNsymbol()

bool pgn_impl::is_PGNsymbol ( unsigned char  ch)
inline

Checks if the given character is a PGN symbol.

Parameters
chcharacter to classify.
Returns
true if ch is a PGN symbol character, false otherwise.

Definition at line 88 of file pgn_lexer.h.

◆ is_PGNtermination()

template<typename TView >
char pgn_impl::is_PGNtermination ( TView  tok)

Checks if a token is the game termination marker.

"The game termination marker is a symbol that is one of the following four values: "1-0" (White wins), "0-1" (Black wins), "1/2-1/2" (drawn game), and "*" (game in progress, result unknown, or game abandoned)."

Parameters
tokthe token to classify.
Returns
  • '1' for "White wins",
  • '0' for "Black wins",
  • '/' for "drawn game",
  • '*' for "result unknown",
  • 0 (false) if it's not a termination marker.

Definition at line 127 of file pgn_lexer.h.

◆ is_PGNwhitespace()

bool pgn_impl::is_PGNwhitespace ( unsigned char  ch)
inline

Checks if the given character is a white space ("white space characters include space, newline, and tab characters").

Parameters
chcharacter to classify.
Returns
true if the character is a white space, false otherwise.

Definition at line 109 of file pgn_lexer.h.

◆ parse_token()

template<typename TInput , typename TVisitor >
bool pgn_impl::parse_token ( char  ch,
TInput &  input,
TVisitor &  parser,
int &  section 
)

Read a token and dispatch it to a PGN parser.

The first char of the token is used to determine its termination.

Parameters
chthe first char of the token.
inputthe input to get data from.
parserwill receive the tokens via visitPGN_* functions.
section-1 pregame, 0 for tag pair section, 1 for movetext section.
Returns
the result of the invoked parser's function.

Definition at line 158 of file pgn_lexer.h.