Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compatibility with Lichess PGNs (support for multiple games, support for move nits) #14

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions pgn_parser/parser.peg
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ grammar PGN

# PGN Spec: http://www.saremba.de/chessgml/standards/pgn/pgn-complete.htm
# Representation of a full game in pgn format, tag_pairs, movetext and score

games <- game+ %make_games

game <- tag_pairs:tag_pairs [\n]? gcomment:comment? movetext:movetext score:score? [\s]* %make_game

# A tag pair is a key, value store in the form [Key "Value"]
tag_pairs <- tag_pair* %make_tag_pairs
tag_pairs <- tag_pair+ %make_tag_pairs
tag_pair <- "[" dlm key dlm "\"" value "\"" dlm "]" dlm %make_tag_pair
key <- [A-Za-z0-9_]+
value <- [^\"]*
Expand Down Expand Up @@ -35,7 +38,9 @@ blacks_move <- ".."

# A NAG is a numeric annotation glyph, representing anontations on a move such as !! ($3)
nags <- nag+
nag <- "$" [0-9]+ dlm
nag <- ("$" [0-9]+ / symbolic_nag) dlm
symbolic_nag <- "!!" / "??" / "!?" / "?!" / "!" / "?"


# A var or variation is a list of one or more moves surrounded by ()
variations <- variation+ %make_variations
Expand Down
Loading
Loading