pgn3 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d7030621c0b8888d696ef4fe5b63daa282db75f47e617ec2ff5948f3e13ad36b
4
- data.tar.gz: 62913a0de63bca2fc4cbf651ec1061fc33c28648da8bfad60a288f806b26c3ce
3
+ metadata.gz: 10b8a0fe43c84fa8a30aa48fda2620806a93d1c36a6c4d8afad8a4d0e8e6a8cc
4
+ data.tar.gz: b247a9ea5b563d3a84bab1470364e75ab7e6b002641cceca1f2bffeb80be50da
5
5
  SHA512:
6
- metadata.gz: 802f5962696ac927c84c9e4de70326b6437caac6a8a8ebef37e263ff7dd4bc762834ac951bd3b06996f703f37b2e5817df5978d3780d24c59bb989641f76b578
7
- data.tar.gz: ca6b85b5c444562839c42106565f4f0209f32b2096f9323778ba034b4cf036ff772a49b69d647c08d9bcc38318759798763188e8838245576b6feab60e939420
6
+ metadata.gz: 60fc1c6e535c1bfc9c5861f13778aac0b64f6afd895fbeea30bc0d708282084d1721a0b7a2629f0eada1f1b1d5e8fcfd3180d58dc61ac2bd0c687443bb3a91c7
7
+ data.tar.gz: b3b25658c846145b446d56b56338df55d3fc6ba629c1634608addd6db53ce3db747e5207793fcfa614b7a462ae10f63199178b33b614fb5337d8dff79d906a7f
data/lib/pgn/parser.rb CHANGED
@@ -11,7 +11,6 @@ module PGN
11
11
  ending = input.length
12
12
  @@pgn ||= ''
13
13
  @@game_comment ||= nil
14
-
15
14
  until offset == ending
16
15
  next_token(input, offset, line).tap do |token|
17
16
  if !token.nil?
@@ -131,7 +130,7 @@ module PGN
131
130
  string: /
132
131
  " # beginning of string
133
132
  (
134
- [[:print:]&&[^\\"]] | # printing characters except quote and backslash
133
+ [[:print:]&&[^\\]] | # printing characters except quote and backslash
135
134
  \\\\ | # escaped backslashes
136
135
  \\" # escaped quotation marks
137
136
  )* # zero or more of the above
data/lib/pgn/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module PGN
2
- VERSION = '0.0.1'.freeze
2
+ VERSION = '0.0.3'.freeze
3
3
  end
data/pgn3.gemspec CHANGED
@@ -1,5 +1,4 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path('lib', __dir__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require 'pgn/version'
5
4
 
@@ -22,6 +21,6 @@ Gem::Specification.new do |spec|
22
21
 
23
22
  spec.add_development_dependency 'bundler', '~> 2.3'
24
23
  spec.add_development_dependency 'pry'
25
- spec.add_development_dependency 'rake'
26
- spec.add_development_dependency 'rspec'
24
+ spec.add_development_dependency 'rake', '~> 13.0'
25
+ spec.add_development_dependency 'rspec', '~> 3.11'
27
26
  end
data/spec/parser_spec.rb CHANGED
@@ -133,11 +133,19 @@ describe PGN do
133
133
  expect { game.positions }.not_to raise_error
134
134
  expect(game.moves).not_to be_empty
135
135
  end
136
+
136
137
 
137
138
  it 'gets game comment' do
138
139
  games = PGN.parse(File.read('./spec/pgn_files/no_moves.pgn'))
139
140
  game = games.last
140
141
  expect(game.comment).to eq('{game comment}')
141
142
  end
143
+
144
+ it 'tag_values with double quotes' do
145
+ games = PGN.parse(File.read('./spec/pgn_files/doublequotes.pgn'))
146
+ game = games.last
147
+ expect(game.tags['Event']).to eq('IRT BLITZ "Sub Zonal"')
148
+ end
149
+
142
150
  end
143
151
  end
@@ -0,0 +1,90 @@
1
+ [Event "IRT Campeonato In Memoriam MF Simon Dario Meneses Urbina"]
2
+ [Site "Liga Santandereana de Ajedrez (Calle 14 con carrera 30 Unidad Deportiva)"]
3
+ [Date "2022.07.24"]
4
+ [Round "7"]
5
+ [Board "4"]
6
+ [White "Gonzalez Bolivar, Juan Jose"]
7
+ [Black "Vargas Arteaga, Alexis"]
8
+ [Result "0-1"]
9
+ [ECO "A00"]
10
+ [WhiteElo "1424"]
11
+ [BlackElo "2254"]
12
+ [PlyCount "62"]
13
+ [EventDate "2022.07.20"]
14
+ [EventRounds "8"]
15
+ [EventCountry "COL"]
16
+
17
+ 1. e4 c5 2. Nf3 d6 3. d4 cxd4 4. Nxd4 Nf6 5. Nc3 a6 6. f3 Qb6 7. Nb3 e6 8. Bg5
18
+ Nbd7 9. Qd2 Qc7 10. O-O-O b5 11. f4 b4 12. Nb1 Nxe4 13. Qe3 Nxg5 14. fxg5 Be7
19
+ 15. Be2 Bb7 16. h4 Ne5 17. Bf3 Rc8 18. c3 O-O 19. h5 Nc4 20. Qf4 bxc3 21. bxc3
20
+ Qd8 22. Qg3 Bxg5+ 23. N1d2 Nxd2 24. Nxd2 Rxc3+ 25. Kb1 Qb6+ 26. Ka1 Qd4 27. Nb1
21
+ Rd3+ 28. Nc3 Qxc3+ 29. Kb1 Be4 30. Bxe4 Rb8+ 31. Bb7 Rxb7# 0-1
22
+
23
+ [Event "IRT BLITZ "Sub Zonal""]
24
+ [Site "HOTEL CAFEIRA Calle 18 Nro. 5 - 38 Centro de Pereira Risaralda"]
25
+ [Date "2021.11.27"]
26
+ [Round "1"]
27
+ [Board "2"]
28
+ [White "Jaramillo, Carlos Orlando"]
29
+ [Black "Vargas Arteaga, Alexis"]
30
+ [Result "0-1"]
31
+ [ECO "B07"]
32
+ [WhiteElo "1785"]
33
+ [BlackElo "2343"]
34
+ [PlyCount "54"]
35
+ [EventDate "2021.11.27"]
36
+ [EventRounds "18"]
37
+ [EventCountry "COL"]
38
+
39
+ 1. e4 d6 2. d4 Nf6 3. Nc3 Nbd7 4. f4 g6 5. Nf3 c5 6. e5 cxd4 7. Qxd4 dxe5 8.
40
+ fxe5 Nh5 9. e6 Bg7 10. exd7+ Bxd7 11. Qb4 O-O 12. Be3 a5 13. Qh4 Rc8 14. Bd2
41
+ Qb6 15. O-O-O Be6 16. g4 Nf6 17. Ng5 Bxg4 18. Nd5 Qxb2+ 19. Kxb2 Nxd5+ 20. c3
42
+ h5 21. Bg2 Nxc3 22. Bxc3 Rxc3 23. Kb1 Rc4 24. Rhf1 Bf5+ 25. Rxf5 Rxh4 26. Rxa5
43
+ Rc8 27. Bd5 e6 0-1
44
+
45
+ [Event "IRT BLITZ "Sub Zonal""]
46
+ [Site "HOTEL CAFEIRA Calle 18 Nro. 5 - 38 Centro de Pereira Risaralda"]
47
+ [Date "2021.11.27"]
48
+ [Round "3"]
49
+ [Board "2"]
50
+ [White "Vargas Arteaga, Alexis"]
51
+ [Black "Zambrano Linares, Ramon Alberto"]
52
+ [Result "1-0"]
53
+ [ECO "C60"]
54
+ [WhiteElo "2343"]
55
+ [BlackElo "1935"]
56
+ [PlyCount "101"]
57
+ [EventDate "2021.11.27"]
58
+ [EventRounds "18"]
59
+ [EventCountry "COL"]
60
+
61
+ 1. e4 e5 2. Nf3 Nc6 3. Bb5 Nge7 4. O-O Ng6 5. Bxc6 dxc6 6. d4 exd4 7. Qxd4 Qxd4
62
+ 8. Nxd4 Bc5 9. Be3 O-O 10. Nc3 Re8 11. f3 Ne5 12. Bf2 Bb4 13. Nde2 Be6 14. a3
63
+ Bf8 15. b3 a6 16. Bg3 f6 17. Rfd1 Rad8 18. Kf1 Bc5 19. Bf2 Bxf2 20. Kxf2 b5 21.
64
+ Nf4 Bf7 22. Rxd8 Rxd8 23. Rd1 Rd6 24. Ke1 Kf8 25. Nce2 g5 26. Nh3 Be6 27. Nf2
65
+ h5 28. Nd4 Kf7 29. Nxe6 Kxe6 30. Ke2 c5 31. Nd3 Nxd3 32. Rxd3 Ke5 33. Ke3 h4
66
+ 34. g3 hxg3 35. hxg3 Rc6 36. f4+ gxf4+ 37. gxf4+ Ke6 38. Rd5 c4 39. b4 Rd6 40.
67
+ Rd4 Rc6 41. c3 a5 42. Rd5 axb4 43. axb4 Rb6 44. Kd4 c6 45. Rh5 Rb8 46. Kc5 Kf7
68
+ 47. Kxc6 Re8 48. e5 Re6+ 49. Kxb5 fxe5 50. Rxe5 Rf6 51. f5 1-0
69
+
70
+ [Event "IRT BLITZ "Sub Zonal""]
71
+ [Site "HOTEL CAFEIRA Calle 18 Nro. 5 - 38 Centro de Pereira Risaralda"]
72
+ [Date "2021.11.27"]
73
+ [Round "5"]
74
+ [Board "2"]
75
+ [White "Estrada Velandia, Henry Andres"]
76
+ [Black "Vargas Arteaga, Alexis"]
77
+ [Result "0-1"]
78
+ [ECO "D00"]
79
+ [WhiteElo "2055"]
80
+ [BlackElo "2343"]
81
+ [PlyCount "64"]
82
+ [EventDate "2021.11.27"]
83
+ [EventRounds "18"]
84
+ [EventCountry "COL"]
85
+
86
+ 1. d4 Nf6 2. c3 d5 3. e3 c5 4. Bd3 Nc6 5. f4 e6 6. Nf3 Bd6 7. O-O O-O 8. Bd2 b6
87
+ 9. Be1 Ne7 10. Ne5 Nf5 11. Bxf5 exf5 12. Bh4 Be6 13. Nd2 Rc8 14. Qf3 Be7 15.
88
+ Bxf6 Bxf6 16. Kh1 g6 17. Rg1 b5 18. g4 b4 19. gxf5 Bxf5 20. Raf1 Bg7 21. Rg5
89
+ bxc3 22. bxc3 cxd4 23. Rxf5 dxc3 24. Nxf7 Qd7 25. Rxd5 Qxf7 26. Nb3 c2 27. Rc1
90
+ Bb2 28. Rg1 c1=Q 29. Nxc1 Rxc1 30. Rxc1 Bxc1 31. h4 Bxe3 32. f5 Bh6 0-1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pgn3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stacey Touset
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-10-06 00:00:00.000000000 Z
13
+ date: 2022-11-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: whittle
@@ -58,30 +58,30 @@ dependencies:
58
58
  name: rake
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - ">="
61
+ - - "~>"
62
62
  - !ruby/object:Gem::Version
63
- version: '0'
63
+ version: '13.0'
64
64
  type: :development
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - ">="
68
+ - - "~>"
69
69
  - !ruby/object:Gem::Version
70
- version: '0'
70
+ version: '13.0'
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: rspec
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
- - - ">="
75
+ - - "~>"
76
76
  - !ruby/object:Gem::Version
77
- version: '0'
77
+ version: '3.11'
78
78
  type: :development
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
- - - ">="
82
+ - - "~>"
83
83
  - !ruby/object:Gem::Version
84
- version: '0'
84
+ version: '3.11'
85
85
  description: A PGN parser and FEN generator for Ruby
86
86
  email:
87
87
  - stacey@touset.org
@@ -115,6 +115,7 @@ files:
115
115
  - spec/pgn_files/alternate_castling.pgn
116
116
  - spec/pgn_files/annotations.pgn
117
117
  - spec/pgn_files/comments.pgn
118
+ - spec/pgn_files/doublequotes.pgn
118
119
  - spec/pgn_files/empty_variation_move.pgn
119
120
  - spec/pgn_files/fen.pgn
120
121
  - spec/pgn_files/multiline_comments.pgn
@@ -145,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
146
  - !ruby/object:Gem::Version
146
147
  version: '0'
147
148
  requirements: []
148
- rubygems_version: 3.2.32
149
+ rubygems_version: 3.3.23
149
150
  signing_key:
150
151
  specification_version: 4
151
152
  summary: A PGN parser for Ruby
@@ -156,6 +157,7 @@ test_files:
156
157
  - spec/pgn_files/alternate_castling.pgn
157
158
  - spec/pgn_files/annotations.pgn
158
159
  - spec/pgn_files/comments.pgn
160
+ - spec/pgn_files/doublequotes.pgn
159
161
  - spec/pgn_files/empty_variation_move.pgn
160
162
  - spec/pgn_files/fen.pgn
161
163
  - spec/pgn_files/multiline_comments.pgn