I must have a blind spot but i can't find in the pgn standard that one has to handle '\' as an escape char.Rémi Coulom wrote:Hi,
I have just updated the source code of my GPL chess library. You can find it on my web page at http://remi.coulom.free.fr/. I only tested it on my Mac, but it should work with any linux or windows compiler too. cd to chesslib/compgcc and make. You may have to install ccache in order to compile. Documentation is minimal, but I'll augment it if anybody asks questions.
The PGN code was written and tested very carefully, and should strongly conform with the PGN specs. It supports variations, comments, NAGs, everything. It can parse this:
RémiCode: Select all
[Event "This is an event with a ""] [Site "This site has \\\\ xxx"] [Date "1996.08.15"][Round "-"][White "White"][Black "Black"] [Result "1/2-1/2"][SetUp "1"];I love comments [FEN "1nbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/1NBQKBNR w KQkq - "]e4(d4;comment d5!!2.c4$50(Nf3?))e5 Nf3{Comment !}Nc6 Nc3 Nf6 Bc4 Bc5 O-O O-O % This is a line with an escape character ! @@@æææ {unexpected characters are skipped} <> {These symbols are reserved} 1/2-1/2
Request: PGN reader implementation
Moderators: hgm, Rebel, chrisw
-
- Posts: 868
- Joined: Thu Mar 09, 2006 11:21 pm
- Location: Nederland
Re: Request: PGN reader implementation
-
- Posts: 438
- Joined: Mon Apr 24, 2006 8:06 pm
Re: Request: PGN reader implementation
F. Bluemers wrote:I must have a blind spot but i can't find in the pgn standard that one has to handle '\' as an escape char.
Code: Select all
A string token is a sequence of zero or more printing characters delimited by a
pair of quote characters (ASCII decimal value 34, hexadecimal value 0x22). An
empty string is represented by two adjacent quotes. (Note: an apostrophe is
not a quote.) A quote inside a string is represented by the backslash
immediately followed by a quote. A backslash inside a string is represented by
two adjacent backslashes. Strings are commonly used as tag pair values (see
below). Non-printing characters like newline and tab are not permitted inside
of strings. A string token is terminated by its closing quote. Currently, a
string is limited to a maximum of 255 characters of data.
-
- Posts: 868
- Joined: Thu Mar 09, 2006 11:21 pm
- Location: Nederland