git.hedgecode.org
/
chesshog.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[LIB-9] Set of entities for PGN parsing and formatting
[chesshog.git]
/
chesshog-format
/
src
/
main
/
java
/
org
/
hedgecode
/
chess
/
pgn
/
PGNParser.java
diff --git
a/chesshog-format/src/main/java/org/hedgecode/chess/pgn/PGNParser.java
b/chesshog-format/src/main/java/org/hedgecode/chess/pgn/PGNParser.java
index
274bfdf
..
4f67a2d
100644
(file)
--- a/
chesshog-format/src/main/java/org/hedgecode/chess/pgn/PGNParser.java
+++ b/
chesshog-format/src/main/java/org/hedgecode/chess/pgn/PGNParser.java
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (c) 2018. Developed by Hedgecode.
+ * Copyright (c) 2018
-2020
. Developed by Hedgecode.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@
-16,13
+16,25
@@
package org.hedgecode.chess.pgn;
package org.hedgecode.chess.pgn;
+import org.hedgecode.chess.pgn.entity.Game;
+import org.hedgecode.chess.pgn.token.Tokenizer;
+import org.hedgecode.chess.pgn.entity.DetailGame;
+import org.hedgecode.chess.position.ParseException;
+
/**
/**
- *
+ *
PGNParser
*
* @author Dmitry Samoshin aka gotty
*/
public class PGNParser {
*
* @author Dmitry Samoshin aka gotty
*/
public class PGNParser {
-
+ public static Game parse(String pgn) throws ParseException {
+ Game game = new DetailGame();
+ Tokenizer pgnTokenizer = new Tokenizer(pgn);
+ while (pgnTokenizer.hasToken()) {
+ pgnTokenizer.token(game);
+ }
+ return game;
+ }
}
}