From d6068c841a8b31b3a9734545f8537c902f6bbd2d Mon Sep 17 00:00:00 2001 From: Woody Folsom Date: Tue, 25 Sep 2012 17:13:15 -0400 Subject: [PATCH] fixes to buggy MCTS code. Implemented rudimentary export of game state as SGF and LaTeX. --- .../1334-gokifu-20120916-Gu_Li-Lee_Sedol.sgf | 0 src/net/woodyfolsom/msproj/GameBoard.java | 1 + src/net/woodyfolsom/msproj/GameState.java | 19 +- src/net/woodyfolsom/msproj/Referee.java | 5 + .../msproj/policy/MonteCarloUCT.java | 14 +- .../woodyfolsom/msproj/sgf/CoordValue.java | 13 - src/net/woodyfolsom/msproj/sgf/GameTree.java | 35 - src/net/woodyfolsom/msproj/sgf/Node.java | 16 - .../msproj/sgf/NodeCollection.java | 25 - .../woodyfolsom/msproj/sgf/PlayerIdent.java | 7 - .../woodyfolsom/msproj/sgf/ResultValue.java | 7 - src/net/woodyfolsom/msproj/sgf/SGFCoord.java | 7 +- .../woodyfolsom/msproj/sgf/SGFGameTree.java | 86 ++ src/net/woodyfolsom/msproj/sgf/SGFLexer.java | 64 +- src/net/woodyfolsom/msproj/sgf/SGFNode.java | 42 + .../msproj/sgf/SGFNodeCollection.java | 25 +- src/net/woodyfolsom/msproj/sgf/SGFParser.java | 1065 +++++++++-------- .../woodyfolsom/msproj/sgf/SGFProperty.java | 21 +- src/net/woodyfolsom/msproj/sgf/SGFResult.java | 10 + src/net/woodyfolsom/msproj/sgf/SGFValue.java | 9 + src/net/woodyfolsom/msproj/sgf/SGFWriter.java | 5 - .../1334-gokifu-20120916-Gu_Li-Lee_Sedol.sgf | 15 + .../msproj/sgf/CollectionTest.java | 57 + .../woodyfolsom/msproj/sgf/SGFParserTest.java | 34 + 24 files changed, 928 insertions(+), 654 deletions(-) rename {src/net/woodyfolsom/msproj/sgf => data/games}/1334-gokifu-20120916-Gu_Li-Lee_Sedol.sgf (100%) create mode 100644 src/net/woodyfolsom/msproj/Referee.java delete mode 100644 src/net/woodyfolsom/msproj/sgf/CoordValue.java delete mode 100644 src/net/woodyfolsom/msproj/sgf/GameTree.java delete mode 100644 src/net/woodyfolsom/msproj/sgf/Node.java delete mode 100644 src/net/woodyfolsom/msproj/sgf/NodeCollection.java delete mode 100644 src/net/woodyfolsom/msproj/sgf/PlayerIdent.java delete mode 100644 src/net/woodyfolsom/msproj/sgf/ResultValue.java delete mode 100644 src/net/woodyfolsom/msproj/sgf/SGFWriter.java create mode 100644 test/net/woodyfolsom/msproj/sgf/1334-gokifu-20120916-Gu_Li-Lee_Sedol.sgf create mode 100644 test/net/woodyfolsom/msproj/sgf/CollectionTest.java create mode 100644 test/net/woodyfolsom/msproj/sgf/SGFParserTest.java diff --git a/src/net/woodyfolsom/msproj/sgf/1334-gokifu-20120916-Gu_Li-Lee_Sedol.sgf b/data/games/1334-gokifu-20120916-Gu_Li-Lee_Sedol.sgf similarity index 100% rename from src/net/woodyfolsom/msproj/sgf/1334-gokifu-20120916-Gu_Li-Lee_Sedol.sgf rename to data/games/1334-gokifu-20120916-Gu_Li-Lee_Sedol.sgf diff --git a/src/net/woodyfolsom/msproj/GameBoard.java b/src/net/woodyfolsom/msproj/GameBoard.java index e22db5b..62f19e0 100644 --- a/src/net/woodyfolsom/msproj/GameBoard.java +++ b/src/net/woodyfolsom/msproj/GameBoard.java @@ -19,6 +19,7 @@ public class GameBoard { private char[] board; private List captureList; private List boardHashHistory = new ArrayList(); + private ZobristHashGenerator zobristHashGenerator; public GameBoard(int size) { diff --git a/src/net/woodyfolsom/msproj/GameState.java b/src/net/woodyfolsom/msproj/GameState.java index 7b28c08..6f53b96 100644 --- a/src/net/woodyfolsom/msproj/GameState.java +++ b/src/net/woodyfolsom/msproj/GameState.java @@ -8,6 +8,7 @@ public class GameState { private int whitePrisoners = 0; private GameBoard gameBoard; private Player playerToMove; + private List moveHistory = new ArrayList(); public GameState(int size) { if (size < 1 || size > 19) { @@ -22,6 +23,7 @@ public class GameState { this.whitePrisoners = that.whitePrisoners; this.playerToMove = that.playerToMove; gameBoard = new GameBoard(that.gameBoard); + moveHistory = new ArrayList(that.moveHistory); } public void clearBoard() { @@ -90,6 +92,8 @@ public class GameState { if (action.isPass()) { playerToMove = GoGame.getNextPlayer(player); + //TODO will need to record player as well + moveHistory.add(action); return true; } @@ -104,7 +108,7 @@ public class GameState { return false; } - assertCorrectHash(); + //assertCorrectHash(); gameBoard.pushHashHistory(); @@ -202,10 +206,12 @@ public class GameState { } else { //assertCorrectHash(); playerToMove = GoGame.getNextPlayer(player); + moveHistory.add(action); return true; } } + /* @Deprecated private void assertCorrectHash() { long hashFromHistory = gameBoard.getZobristHash(); @@ -222,8 +228,17 @@ public class GameState { if (hashFromHistory != recalculatedHash) { throw new RuntimeException("Zobrist hash code mismatch"); } - } + }*/ + public boolean isTerminal() { + int nMoves = moveHistory.size(); + if (nMoves < 2) { + return false; //Impossible for a game to be over in 1 move unless the first player resigns + //before the first player has played, the game is considered to be 'not over' + } + return moveHistory.get(nMoves-1).isPass() && moveHistory.get(nMoves-2).isPass(); + } + public String toString() { int boardSize = gameBoard.getSize(); StringBuilder sb = new StringBuilder(" "); diff --git a/src/net/woodyfolsom/msproj/Referee.java b/src/net/woodyfolsom/msproj/Referee.java new file mode 100644 index 0000000..3125059 --- /dev/null +++ b/src/net/woodyfolsom/msproj/Referee.java @@ -0,0 +1,5 @@ +package net.woodyfolsom.msproj; + +public class Referee { + +} diff --git a/src/net/woodyfolsom/msproj/policy/MonteCarloUCT.java b/src/net/woodyfolsom/msproj/policy/MonteCarloUCT.java index 4b18413..41cae45 100644 --- a/src/net/woodyfolsom/msproj/policy/MonteCarloUCT.java +++ b/src/net/woodyfolsom/msproj/policy/MonteCarloUCT.java @@ -34,9 +34,15 @@ public class MonteCarloUCT extends MonteCarlo { for (Action action : node.getActions()) { GameTreeNode childNode = node.getChild(action); - MonteCarloProperties properties = childNode.getProperties(); - double childScore = (double) properties.getWins() / properties.getVisits() + TUNING_CONSTANT * Math.log(nodeVisits) / childNode.getProperties().getVisits(); - + double childScore; + if (childNode.getGameState().isTerminal()) { + childScore = 0.0; + } else { + MonteCarloProperties properties = childNode.getProperties(); + childScore = (double) (properties.getWins() / properties.getVisits()) + (2 * TUNING_CONSTANT * Math.sqrt(2 * Math.log(nodeVisits) / childNode.getProperties().getVisits())); + } + //TODO add random tie breaker? + //otherwise the child that is selected first will be biased if (childScore >= bestScore) { bestScore = childScore; bestNode = childNode; @@ -128,7 +134,7 @@ public class MonteCarloUCT extends MonteCarlo { public void update(GameTreeNode node, int reward) { GameTreeNode currentNode = node; while (currentNode != null) { - MonteCarloProperties nodeProperties = node.getProperties(); + MonteCarloProperties nodeProperties = currentNode.getProperties(); nodeProperties.setWins(nodeProperties.getWins() + reward); nodeProperties.setVisits(nodeProperties.getVisits() + 1); currentNode = currentNode.getParent(); diff --git a/src/net/woodyfolsom/msproj/sgf/CoordValue.java b/src/net/woodyfolsom/msproj/sgf/CoordValue.java deleted file mode 100644 index 7750c47..0000000 --- a/src/net/woodyfolsom/msproj/sgf/CoordValue.java +++ /dev/null @@ -1,13 +0,0 @@ -package net.woodyfolsom.msproj.sgf; - -public class CoordValue extends StrValue { - public final char column; - public final char row; - - public CoordValue(String coord) { - super(coord); - - column = coord.charAt(0); - row = coord.charAt(1); - } -} diff --git a/src/net/woodyfolsom/msproj/sgf/GameTree.java b/src/net/woodyfolsom/msproj/sgf/GameTree.java deleted file mode 100644 index 3fc3c49..0000000 --- a/src/net/woodyfolsom/msproj/sgf/GameTree.java +++ /dev/null @@ -1,35 +0,0 @@ -package net.woodyfolsom.msproj.sgf; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -public class GameTree { - private List nodeSequence = new ArrayList(); - private List subTrees = new ArrayList(); - - - public int getNodeCount() { - return nodeSequence.size(); - } - - public List getNodeSequence() { - return Collections.unmodifiableList(nodeSequence); - } - - public void setNodeSequence(List nodeSequence) { - this.nodeSequence.clear(); - - for(Node node : nodeSequence) { - this.nodeSequence.add(node); - } - } - - public void addSubTree(GameTree subTree) { - subTrees.add(subTree); - } - - public int getSubTreeCount() { - return subTrees.size(); - } -} diff --git a/src/net/woodyfolsom/msproj/sgf/Node.java b/src/net/woodyfolsom/msproj/sgf/Node.java deleted file mode 100644 index a7fac6f..0000000 --- a/src/net/woodyfolsom/msproj/sgf/Node.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.woodyfolsom.msproj.sgf; - -import java.util.ArrayList; -import java.util.List; - -public class Node { - private List properties = new ArrayList(); - - public void addProperty(SGFProperty property) { - properties.add(property); - } - - public int getPropertyCount() { - return properties.size(); - } -} diff --git a/src/net/woodyfolsom/msproj/sgf/NodeCollection.java b/src/net/woodyfolsom/msproj/sgf/NodeCollection.java deleted file mode 100644 index d311882..0000000 --- a/src/net/woodyfolsom/msproj/sgf/NodeCollection.java +++ /dev/null @@ -1,25 +0,0 @@ -package net.woodyfolsom.msproj.sgf; - -import java.util.ArrayList; -import java.util.List; - -public class NodeCollection { - private List gameTrees = new ArrayList(); - - public void add(GameTree gameTree) { - gameTrees.add(gameTree); - } - - public GameTree getGameTree(int index) { - return gameTrees.get(index); - } - - public int getGameTreeCount() { - return gameTrees.size(); - } - - @Override - public String toString() { - return "foo"; - } -} diff --git a/src/net/woodyfolsom/msproj/sgf/PlayerIdent.java b/src/net/woodyfolsom/msproj/sgf/PlayerIdent.java deleted file mode 100644 index c9e9c13..0000000 --- a/src/net/woodyfolsom/msproj/sgf/PlayerIdent.java +++ /dev/null @@ -1,7 +0,0 @@ -package net.woodyfolsom.msproj.sgf; - -public class PlayerIdent extends StrIdent { - public PlayerIdent(String player) { - super(player); - } -} diff --git a/src/net/woodyfolsom/msproj/sgf/ResultValue.java b/src/net/woodyfolsom/msproj/sgf/ResultValue.java deleted file mode 100644 index 44447f7..0000000 --- a/src/net/woodyfolsom/msproj/sgf/ResultValue.java +++ /dev/null @@ -1,7 +0,0 @@ -package net.woodyfolsom.msproj.sgf; - -public class ResultValue extends StrValue { - public ResultValue(String result) { - super(result); - } -} diff --git a/src/net/woodyfolsom/msproj/sgf/SGFCoord.java b/src/net/woodyfolsom/msproj/sgf/SGFCoord.java index 3537c30..c3cf28a 100644 --- a/src/net/woodyfolsom/msproj/sgf/SGFCoord.java +++ b/src/net/woodyfolsom/msproj/sgf/SGFCoord.java @@ -24,4 +24,9 @@ public class SGFCoord { public char getRow() { return row; } -} + + @Override + public String toString() { + return new String(new char[]{column,row}); + } +} \ No newline at end of file diff --git a/src/net/woodyfolsom/msproj/sgf/SGFGameTree.java b/src/net/woodyfolsom/msproj/sgf/SGFGameTree.java index 49826e1..b2b2780 100644 --- a/src/net/woodyfolsom/msproj/sgf/SGFGameTree.java +++ b/src/net/woodyfolsom/msproj/sgf/SGFGameTree.java @@ -4,6 +4,8 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import net.woodyfolsom.msproj.Player; + public class SGFGameTree { private List nodeSequence = new ArrayList(); private List subTrees = new ArrayList(); @@ -32,4 +34,88 @@ public class SGFGameTree { public int getSubTreeCount() { return subTrees.size(); } + + public String toLateXmoves(Player player) { + StringBuilder latexSB = new StringBuilder(); + SGFNode.TYPE nodeType; + SGFIdentifier sgfIdent; + if (player == Player.WHITE) { + nodeType = SGFNode.TYPE.MOVE_WHITE; + sgfIdent = SGFIdentifier.MOVE_WHITE; + latexSB.append("\\white{"); + } else if (player == Player.BLACK) { + nodeType = SGFNode.TYPE.MOVE_BLACK; + sgfIdent = SGFIdentifier.MOVE_BLACK; + latexSB.append("\\black{"); + } else { + throw new RuntimeException("Invalid player: " + player); + } + + boolean firstMove = true; + int nMoves = 0; + for (SGFNode node : nodeSequence) { + if (node.getType() != nodeType) { + continue; + } + SGFValue sgfValue = node.getFirstValue(sgfIdent); + if (sgfValue.isEmpty()) { + //TODO later this will be the LaTeX igo code for 'Pass'? + continue; + } + if (firstMove) { + firstMove = false; + } else { + latexSB.append(","); + } + SGFCoord sgfCoord = (SGFCoord) sgfValue.getValue(); + char column = sgfCoord.getColumn(); + if (column >= 'i') { + latexSB.append((char) (column + 1)); + } else { + latexSB.append(column); + } + latexSB.append(19 - sgfCoord.getRow() + 'a'); + nMoves++; + } + if (nMoves == 0) { + return ""; + } + latexSB.append("}\n"); + return latexSB.toString(); + } + + public String toLateX() { + StringBuilder latexSB = new StringBuilder(); + + //Somewhat convoluted logic here because the grammar does not require all root + //properties to be included in the same node in the tree's node sequence, although they should + //each be unique among all node sequences in the tree. + for (SGFNode node : nodeSequence) { + SGFNode.TYPE nodeType = node.getType(); + switch (nodeType) { + case ROOT : + latexSB.append("\\gobansize"); + latexSB.append("{"); + latexSB.append(node.getFirstValue(SGFIdentifier.SIZE)); + latexSB.append("}\n"); + latexSB.append("\\shortstack{\\showfullgoban\\\\"); + SGFResult result = (SGFResult) node.getFirstValue(SGFIdentifier.RESULT).getValue(); + latexSB.append(result.getFullText()); + latexSB.append("}\n"); + break; + default : + //ignore + } + } + return latexSB.toString(); + } + + public String toSGF() { + StringBuilder sgfFormatString = new StringBuilder("("); + for (SGFNode node : nodeSequence) { + sgfFormatString.append(node.toSGF()); + } + sgfFormatString.append(")"); + return sgfFormatString.toString(); + } } diff --git a/src/net/woodyfolsom/msproj/sgf/SGFLexer.java b/src/net/woodyfolsom/msproj/sgf/SGFLexer.java index efecca7..a9eeced 100644 --- a/src/net/woodyfolsom/msproj/sgf/SGFLexer.java +++ b/src/net/woodyfolsom/msproj/sgf/SGFLexer.java @@ -1,4 +1,4 @@ -// $ANTLR 3.4 C:\\Users\\Woody\\Documents\\antlr\\SGF.g 2012-09-23 16:20:53 +// $ANTLR 3.4 C:\\Users\\Woody\\Documents\\antlr\\SGF.g 2012-09-25 14:01:14 package net.woodyfolsom.msproj.sgf; import org.antlr.runtime.*; @@ -665,8 +665,8 @@ public class SGFLexer extends Lexer { try { int _type = LPAREN; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:147:9: ( '(' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:147:11: '(' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:150:9: ( '(' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:150:11: '(' { match('('); @@ -686,8 +686,8 @@ public class SGFLexer extends Lexer { try { int _type = SEMICOLON; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:149:11: ( ';' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:149:14: ';' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:152:11: ( ';' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:152:14: ';' { match(';'); @@ -707,7 +707,7 @@ public class SGFLexer extends Lexer { try { int _type = UCLETTER; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:151:10: ( 'A' .. 'Z' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:154:10: ( 'A' .. 'Z' ) // C:\\Users\\Woody\\Documents\\antlr\\SGF.g: { if ( (input.LA(1) >= 'A' && input.LA(1) <= 'Z') ) { @@ -736,7 +736,7 @@ public class SGFLexer extends Lexer { try { int _type = LCLETTER; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:153:10: ( 'a' .. 'z' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:156:10: ( 'a' .. 'z' ) // C:\\Users\\Woody\\Documents\\antlr\\SGF.g: { if ( (input.LA(1) >= 'a' && input.LA(1) <= 'z') ) { @@ -765,7 +765,7 @@ public class SGFLexer extends Lexer { try { int _type = DIGIT; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:155:8: ( '0' .. '9' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:158:8: ( '0' .. '9' ) // C:\\Users\\Woody\\Documents\\antlr\\SGF.g: { if ( (input.LA(1) >= '0' && input.LA(1) <= '9') ) { @@ -794,8 +794,8 @@ public class SGFLexer extends Lexer { try { int _type = LBRACKET; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:158:2: ( '[' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:158:4: '[' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:161:2: ( '[' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:161:4: '[' { match('['); @@ -815,8 +815,8 @@ public class SGFLexer extends Lexer { try { int _type = RBRACKET; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:161:2: ( ']' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:161:4: ']' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:164:2: ( ']' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:164:4: ']' { match(']'); @@ -836,8 +836,8 @@ public class SGFLexer extends Lexer { try { int _type = RPAREN; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:163:9: ( ')' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:163:11: ')' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:166:9: ( ')' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:166:11: ')' { match(')'); @@ -857,8 +857,8 @@ public class SGFLexer extends Lexer { try { int _type = COLON; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:165:8: ( ':' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:165:10: ':' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:168:8: ( ':' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:168:10: ':' { match(':'); @@ -878,8 +878,8 @@ public class SGFLexer extends Lexer { try { int _type = MINUS; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:167:8: ( '-' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:167:10: '-' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:170:8: ( '-' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:170:10: '-' { match('-'); @@ -899,8 +899,8 @@ public class SGFLexer extends Lexer { try { int _type = SPACE; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:169:8: ( ' ' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:169:10: ' ' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:172:8: ( ' ' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:172:10: ' ' { match(' '); @@ -920,8 +920,8 @@ public class SGFLexer extends Lexer { try { int _type = PERIOD; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:171:9: ( '.' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:171:11: '.' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:174:9: ( '.' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:174:11: '.' { match('.'); @@ -941,8 +941,8 @@ public class SGFLexer extends Lexer { try { int _type = COMMA; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:173:8: ( ',' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:173:10: ',' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:176:8: ( ',' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:176:10: ',' { match(','); @@ -962,8 +962,8 @@ public class SGFLexer extends Lexer { try { int _type = PLUS; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:175:7: ( '+' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:175:9: '+' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:178:7: ( '+' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:178:9: '+' { match('+'); @@ -983,8 +983,8 @@ public class SGFLexer extends Lexer { try { int _type = SLASH; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:177:8: ( '/' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:177:10: '/' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:180:8: ( '/' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:180:10: '/' { match('/'); @@ -1004,8 +1004,8 @@ public class SGFLexer extends Lexer { try { int _type = CR; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:179:5: ( '\\r' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:179:7: '\\r' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:182:5: ( '\\r' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:182:7: '\\r' { match('\r'); @@ -1027,8 +1027,8 @@ public class SGFLexer extends Lexer { try { int _type = NEWLINE; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:181:9: ( '\\n' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:181:11: '\\n' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:184:9: ( '\\n' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:184:11: '\\n' { match('\n'); diff --git a/src/net/woodyfolsom/msproj/sgf/SGFNode.java b/src/net/woodyfolsom/msproj/sgf/SGFNode.java index 76db7e6..bf36021 100644 --- a/src/net/woodyfolsom/msproj/sgf/SGFNode.java +++ b/src/net/woodyfolsom/msproj/sgf/SGFNode.java @@ -4,13 +4,55 @@ import java.util.ArrayList; import java.util.List; public class SGFNode { + public enum TYPE { ROOT, MOVE_BLACK, MOVE_WHITE, EMPTY } + private List properties = new ArrayList(); + private TYPE type = TYPE.EMPTY; public void addProperty(SGFProperty property) { + if (properties.size() == 0) { + SGFIdentifier sgfIdent = property.getIdentifier(); + if (sgfIdent == SGFIdentifier.MOVE_BLACK) { + type = TYPE.MOVE_BLACK; + } else if (sgfIdent == SGFIdentifier.MOVE_WHITE) { + type = TYPE.MOVE_WHITE; + } else { + type = TYPE.ROOT; + } + } properties.add(property); } public int getPropertyCount() { return properties.size(); } + + public TYPE getType() { + return type; + } + + public SGFValue getFirstValue(SGFIdentifier identifier) { + for (int i = 0; i < properties.size(); i++) { + if (identifier == properties.get(i).getIdentifier()) { + return properties.get(i).getValues().get(0); + } + } + throw new RuntimeException("SGFNode does not contain a property with identifier '" + identifier +"'"); + } + + public String toSGF() { + if (properties.size() == 0) { + throw new RuntimeException("SGFNode contains no properties"); + } + + SGFProperty firstProp = properties.get(0); + + String sgfFormatString = ";" + firstProp.toSGF(); + + for (int i = 1; i < properties.size(); i++) { + sgfFormatString += properties.get(i).toSGF(); + } + + return sgfFormatString; + } } diff --git a/src/net/woodyfolsom/msproj/sgf/SGFNodeCollection.java b/src/net/woodyfolsom/msproj/sgf/SGFNodeCollection.java index e36041c..3d4be22 100644 --- a/src/net/woodyfolsom/msproj/sgf/SGFNodeCollection.java +++ b/src/net/woodyfolsom/msproj/sgf/SGFNodeCollection.java @@ -3,6 +3,8 @@ package net.woodyfolsom.msproj.sgf; import java.util.ArrayList; import java.util.List; +import net.woodyfolsom.msproj.Player; + public class SGFNodeCollection { private List gameTrees = new ArrayList(); @@ -18,8 +20,29 @@ public class SGFNodeCollection { return gameTrees.size(); } + public String toLateX() { + StringBuilder latexFormatString = new StringBuilder(""); + SGFGameTree gameTree = gameTrees.get(0); + + latexFormatString.append(gameTree.toLateXmoves(Player.BLACK)); + latexFormatString.append(gameTree.toLateXmoves(Player.WHITE)); + latexFormatString.append("\\begin{center}\n"); + latexFormatString.append(gameTree.toLateX()); + latexFormatString.append("\\end{center}"); + + return latexFormatString.toString(); + } + + public String toSGF() { + String sgfFormatString = ""; + for (SGFGameTree gameTree : gameTrees) { + sgfFormatString += gameTree.toSGF(); + } + return sgfFormatString; + } + @Override public String toString() { - return "foo"; + return toSGF(); } } diff --git a/src/net/woodyfolsom/msproj/sgf/SGFParser.java b/src/net/woodyfolsom/msproj/sgf/SGFParser.java index 68820f2..d674482 100644 --- a/src/net/woodyfolsom/msproj/sgf/SGFParser.java +++ b/src/net/woodyfolsom/msproj/sgf/SGFParser.java @@ -1,4 +1,4 @@ -// $ANTLR 3.4 C:\\Users\\Woody\\Documents\\antlr\\SGF.g 2012-09-23 16:20:53 +// $ANTLR 3.4 C:\\Users\\Woody\\Documents\\antlr\\SGF.g 2012-09-25 14:01:13 package net.woodyfolsom.msproj.sgf; import org.antlr.runtime.*; @@ -362,7 +362,7 @@ public class SGFParser extends Parser { // $ANTLR start "property" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:33:1: property returns [SGFProperty sgfProperty] : ( ( numIdent ) ( ( LBRACKET numValue RBRACKET ) )+ | ( playerIdent ) ( LBRACKET ( coordValue )? RBRACKET )+ | ( strIdent ) ( ( LBRACKET RBRACKET ) ) | ( strIdent ) ( ( LBRACKET strValue RBRACKET ) )+ | ( result ) ( ( LBRACKET resValue RBRACKET ) )+ | ( komi ) ( ( LBRACKET realValue RBRACKET ) )+ | ( coordIdent ) ( ( LBRACKET coordValue RBRACKET ) )+ ); + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:33:1: property returns [SGFProperty sgfProperty] : ( ( numIdent ) ( ( LBRACKET numValue RBRACKET ) )+ | ( playerIdent ) ( ( LBRACKET RBRACKET ) )+ | ( playerIdent ) ( ( LBRACKET coordValue RBRACKET ) )+ | ( strIdent ) ( ( LBRACKET RBRACKET ) ) | ( strIdent ) ( ( LBRACKET strValue RBRACKET ) )+ | ( result ) ( ( LBRACKET resValue RBRACKET ) )+ | ( komi ) ( ( LBRACKET realValue RBRACKET ) )+ | ( coordIdent ) ( ( LBRACKET coordValue RBRACKET ) )+ ); public final SGFProperty property() throws RecognitionException { SGFProperty sgfProperty = null; @@ -373,27 +373,31 @@ public class SGFParser extends Parser { SGFIdentifier playerIdent7 =null; - SGFIdentifier strIdent8 =null; + SGFIdentifier playerIdent8 =null; - SGFIdentifier strIdent9 =null; + SGFParser.coordValue_return coordValue9 =null; - SGFParser.strValue_return strValue10 =null; + SGFIdentifier strIdent10 =null; - SGFParser.resValue_return resValue11 =null; + SGFIdentifier strIdent11 =null; - SGFParser.realValue_return realValue12 =null; + SGFParser.strValue_return strValue12 =null; - SGFIdentifier coordIdent13 =null; + SGFParser.resValue_return resValue13 =null; - SGFParser.coordValue_return coordValue14 =null; + SGFParser.realValue_return realValue14 =null; + + SGFIdentifier coordIdent15 =null; + + SGFParser.coordValue_return coordValue16 =null; sgfProperty = new SGFProperty(); try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:37:2: ( ( numIdent ) ( ( LBRACKET numValue RBRACKET ) )+ | ( playerIdent ) ( LBRACKET ( coordValue )? RBRACKET )+ | ( strIdent ) ( ( LBRACKET RBRACKET ) ) | ( strIdent ) ( ( LBRACKET strValue RBRACKET ) )+ | ( result ) ( ( LBRACKET resValue RBRACKET ) )+ | ( komi ) ( ( LBRACKET realValue RBRACKET ) )+ | ( coordIdent ) ( ( LBRACKET coordValue RBRACKET ) )+ ) - int alt12=7; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:37:2: ( ( numIdent ) ( ( LBRACKET numValue RBRACKET ) )+ | ( playerIdent ) ( ( LBRACKET RBRACKET ) )+ | ( playerIdent ) ( ( LBRACKET coordValue RBRACKET ) )+ | ( strIdent ) ( ( LBRACKET RBRACKET ) ) | ( strIdent ) ( ( LBRACKET strValue RBRACKET ) )+ | ( result ) ( ( LBRACKET resValue RBRACKET ) )+ | ( komi ) ( ( LBRACKET realValue RBRACKET ) )+ | ( coordIdent ) ( ( LBRACKET coordValue RBRACKET ) )+ ) + int alt12=8; switch ( input.LA(1) ) { case 31: case 32: @@ -417,7 +421,7 @@ public class SGFParser extends Parser { alt12=2; } else if ( (true) ) { - alt12=3; + alt12=4; } else { NoViableAltException nvae = @@ -439,10 +443,10 @@ public class SGFParser extends Parser { int LA12_32 = input.LA(6); if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; + alt12=3; } else if ( (true) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -453,7 +457,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_31 >= COLON && LA12_31 <= COMMA)||LA12_31==DIGIT||LA12_31==LCLETTER||LA12_31==MINUS||(LA12_31 >= PERIOD && LA12_31 <= PLUS)||(LA12_31 >= SLASH && LA12_31 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -464,7 +468,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_25 >= COLON && LA12_25 <= COMMA)||LA12_25==DIGIT||LA12_25==MINUS||(LA12_25 >= PERIOD && LA12_25 <= RBRACKET)||(LA12_25 >= SLASH && LA12_25 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -485,7 +489,7 @@ public class SGFParser extends Parser { case SPACE: case UCLETTER: { - alt12=4; + alt12=5; } break; default: @@ -520,7 +524,7 @@ public class SGFParser extends Parser { alt12=2; } else if ( (true) ) { - alt12=3; + alt12=4; } else { NoViableAltException nvae = @@ -542,10 +546,10 @@ public class SGFParser extends Parser { int LA12_32 = input.LA(6); if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; + alt12=3; } else if ( (true) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -556,7 +560,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_31 >= COLON && LA12_31 <= COMMA)||LA12_31==DIGIT||LA12_31==LCLETTER||LA12_31==MINUS||(LA12_31 >= PERIOD && LA12_31 <= PLUS)||(LA12_31 >= SLASH && LA12_31 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -567,7 +571,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_25 >= COLON && LA12_25 <= COMMA)||LA12_25==DIGIT||LA12_25==MINUS||(LA12_25 >= PERIOD && LA12_25 <= RBRACKET)||(LA12_25 >= SLASH && LA12_25 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -588,7 +592,7 @@ public class SGFParser extends Parser { case SPACE: case UCLETTER: { - alt12=4; + alt12=5; } break; default: @@ -623,7 +627,7 @@ public class SGFParser extends Parser { alt12=2; } else if ( (true) ) { - alt12=3; + alt12=4; } else { NoViableAltException nvae = @@ -645,10 +649,10 @@ public class SGFParser extends Parser { int LA12_32 = input.LA(6); if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; + alt12=3; } else if ( (true) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -659,7 +663,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_31 >= COLON && LA12_31 <= COMMA)||LA12_31==DIGIT||LA12_31==LCLETTER||LA12_31==MINUS||(LA12_31 >= PERIOD && LA12_31 <= PLUS)||(LA12_31 >= SLASH && LA12_31 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -670,7 +674,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_25 >= COLON && LA12_25 <= COMMA)||LA12_25==DIGIT||LA12_25==MINUS||(LA12_25 >= PERIOD && LA12_25 <= RBRACKET)||(LA12_25 >= SLASH && LA12_25 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -691,7 +695,7 @@ public class SGFParser extends Parser { case SPACE: case UCLETTER: { - alt12=4; + alt12=5; } break; default: @@ -726,7 +730,7 @@ public class SGFParser extends Parser { alt12=2; } else if ( (true) ) { - alt12=3; + alt12=4; } else { NoViableAltException nvae = @@ -748,10 +752,10 @@ public class SGFParser extends Parser { int LA12_32 = input.LA(6); if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; + alt12=3; } else if ( (true) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -762,7 +766,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_31 >= COLON && LA12_31 <= COMMA)||LA12_31==DIGIT||LA12_31==LCLETTER||LA12_31==MINUS||(LA12_31 >= PERIOD && LA12_31 <= PLUS)||(LA12_31 >= SLASH && LA12_31 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -773,7 +777,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_25 >= COLON && LA12_25 <= COMMA)||LA12_25==DIGIT||LA12_25==MINUS||(LA12_25 >= PERIOD && LA12_25 <= RBRACKET)||(LA12_25 >= SLASH && LA12_25 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -794,7 +798,7 @@ public class SGFParser extends Parser { case SPACE: case UCLETTER: { - alt12=4; + alt12=5; } break; default: @@ -829,7 +833,7 @@ public class SGFParser extends Parser { alt12=2; } else if ( (true) ) { - alt12=3; + alt12=4; } else { NoViableAltException nvae = @@ -851,10 +855,10 @@ public class SGFParser extends Parser { int LA12_32 = input.LA(6); if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; + alt12=3; } else if ( (true) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -865,7 +869,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_31 >= COLON && LA12_31 <= COMMA)||LA12_31==DIGIT||LA12_31==LCLETTER||LA12_31==MINUS||(LA12_31 >= PERIOD && LA12_31 <= PLUS)||(LA12_31 >= SLASH && LA12_31 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -876,7 +880,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_25 >= COLON && LA12_25 <= COMMA)||LA12_25==DIGIT||LA12_25==MINUS||(LA12_25 >= PERIOD && LA12_25 <= RBRACKET)||(LA12_25 >= SLASH && LA12_25 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -897,7 +901,7 @@ public class SGFParser extends Parser { case SPACE: case UCLETTER: { - alt12=4; + alt12=5; } break; default: @@ -932,7 +936,7 @@ public class SGFParser extends Parser { alt12=2; } else if ( (true) ) { - alt12=3; + alt12=4; } else { NoViableAltException nvae = @@ -954,10 +958,10 @@ public class SGFParser extends Parser { int LA12_32 = input.LA(6); if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; + alt12=3; } else if ( (true) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -968,7 +972,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_31 >= COLON && LA12_31 <= COMMA)||LA12_31==DIGIT||LA12_31==LCLETTER||LA12_31==MINUS||(LA12_31 >= PERIOD && LA12_31 <= PLUS)||(LA12_31 >= SLASH && LA12_31 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -979,7 +983,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_25 >= COLON && LA12_25 <= COMMA)||LA12_25==DIGIT||LA12_25==MINUS||(LA12_25 >= PERIOD && LA12_25 <= RBRACKET)||(LA12_25 >= SLASH && LA12_25 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -1000,7 +1004,7 @@ public class SGFParser extends Parser { case SPACE: case UCLETTER: { - alt12=4; + alt12=5; } break; default: @@ -1035,7 +1039,7 @@ public class SGFParser extends Parser { alt12=2; } else if ( (true) ) { - alt12=3; + alt12=4; } else { NoViableAltException nvae = @@ -1057,10 +1061,10 @@ public class SGFParser extends Parser { int LA12_32 = input.LA(6); if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; + alt12=3; } else if ( (true) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -1071,7 +1075,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_31 >= COLON && LA12_31 <= COMMA)||LA12_31==DIGIT||LA12_31==LCLETTER||LA12_31==MINUS||(LA12_31 >= PERIOD && LA12_31 <= PLUS)||(LA12_31 >= SLASH && LA12_31 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -1082,7 +1086,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_25 >= COLON && LA12_25 <= COMMA)||LA12_25==DIGIT||LA12_25==MINUS||(LA12_25 >= PERIOD && LA12_25 <= RBRACKET)||(LA12_25 >= SLASH && LA12_25 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -1103,7 +1107,7 @@ public class SGFParser extends Parser { case SPACE: case UCLETTER: { - alt12=4; + alt12=5; } break; default: @@ -1138,7 +1142,7 @@ public class SGFParser extends Parser { alt12=2; } else if ( (true) ) { - alt12=3; + alt12=4; } else { NoViableAltException nvae = @@ -1160,10 +1164,10 @@ public class SGFParser extends Parser { int LA12_32 = input.LA(6); if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; + alt12=3; } else if ( (true) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -1174,7 +1178,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_31 >= COLON && LA12_31 <= COMMA)||LA12_31==DIGIT||LA12_31==LCLETTER||LA12_31==MINUS||(LA12_31 >= PERIOD && LA12_31 <= PLUS)||(LA12_31 >= SLASH && LA12_31 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -1185,7 +1189,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_25 >= COLON && LA12_25 <= COMMA)||LA12_25==DIGIT||LA12_25==MINUS||(LA12_25 >= PERIOD && LA12_25 <= RBRACKET)||(LA12_25 >= SLASH && LA12_25 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -1206,7 +1210,7 @@ public class SGFParser extends Parser { case SPACE: case UCLETTER: { - alt12=4; + alt12=5; } break; default: @@ -1241,7 +1245,7 @@ public class SGFParser extends Parser { alt12=2; } else if ( (true) ) { - alt12=3; + alt12=4; } else { NoViableAltException nvae = @@ -1263,10 +1267,10 @@ public class SGFParser extends Parser { int LA12_32 = input.LA(6); if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; + alt12=3; } else if ( (true) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -1277,7 +1281,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_31 >= COLON && LA12_31 <= COMMA)||LA12_31==DIGIT||LA12_31==LCLETTER||LA12_31==MINUS||(LA12_31 >= PERIOD && LA12_31 <= PLUS)||(LA12_31 >= SLASH && LA12_31 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -1288,7 +1292,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_25 >= COLON && LA12_25 <= COMMA)||LA12_25==DIGIT||LA12_25==MINUS||(LA12_25 >= PERIOD && LA12_25 <= RBRACKET)||(LA12_25 >= SLASH && LA12_25 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -1309,7 +1313,7 @@ public class SGFParser extends Parser { case SPACE: case UCLETTER: { - alt12=4; + alt12=5; } break; default: @@ -1344,7 +1348,7 @@ public class SGFParser extends Parser { alt12=2; } else if ( (true) ) { - alt12=3; + alt12=4; } else { NoViableAltException nvae = @@ -1366,10 +1370,10 @@ public class SGFParser extends Parser { int LA12_32 = input.LA(6); if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; + alt12=3; } else if ( (true) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -1380,7 +1384,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_31 >= COLON && LA12_31 <= COMMA)||LA12_31==DIGIT||LA12_31==LCLETTER||LA12_31==MINUS||(LA12_31 >= PERIOD && LA12_31 <= PLUS)||(LA12_31 >= SLASH && LA12_31 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -1391,7 +1395,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_25 >= COLON && LA12_25 <= COMMA)||LA12_25==DIGIT||LA12_25==MINUS||(LA12_25 >= PERIOD && LA12_25 <= RBRACKET)||(LA12_25 >= SLASH && LA12_25 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -1412,7 +1416,7 @@ public class SGFParser extends Parser { case SPACE: case UCLETTER: { - alt12=4; + alt12=5; } break; case 22: @@ -1434,7 +1438,7 @@ public class SGFParser extends Parser { case 45: case 46: { - alt12=5; + alt12=6; } break; default: @@ -1469,7 +1473,7 @@ public class SGFParser extends Parser { alt12=2; } else if ( (true) ) { - alt12=3; + alt12=4; } else { NoViableAltException nvae = @@ -1491,10 +1495,10 @@ public class SGFParser extends Parser { int LA12_32 = input.LA(6); if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; + alt12=3; } else if ( (true) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -1505,7 +1509,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_31 >= COLON && LA12_31 <= COMMA)||LA12_31==DIGIT||LA12_31==LCLETTER||LA12_31==MINUS||(LA12_31 >= PERIOD && LA12_31 <= PLUS)||(LA12_31 >= SLASH && LA12_31 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -1516,7 +1520,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_25 >= COLON && LA12_25 <= COMMA)||LA12_25==DIGIT||LA12_25==MINUS||(LA12_25 >= PERIOD && LA12_25 <= RBRACKET)||(LA12_25 >= SLASH && LA12_25 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -1537,7 +1541,7 @@ public class SGFParser extends Parser { case SPACE: case UCLETTER: { - alt12=4; + alt12=5; } break; default: @@ -1572,7 +1576,7 @@ public class SGFParser extends Parser { alt12=2; } else if ( (true) ) { - alt12=3; + alt12=4; } else { NoViableAltException nvae = @@ -1594,10 +1598,10 @@ public class SGFParser extends Parser { int LA12_32 = input.LA(6); if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; + alt12=3; } else if ( (true) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -1608,7 +1612,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_31 >= COLON && LA12_31 <= COMMA)||LA12_31==DIGIT||LA12_31==LCLETTER||LA12_31==MINUS||(LA12_31 >= PERIOD && LA12_31 <= PLUS)||(LA12_31 >= SLASH && LA12_31 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -1619,7 +1623,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_25 >= COLON && LA12_25 <= COMMA)||LA12_25==DIGIT||LA12_25==MINUS||(LA12_25 >= PERIOD && LA12_25 <= RBRACKET)||(LA12_25 >= SLASH && LA12_25 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -1640,7 +1644,7 @@ public class SGFParser extends Parser { case SPACE: case UCLETTER: { - alt12=4; + alt12=5; } break; default: @@ -1675,7 +1679,7 @@ public class SGFParser extends Parser { alt12=2; } else if ( (true) ) { - alt12=3; + alt12=4; } else { NoViableAltException nvae = @@ -1697,10 +1701,10 @@ public class SGFParser extends Parser { int LA12_32 = input.LA(6); if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; + alt12=3; } else if ( (true) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -1711,7 +1715,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_31 >= COLON && LA12_31 <= COMMA)||LA12_31==DIGIT||LA12_31==LCLETTER||LA12_31==MINUS||(LA12_31 >= PERIOD && LA12_31 <= PLUS)||(LA12_31 >= SLASH && LA12_31 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -1722,7 +1726,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_25 >= COLON && LA12_25 <= COMMA)||LA12_25==DIGIT||LA12_25==MINUS||(LA12_25 >= PERIOD && LA12_25 <= RBRACKET)||(LA12_25 >= SLASH && LA12_25 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -1743,7 +1747,7 @@ public class SGFParser extends Parser { case SPACE: case UCLETTER: { - alt12=4; + alt12=5; } break; default: @@ -1778,7 +1782,7 @@ public class SGFParser extends Parser { alt12=2; } else if ( (true) ) { - alt12=3; + alt12=4; } else { NoViableAltException nvae = @@ -1800,10 +1804,10 @@ public class SGFParser extends Parser { int LA12_32 = input.LA(6); if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; + alt12=3; } else if ( (true) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -1814,7 +1818,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_31 >= COLON && LA12_31 <= COMMA)||LA12_31==DIGIT||LA12_31==LCLETTER||LA12_31==MINUS||(LA12_31 >= PERIOD && LA12_31 <= PLUS)||(LA12_31 >= SLASH && LA12_31 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -1825,7 +1829,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_25 >= COLON && LA12_25 <= COMMA)||LA12_25==DIGIT||LA12_25==MINUS||(LA12_25 >= PERIOD && LA12_25 <= RBRACKET)||(LA12_25 >= SLASH && LA12_25 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -1846,7 +1850,7 @@ public class SGFParser extends Parser { case SPACE: case UCLETTER: { - alt12=4; + alt12=5; } break; default: @@ -1881,7 +1885,7 @@ public class SGFParser extends Parser { alt12=2; } else if ( (true) ) { - alt12=3; + alt12=4; } else { NoViableAltException nvae = @@ -1903,10 +1907,10 @@ public class SGFParser extends Parser { int LA12_32 = input.LA(6); if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; + alt12=3; } else if ( (true) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -1917,7 +1921,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_31 >= COLON && LA12_31 <= COMMA)||LA12_31==DIGIT||LA12_31==LCLETTER||LA12_31==MINUS||(LA12_31 >= PERIOD && LA12_31 <= PLUS)||(LA12_31 >= SLASH && LA12_31 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -1928,7 +1932,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_25 >= COLON && LA12_25 <= COMMA)||LA12_25==DIGIT||LA12_25==MINUS||(LA12_25 >= PERIOD && LA12_25 <= RBRACKET)||(LA12_25 >= SLASH && LA12_25 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -1949,7 +1953,7 @@ public class SGFParser extends Parser { case SPACE: case UCLETTER: { - alt12=4; + alt12=5; } break; default: @@ -1984,7 +1988,7 @@ public class SGFParser extends Parser { alt12=2; } else if ( (true) ) { - alt12=3; + alt12=4; } else { NoViableAltException nvae = @@ -2006,10 +2010,10 @@ public class SGFParser extends Parser { int LA12_32 = input.LA(6); if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; + alt12=3; } else if ( (true) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -2020,7 +2024,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_31 >= COLON && LA12_31 <= COMMA)||LA12_31==DIGIT||LA12_31==LCLETTER||LA12_31==MINUS||(LA12_31 >= PERIOD && LA12_31 <= PLUS)||(LA12_31 >= SLASH && LA12_31 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -2031,7 +2035,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_25 >= COLON && LA12_25 <= COMMA)||LA12_25==DIGIT||LA12_25==MINUS||(LA12_25 >= PERIOD && LA12_25 <= RBRACKET)||(LA12_25 >= SLASH && LA12_25 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -2052,7 +2056,7 @@ public class SGFParser extends Parser { case SPACE: case UCLETTER: { - alt12=4; + alt12=5; } break; default: @@ -2087,7 +2091,7 @@ public class SGFParser extends Parser { alt12=2; } else if ( (true) ) { - alt12=3; + alt12=4; } else { NoViableAltException nvae = @@ -2109,10 +2113,10 @@ public class SGFParser extends Parser { int LA12_32 = input.LA(6); if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; + alt12=3; } else if ( (true) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -2123,7 +2127,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_31 >= COLON && LA12_31 <= COMMA)||LA12_31==DIGIT||LA12_31==LCLETTER||LA12_31==MINUS||(LA12_31 >= PERIOD && LA12_31 <= PLUS)||(LA12_31 >= SLASH && LA12_31 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -2134,7 +2138,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_25 >= COLON && LA12_25 <= COMMA)||LA12_25==DIGIT||LA12_25==MINUS||(LA12_25 >= PERIOD && LA12_25 <= RBRACKET)||(LA12_25 >= SLASH && LA12_25 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -2155,7 +2159,7 @@ public class SGFParser extends Parser { case SPACE: case UCLETTER: { - alt12=4; + alt12=5; } break; default: @@ -2190,7 +2194,7 @@ public class SGFParser extends Parser { alt12=2; } else if ( (true) ) { - alt12=3; + alt12=4; } else { NoViableAltException nvae = @@ -2212,10 +2216,10 @@ public class SGFParser extends Parser { int LA12_32 = input.LA(6); if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; + alt12=3; } else if ( (true) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -2226,7 +2230,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_31 >= COLON && LA12_31 <= COMMA)||LA12_31==DIGIT||LA12_31==LCLETTER||LA12_31==MINUS||(LA12_31 >= PERIOD && LA12_31 <= PLUS)||(LA12_31 >= SLASH && LA12_31 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -2237,7 +2241,7 @@ public class SGFParser extends Parser { } } else if ( ((LA12_25 >= COLON && LA12_25 <= COMMA)||LA12_25==DIGIT||LA12_25==MINUS||(LA12_25 >= PERIOD && LA12_25 <= RBRACKET)||(LA12_25 >= SLASH && LA12_25 <= UCLETTER)) ) { - alt12=4; + alt12=5; } else { NoViableAltException nvae = @@ -2258,7 +2262,7 @@ public class SGFParser extends Parser { case SPACE: case UCLETTER: { - alt12=4; + alt12=5; } break; default: @@ -2281,13 +2285,13 @@ public class SGFParser extends Parser { break; case 33: { - alt12=6; + alt12=7; } break; case 21: case 23: { - alt12=7; + alt12=8; } break; default: @@ -2366,7 +2370,7 @@ public class SGFParser extends Parser { } break; case 2 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:40:4: ( playerIdent ) ( LBRACKET ( coordValue )? RBRACKET )+ + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:40:4: ( playerIdent ) ( ( LBRACKET RBRACKET ) )+ { // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:40:4: ( playerIdent ) // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:40:5: playerIdent @@ -2382,7 +2386,67 @@ public class SGFParser extends Parser { } - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:40:71: ( LBRACKET ( coordValue )? RBRACKET )+ + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:40:71: ( ( LBRACKET RBRACKET ) )+ + int cnt6=0; + loop6: + do { + int alt6=2; + int LA6_0 = input.LA(1); + + if ( (LA6_0==LBRACKET) ) { + alt6=1; + } + + + switch (alt6) { + case 1 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:40:72: ( LBRACKET RBRACKET ) + { + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:40:72: ( LBRACKET RBRACKET ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:40:73: LBRACKET RBRACKET + { + match(input,LBRACKET,FOLLOW_LBRACKET_in_property170); + + match(input,RBRACKET,FOLLOW_RBRACKET_in_property172); + + } + + + sgfProperty.addValue(SGFValue.EMPTY); + + } + break; + + default : + if ( cnt6 >= 1 ) break loop6; + EarlyExitException eee = + new EarlyExitException(6, input); + throw eee; + } + cnt6++; + } while (true); + + + } + break; + case 3 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:41:4: ( playerIdent ) ( ( LBRACKET coordValue RBRACKET ) )+ + { + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:41:4: ( playerIdent ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:41:5: playerIdent + { + pushFollow(FOLLOW_playerIdent_in_property182); + playerIdent8=playerIdent(); + + state._fsp--; + + + sgfProperty.setIdentifier(playerIdent8); + + } + + + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:41:71: ( ( LBRACKET coordValue RBRACKET ) )+ int cnt7=0; loop7: do { @@ -2396,34 +2460,25 @@ public class SGFParser extends Parser { switch (alt7) { case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:40:72: LBRACKET ( coordValue )? RBRACKET + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:41:72: ( LBRACKET coordValue RBRACKET ) { - match(input,LBRACKET,FOLLOW_LBRACKET_in_property169); + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:41:72: ( LBRACKET coordValue RBRACKET ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:41:73: LBRACKET coordValue RBRACKET + { + match(input,LBRACKET,FOLLOW_LBRACKET_in_property188); - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:40:81: ( coordValue )? - int alt6=2; - int LA6_0 = input.LA(1); + pushFollow(FOLLOW_coordValue_in_property190); + coordValue9=coordValue(); - if ( (LA6_0==LCLETTER) ) { - alt6=1; - } - switch (alt6) { - case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:40:81: coordValue - { - pushFollow(FOLLOW_coordValue_in_property171); - coordValue(); - - state._fsp--; + state._fsp--; - } - break; + match(input,RBRACKET,FOLLOW_RBRACKET_in_property192); } - match(input,RBRACKET,FOLLOW_RBRACKET_in_property174); + sgfProperty.addValue(new SGFValue((coordValue9!=null?coordValue9.sgfCoord:null))); } break; @@ -2440,32 +2495,32 @@ public class SGFParser extends Parser { } break; - case 3 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:43:4: ( strIdent ) ( ( LBRACKET RBRACKET ) ) + case 4 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:44:4: ( strIdent ) ( ( LBRACKET RBRACKET ) ) { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:43:4: ( strIdent ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:43:5: strIdent + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:44:4: ( strIdent ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:44:5: strIdent { - pushFollow(FOLLOW_strIdent_in_property186); - strIdent8=strIdent(); + pushFollow(FOLLOW_strIdent_in_property206); + strIdent10=strIdent(); state._fsp--; - sgfProperty.setIdentifier(strIdent8); + sgfProperty.setIdentifier(strIdent10); } - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:43:64: ( ( LBRACKET RBRACKET ) ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:43:65: ( LBRACKET RBRACKET ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:44:64: ( ( LBRACKET RBRACKET ) ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:44:65: ( LBRACKET RBRACKET ) { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:43:65: ( LBRACKET RBRACKET ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:43:66: LBRACKET RBRACKET + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:44:65: ( LBRACKET RBRACKET ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:44:66: LBRACKET RBRACKET { - match(input,LBRACKET,FOLLOW_LBRACKET_in_property192); + match(input,LBRACKET,FOLLOW_LBRACKET_in_property212); - match(input,RBRACKET,FOLLOW_RBRACKET_in_property194); + match(input,RBRACKET,FOLLOW_RBRACKET_in_property214); } @@ -2477,24 +2532,24 @@ public class SGFParser extends Parser { } break; - case 4 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:44:4: ( strIdent ) ( ( LBRACKET strValue RBRACKET ) )+ + case 5 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:45:4: ( strIdent ) ( ( LBRACKET strValue RBRACKET ) )+ { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:44:4: ( strIdent ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:44:5: strIdent + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:45:4: ( strIdent ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:45:5: strIdent { - pushFollow(FOLLOW_strIdent_in_property203); - strIdent9=strIdent(); + pushFollow(FOLLOW_strIdent_in_property223); + strIdent11=strIdent(); state._fsp--; - sgfProperty.setIdentifier(strIdent9); + sgfProperty.setIdentifier(strIdent11); } - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:44:64: ( ( LBRACKET strValue RBRACKET ) )+ + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:45:64: ( ( LBRACKET strValue RBRACKET ) )+ int cnt8=0; loop8: do { @@ -2508,25 +2563,25 @@ public class SGFParser extends Parser { switch (alt8) { case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:44:65: ( LBRACKET strValue RBRACKET ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:45:65: ( LBRACKET strValue RBRACKET ) { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:44:65: ( LBRACKET strValue RBRACKET ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:44:66: LBRACKET strValue RBRACKET + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:45:65: ( LBRACKET strValue RBRACKET ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:45:66: LBRACKET strValue RBRACKET { - match(input,LBRACKET,FOLLOW_LBRACKET_in_property209); + match(input,LBRACKET,FOLLOW_LBRACKET_in_property229); - pushFollow(FOLLOW_strValue_in_property211); - strValue10=strValue(); + pushFollow(FOLLOW_strValue_in_property231); + strValue12=strValue(); state._fsp--; - match(input,RBRACKET,FOLLOW_RBRACKET_in_property213); + match(input,RBRACKET,FOLLOW_RBRACKET_in_property233); } - sgfProperty.addValue(new SGFValue((strValue10!=null?input.toString(strValue10.start,strValue10.stop):null))); + sgfProperty.addValue(new SGFValue((strValue12!=null?input.toString(strValue12.start,strValue12.stop):null))); } break; @@ -2543,13 +2598,13 @@ public class SGFParser extends Parser { } break; - case 5 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:46:4: ( result ) ( ( LBRACKET resValue RBRACKET ) )+ + case 6 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:47:4: ( result ) ( ( LBRACKET resValue RBRACKET ) )+ { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:46:4: ( result ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:46:5: result + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:47:4: ( result ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:47:5: result { - pushFollow(FOLLOW_result_in_property225); + pushFollow(FOLLOW_result_in_property245); result(); state._fsp--; @@ -2560,7 +2615,7 @@ public class SGFParser extends Parser { } - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:46:64: ( ( LBRACKET resValue RBRACKET ) )+ + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:47:64: ( ( LBRACKET resValue RBRACKET ) )+ int cnt9=0; loop9: do { @@ -2574,25 +2629,25 @@ public class SGFParser extends Parser { switch (alt9) { case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:46:65: ( LBRACKET resValue RBRACKET ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:47:65: ( LBRACKET resValue RBRACKET ) { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:46:65: ( LBRACKET resValue RBRACKET ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:46:66: LBRACKET resValue RBRACKET + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:47:65: ( LBRACKET resValue RBRACKET ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:47:66: LBRACKET resValue RBRACKET { - match(input,LBRACKET,FOLLOW_LBRACKET_in_property231); + match(input,LBRACKET,FOLLOW_LBRACKET_in_property251); - pushFollow(FOLLOW_resValue_in_property233); - resValue11=resValue(); + pushFollow(FOLLOW_resValue_in_property253); + resValue13=resValue(); state._fsp--; - match(input,RBRACKET,FOLLOW_RBRACKET_in_property235); + match(input,RBRACKET,FOLLOW_RBRACKET_in_property255); } - sgfProperty.addValue(new SGFValue(new SGFResult((resValue11!=null?input.toString(resValue11.start,resValue11.stop):null)))); + sgfProperty.addValue(new SGFValue(new SGFResult((resValue13!=null?input.toString(resValue13.start,resValue13.stop):null)))); } break; @@ -2609,13 +2664,13 @@ public class SGFParser extends Parser { } break; - case 6 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:47:4: ( komi ) ( ( LBRACKET realValue RBRACKET ) )+ + case 7 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:48:4: ( komi ) ( ( LBRACKET realValue RBRACKET ) )+ { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:47:4: ( komi ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:47:5: komi + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:48:4: ( komi ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:48:5: komi { - pushFollow(FOLLOW_komi_in_property245); + pushFollow(FOLLOW_komi_in_property265); komi(); state._fsp--; @@ -2626,7 +2681,7 @@ public class SGFParser extends Parser { } - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:47:60: ( ( LBRACKET realValue RBRACKET ) )+ + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:48:60: ( ( LBRACKET realValue RBRACKET ) )+ int cnt10=0; loop10: do { @@ -2640,25 +2695,25 @@ public class SGFParser extends Parser { switch (alt10) { case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:47:61: ( LBRACKET realValue RBRACKET ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:48:61: ( LBRACKET realValue RBRACKET ) { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:47:61: ( LBRACKET realValue RBRACKET ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:47:62: LBRACKET realValue RBRACKET + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:48:61: ( LBRACKET realValue RBRACKET ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:48:62: LBRACKET realValue RBRACKET { - match(input,LBRACKET,FOLLOW_LBRACKET_in_property251); + match(input,LBRACKET,FOLLOW_LBRACKET_in_property271); - pushFollow(FOLLOW_realValue_in_property253); - realValue12=realValue(); + pushFollow(FOLLOW_realValue_in_property273); + realValue14=realValue(); state._fsp--; - match(input,RBRACKET,FOLLOW_RBRACKET_in_property255); + match(input,RBRACKET,FOLLOW_RBRACKET_in_property275); } - sgfProperty.addValue(new SGFValue(Double.parseDouble((realValue12!=null?input.toString(realValue12.start,realValue12.stop):null)))); + sgfProperty.addValue(new SGFValue(Double.parseDouble((realValue14!=null?input.toString(realValue14.start,realValue14.stop):null)))); } break; @@ -2675,24 +2730,24 @@ public class SGFParser extends Parser { } break; - case 7 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:48:4: ( coordIdent ) ( ( LBRACKET coordValue RBRACKET ) )+ + case 8 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:49:4: ( coordIdent ) ( ( LBRACKET coordValue RBRACKET ) )+ { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:48:4: ( coordIdent ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:48:5: coordIdent + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:49:4: ( coordIdent ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:49:5: coordIdent { - pushFollow(FOLLOW_coordIdent_in_property265); - coordIdent13=coordIdent(); + pushFollow(FOLLOW_coordIdent_in_property285); + coordIdent15=coordIdent(); state._fsp--; - sgfProperty.setIdentifier(coordIdent13); + sgfProperty.setIdentifier(coordIdent15); } - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:48:67: ( ( LBRACKET coordValue RBRACKET ) )+ + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:49:67: ( ( LBRACKET coordValue RBRACKET ) )+ int cnt11=0; loop11: do { @@ -2706,25 +2761,25 @@ public class SGFParser extends Parser { switch (alt11) { case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:48:68: ( LBRACKET coordValue RBRACKET ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:49:68: ( LBRACKET coordValue RBRACKET ) { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:48:68: ( LBRACKET coordValue RBRACKET ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:48:69: LBRACKET coordValue RBRACKET + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:49:68: ( LBRACKET coordValue RBRACKET ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:49:69: LBRACKET coordValue RBRACKET { - match(input,LBRACKET,FOLLOW_LBRACKET_in_property270); + match(input,LBRACKET,FOLLOW_LBRACKET_in_property290); - pushFollow(FOLLOW_coordValue_in_property272); - coordValue14=coordValue(); + pushFollow(FOLLOW_coordValue_in_property292); + coordValue16=coordValue(); state._fsp--; - match(input,RBRACKET,FOLLOW_RBRACKET_in_property274); + match(input,RBRACKET,FOLLOW_RBRACKET_in_property294); } - sgfProperty.addValue(new SGFValue(new SGFCoord((coordValue14!=null?input.toString(coordValue14.start,coordValue14.stop):null)))); + sgfProperty.addValue(new SGFValue(new SGFCoord((coordValue16!=null?input.toString(coordValue16.start,coordValue16.stop):null)))); } break; @@ -2759,18 +2814,18 @@ public class SGFParser extends Parser { // $ANTLR start "playerIdent" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:52:1: playerIdent returns [SGFIdentifier sgfPlayer] : ({...}? strIdent |{...}? strIdent ); + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:53:1: playerIdent returns [SGFIdentifier sgfPlayer] : ({...}? strIdent |{...}? strIdent ); public final SGFIdentifier playerIdent() throws RecognitionException { SGFIdentifier sgfPlayer = null; - SGFIdentifier strIdent15 =null; + SGFIdentifier strIdent17 =null; - SGFIdentifier strIdent16 =null; + SGFIdentifier strIdent18 =null; try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:53:2: ({...}? strIdent |{...}? strIdent ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:54:2: ({...}? strIdent |{...}? strIdent ) int alt13=2; switch ( input.LA(1) ) { case 27: @@ -3125,36 +3180,36 @@ public class SGFParser extends Parser { switch (alt13) { case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:53:4: {...}? strIdent + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:54:4: {...}? strIdent { if ( !(((input.LT(1).getText().equals("W")))) ) { throw new FailedPredicateException(input, "playerIdent", "(input.LT(1).getText().equals(\"W\"))"); } - pushFollow(FOLLOW_strIdent_in_playerIdent297); - strIdent15=strIdent(); + pushFollow(FOLLOW_strIdent_in_playerIdent317); + strIdent17=strIdent(); state._fsp--; - sgfPlayer = strIdent15; + sgfPlayer = strIdent17; } break; case 2 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:54:4: {...}? strIdent + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:55:4: {...}? strIdent { if ( !(((input.LT(1).getText().equals("B")))) ) { throw new FailedPredicateException(input, "playerIdent", "(input.LT(1).getText().equals(\"B\"))"); } - pushFollow(FOLLOW_strIdent_in_playerIdent306); - strIdent16=strIdent(); + pushFollow(FOLLOW_strIdent_in_playerIdent326); + strIdent18=strIdent(); state._fsp--; - sgfPlayer = strIdent16; + sgfPlayer = strIdent18; } break; @@ -3176,13 +3231,13 @@ public class SGFParser extends Parser { // $ANTLR start "strIdent" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:57:1: strIdent returns [SGFIdentifier sgfIdent] : ( charEnc | source | blackCountry | whiteCountry | event | playerBlack | playerWhite | blackRank | whiteRank | result | rules | place | application | copyright | username | date | 'B' | 'W' ); + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:58:1: strIdent returns [SGFIdentifier sgfIdent] : ( charEnc | source | blackCountry | whiteCountry | event | playerBlack | playerWhite | blackRank | whiteRank | result | rules | place | application | copyright | username | date | 'B' | 'W' ); public final SGFIdentifier strIdent() throws RecognitionException { SGFIdentifier sgfIdent = null; try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:58:2: ( charEnc | source | blackCountry | whiteCountry | event | playerBlack | playerWhite | blackRank | whiteRank | result | rules | place | application | copyright | username | date | 'B' | 'W' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:59:2: ( charEnc | source | blackCountry | whiteCountry | event | playerBlack | playerWhite | blackRank | whiteRank | result | rules | place | application | copyright | username | date | 'B' | 'W' ) int alt14=18; switch ( input.LA(1) ) { case 27: @@ -3285,9 +3340,9 @@ public class SGFParser extends Parser { switch (alt14) { case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:58:4: charEnc + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:59:4: charEnc { - pushFollow(FOLLOW_charEnc_in_strIdent323); + pushFollow(FOLLOW_charEnc_in_strIdent343); charEnc(); state._fsp--; @@ -3298,9 +3353,9 @@ public class SGFParser extends Parser { } break; case 2 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:59:10: source + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:60:10: source { - pushFollow(FOLLOW_source_in_strIdent335); + pushFollow(FOLLOW_source_in_strIdent355); source(); state._fsp--; @@ -3309,9 +3364,9 @@ public class SGFParser extends Parser { } break; case 3 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:60:10: blackCountry + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:61:10: blackCountry { - pushFollow(FOLLOW_blackCountry_in_strIdent346); + pushFollow(FOLLOW_blackCountry_in_strIdent366); blackCountry(); state._fsp--; @@ -3320,9 +3375,9 @@ public class SGFParser extends Parser { } break; case 4 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:61:10: whiteCountry + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:62:10: whiteCountry { - pushFollow(FOLLOW_whiteCountry_in_strIdent357); + pushFollow(FOLLOW_whiteCountry_in_strIdent377); whiteCountry(); state._fsp--; @@ -3331,9 +3386,9 @@ public class SGFParser extends Parser { } break; case 5 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:62:4: event + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:63:4: event { - pushFollow(FOLLOW_event_in_strIdent362); + pushFollow(FOLLOW_event_in_strIdent382); event(); state._fsp--; @@ -3342,9 +3397,9 @@ public class SGFParser extends Parser { } break; case 6 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:63:4: playerBlack + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:64:4: playerBlack { - pushFollow(FOLLOW_playerBlack_in_strIdent367); + pushFollow(FOLLOW_playerBlack_in_strIdent387); playerBlack(); state._fsp--; @@ -3353,9 +3408,9 @@ public class SGFParser extends Parser { } break; case 7 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:64:4: playerWhite + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:65:4: playerWhite { - pushFollow(FOLLOW_playerWhite_in_strIdent372); + pushFollow(FOLLOW_playerWhite_in_strIdent392); playerWhite(); state._fsp--; @@ -3364,9 +3419,9 @@ public class SGFParser extends Parser { } break; case 8 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:65:4: blackRank + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:66:4: blackRank { - pushFollow(FOLLOW_blackRank_in_strIdent377); + pushFollow(FOLLOW_blackRank_in_strIdent397); blackRank(); state._fsp--; @@ -3375,9 +3430,9 @@ public class SGFParser extends Parser { } break; case 9 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:66:4: whiteRank + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:67:4: whiteRank { - pushFollow(FOLLOW_whiteRank_in_strIdent382); + pushFollow(FOLLOW_whiteRank_in_strIdent402); whiteRank(); state._fsp--; @@ -3386,9 +3441,9 @@ public class SGFParser extends Parser { } break; case 10 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:67:4: result + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:68:4: result { - pushFollow(FOLLOW_result_in_strIdent387); + pushFollow(FOLLOW_result_in_strIdent407); result(); state._fsp--; @@ -3397,9 +3452,9 @@ public class SGFParser extends Parser { } break; case 11 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:68:4: rules + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:69:4: rules { - pushFollow(FOLLOW_rules_in_strIdent392); + pushFollow(FOLLOW_rules_in_strIdent412); rules(); state._fsp--; @@ -3408,9 +3463,9 @@ public class SGFParser extends Parser { } break; case 12 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:69:4: place + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:70:4: place { - pushFollow(FOLLOW_place_in_strIdent397); + pushFollow(FOLLOW_place_in_strIdent417); place(); state._fsp--; @@ -3419,9 +3474,9 @@ public class SGFParser extends Parser { } break; case 13 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:70:12: application + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:71:12: application { - pushFollow(FOLLOW_application_in_strIdent410); + pushFollow(FOLLOW_application_in_strIdent430); application(); state._fsp--; @@ -3430,9 +3485,9 @@ public class SGFParser extends Parser { } break; case 14 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:71:11: copyright + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:72:11: copyright { - pushFollow(FOLLOW_copyright_in_strIdent422); + pushFollow(FOLLOW_copyright_in_strIdent442); copyright(); state._fsp--; @@ -3441,9 +3496,9 @@ public class SGFParser extends Parser { } break; case 15 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:72:11: username + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:73:11: username { - pushFollow(FOLLOW_username_in_strIdent434); + pushFollow(FOLLOW_username_in_strIdent454); username(); state._fsp--; @@ -3452,9 +3507,9 @@ public class SGFParser extends Parser { } break; case 16 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:73:11: date + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:74:11: date { - pushFollow(FOLLOW_date_in_strIdent446); + pushFollow(FOLLOW_date_in_strIdent466); date(); state._fsp--; @@ -3463,18 +3518,18 @@ public class SGFParser extends Parser { } break; case 17 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:74:11: 'B' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:75:11: 'B' { - match(input,24,FOLLOW_24_in_strIdent458); + match(input,24,FOLLOW_24_in_strIdent478); sgfIdent = SGFIdentifier.MOVE_BLACK; } break; case 18 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:75:11: 'W' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:76:11: 'W' { - match(input,44,FOLLOW_44_in_strIdent471); + match(input,44,FOLLOW_44_in_strIdent491); sgfIdent = SGFIdentifier.MOVE_WHITE; @@ -3498,18 +3553,18 @@ public class SGFParser extends Parser { // $ANTLR start "coordIdent" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:80:1: coordIdent returns [SGFIdentifier sgfIdent] : ( addBlack | addWhite ); + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:81:1: coordIdent returns [SGFIdentifier sgfIdent] : ( addBlack | addWhite ); public final SGFIdentifier coordIdent() throws RecognitionException { SGFIdentifier sgfIdent = null; - SGFIdentifier addBlack17 =null; + SGFIdentifier addBlack19 =null; - SGFIdentifier addWhite18 =null; + SGFIdentifier addWhite20 =null; try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:81:2: ( addBlack | addWhite ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:82:2: ( addBlack | addWhite ) int alt15=2; int LA15_0 = input.LA(1); @@ -3528,28 +3583,28 @@ public class SGFParser extends Parser { } switch (alt15) { case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:81:4: addBlack + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:82:4: addBlack { - pushFollow(FOLLOW_addBlack_in_coordIdent517); - addBlack17=addBlack(); + pushFollow(FOLLOW_addBlack_in_coordIdent537); + addBlack19=addBlack(); state._fsp--; - sgfIdent = addBlack17; + sgfIdent = addBlack19; } break; case 2 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:82:5: addWhite + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:83:5: addWhite { - pushFollow(FOLLOW_addWhite_in_coordIdent525); - addWhite18=addWhite(); + pushFollow(FOLLOW_addWhite_in_coordIdent545); + addWhite20=addWhite(); state._fsp--; - sgfIdent = addWhite18; + sgfIdent = addWhite20; } break; @@ -3571,13 +3626,13 @@ public class SGFParser extends Parser { // $ANTLR start "numIdent" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:85:1: numIdent returns [SGFIdentifier sgfIdent] : ( fileFormat | game | size | time ); + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:86:1: numIdent returns [SGFIdentifier sgfIdent] : ( fileFormat | game | size | time ); public final SGFIdentifier numIdent() throws RecognitionException { SGFIdentifier sgfIdent = null; try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:86:2: ( fileFormat | game | size | time ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:87:2: ( fileFormat | game | size | time ) int alt16=4; switch ( input.LA(1) ) { case 31: @@ -3610,9 +3665,9 @@ public class SGFParser extends Parser { switch (alt16) { case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:86:4: fileFormat + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:87:4: fileFormat { - pushFollow(FOLLOW_fileFormat_in_numIdent542); + pushFollow(FOLLOW_fileFormat_in_numIdent562); fileFormat(); state._fsp--; @@ -3623,9 +3678,9 @@ public class SGFParser extends Parser { } break; case 2 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:87:4: game + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:88:4: game { - pushFollow(FOLLOW_game_in_numIdent548); + pushFollow(FOLLOW_game_in_numIdent568); game(); state._fsp--; @@ -3636,9 +3691,9 @@ public class SGFParser extends Parser { } break; case 3 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:88:4: size + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:89:4: size { - pushFollow(FOLLOW_size_in_numIdent554); + pushFollow(FOLLOW_size_in_numIdent574); size(); state._fsp--; @@ -3649,9 +3704,9 @@ public class SGFParser extends Parser { } break; case 4 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:89:4: time + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:90:4: time { - pushFollow(FOLLOW_time_in_numIdent560); + pushFollow(FOLLOW_time_in_numIdent580); time(); state._fsp--; @@ -3683,20 +3738,20 @@ public class SGFParser extends Parser { // $ANTLR start "numValue" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:91:1: numValue returns [SGFValue sgfValue] : ( ( DIGIT )+ ) ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:92:1: numValue returns [SGFValue sgfValue] : ( ( DIGIT )+ ) ; public final SGFParser.numValue_return numValue() throws RecognitionException { SGFParser.numValue_return retval = new SGFParser.numValue_return(); retval.start = input.LT(1); try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:92:2: ( ( ( DIGIT )+ ) ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:92:4: ( ( DIGIT )+ ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:93:2: ( ( ( DIGIT )+ ) ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:93:4: ( ( DIGIT )+ ) { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:92:4: ( ( DIGIT )+ ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:92:5: ( DIGIT )+ + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:93:4: ( ( DIGIT )+ ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:93:5: ( DIGIT )+ { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:92:5: ( DIGIT )+ + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:93:5: ( DIGIT )+ int cnt17=0; loop17: do { @@ -3710,9 +3765,9 @@ public class SGFParser extends Parser { switch (alt17) { case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:92:5: DIGIT + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:93:5: DIGIT { - match(input,DIGIT,FOLLOW_DIGIT_in_numValue575); + match(input,DIGIT,FOLLOW_DIGIT_in_numValue595); } break; @@ -3753,13 +3808,13 @@ public class SGFParser extends Parser { // $ANTLR start "realIdent" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:94:1: realIdent : komi ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:95:1: realIdent : komi ; public final void realIdent() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:95:2: ( komi ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:95:4: komi + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:96:2: ( komi ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:96:4: komi { - pushFollow(FOLLOW_komi_in_realIdent588); + pushFollow(FOLLOW_komi_in_realIdent608); komi(); state._fsp--; @@ -3786,25 +3841,25 @@ public class SGFParser extends Parser { // $ANTLR start "resValue" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:97:1: resValue : playerIdent PLUS ( 'R' | realValue ) ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:98:1: resValue : playerIdent PLUS ( 'R' | realValue ) ; public final SGFParser.resValue_return resValue() throws RecognitionException { SGFParser.resValue_return retval = new SGFParser.resValue_return(); retval.start = input.LT(1); try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:98:2: ( playerIdent PLUS ( 'R' | realValue ) ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:98:4: playerIdent PLUS ( 'R' | realValue ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:99:2: ( playerIdent PLUS ( 'R' | realValue ) ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:99:4: playerIdent PLUS ( 'R' | realValue ) { - pushFollow(FOLLOW_playerIdent_in_resValue598); + pushFollow(FOLLOW_playerIdent_in_resValue618); playerIdent(); state._fsp--; - match(input,PLUS,FOLLOW_PLUS_in_resValue600); + match(input,PLUS,FOLLOW_PLUS_in_resValue620); - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:98:21: ( 'R' | realValue ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:99:21: ( 'R' | realValue ) int alt18=2; int LA18_0 = input.LA(1); @@ -3823,16 +3878,16 @@ public class SGFParser extends Parser { } switch (alt18) { case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:98:22: 'R' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:99:22: 'R' { - match(input,37,FOLLOW_37_in_resValue603); + match(input,37,FOLLOW_37_in_resValue623); } break; case 2 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:98:28: realValue + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:99:28: realValue { - pushFollow(FOLLOW_realValue_in_resValue607); + pushFollow(FOLLOW_realValue_in_resValue627); realValue(); state._fsp--; @@ -3868,17 +3923,17 @@ public class SGFParser extends Parser { // $ANTLR start "realValue" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:100:1: realValue : ( DIGIT )+ PERIOD ( DIGIT )+ ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:101:1: realValue : ( DIGIT )+ PERIOD ( DIGIT )+ ; public final SGFParser.realValue_return realValue() throws RecognitionException { SGFParser.realValue_return retval = new SGFParser.realValue_return(); retval.start = input.LT(1); try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:101:2: ( ( DIGIT )+ PERIOD ( DIGIT )+ ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:101:4: ( DIGIT )+ PERIOD ( DIGIT )+ + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:102:2: ( ( DIGIT )+ PERIOD ( DIGIT )+ ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:102:4: ( DIGIT )+ PERIOD ( DIGIT )+ { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:101:4: ( DIGIT )+ + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:102:4: ( DIGIT )+ int cnt19=0; loop19: do { @@ -3892,9 +3947,9 @@ public class SGFParser extends Parser { switch (alt19) { case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:101:4: DIGIT + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:102:4: DIGIT { - match(input,DIGIT,FOLLOW_DIGIT_in_realValue618); + match(input,DIGIT,FOLLOW_DIGIT_in_realValue638); } break; @@ -3909,9 +3964,9 @@ public class SGFParser extends Parser { } while (true); - match(input,PERIOD,FOLLOW_PERIOD_in_realValue621); + match(input,PERIOD,FOLLOW_PERIOD_in_realValue641); - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:101:18: ( DIGIT )+ + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:102:18: ( DIGIT )+ int cnt20=0; loop20: do { @@ -3925,9 +3980,9 @@ public class SGFParser extends Parser { switch (alt20) { case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:101:18: DIGIT + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:102:18: DIGIT { - match(input,DIGIT,FOLLOW_DIGIT_in_realValue623); + match(input,DIGIT,FOLLOW_DIGIT_in_realValue643); } break; @@ -3962,23 +4017,26 @@ public class SGFParser extends Parser { public static class coordValue_return extends ParserRuleReturnScope { + public SGFCoord sgfCoord; }; // $ANTLR start "coordValue" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:103:1: coordValue : LCLETTER LCLETTER ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:104:1: coordValue returns [SGFCoord sgfCoord] : LCLETTER LCLETTER ; public final SGFParser.coordValue_return coordValue() throws RecognitionException { SGFParser.coordValue_return retval = new SGFParser.coordValue_return(); retval.start = input.LT(1); try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:103:13: ( LCLETTER LCLETTER ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:103:15: LCLETTER LCLETTER + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:105:2: ( LCLETTER LCLETTER ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:105:4: LCLETTER LCLETTER { - match(input,LCLETTER,FOLLOW_LCLETTER_in_coordValue633); + match(input,LCLETTER,FOLLOW_LCLETTER_in_coordValue658); - match(input,LCLETTER,FOLLOW_LCLETTER_in_coordValue635); + match(input,LCLETTER,FOLLOW_LCLETTER_in_coordValue660); + + retval.sgfCoord = new SGFCoord(input.toString(retval.start,input.LT(-1))); } @@ -4001,13 +4059,13 @@ public class SGFParser extends Parser { // $ANTLR start "fileFormat" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:105:1: fileFormat : 'FF' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:108:1: fileFormat : 'FF' ; public final void fileFormat() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:106:2: ( 'FF' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:106:4: 'FF' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:109:2: ( 'FF' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:109:4: 'FF' { - match(input,31,FOLLOW_31_in_fileFormat645); + match(input,31,FOLLOW_31_in_fileFormat674); } @@ -4027,13 +4085,13 @@ public class SGFParser extends Parser { // $ANTLR start "game" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:107:1: game : 'GM' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:110:1: game : 'GM' ; public final void game() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:107:7: ( 'GM' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:107:9: 'GM' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:110:7: ( 'GM' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:110:9: 'GM' { - match(input,32,FOLLOW_32_in_game653); + match(input,32,FOLLOW_32_in_game682); } @@ -4053,13 +4111,13 @@ public class SGFParser extends Parser { // $ANTLR start "size" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:108:1: size : 'SZ' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:111:1: size : 'SZ' ; public final void size() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:108:7: ( 'SZ' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:108:9: 'SZ' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:111:7: ( 'SZ' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:111:9: 'SZ' { - match(input,41,FOLLOW_41_in_size661); + match(input,41,FOLLOW_41_in_size690); } @@ -4079,13 +4137,13 @@ public class SGFParser extends Parser { // $ANTLR start "charEnc" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:109:1: charEnc : 'CA' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:112:1: charEnc : 'CA' ; public final void charEnc() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:109:9: ( 'CA' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:109:11: 'CA' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:112:9: ( 'CA' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:112:11: 'CA' { - match(input,27,FOLLOW_27_in_charEnc668); + match(input,27,FOLLOW_27_in_charEnc697); } @@ -4105,13 +4163,13 @@ public class SGFParser extends Parser { // $ANTLR start "source" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:110:1: source : 'SO' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:113:1: source : 'SO' ; public final void source() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:110:8: ( 'SO' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:110:10: 'SO' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:113:8: ( 'SO' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:113:10: 'SO' { - match(input,40,FOLLOW_40_in_source675); + match(input,40,FOLLOW_40_in_source704); } @@ -4131,13 +4189,13 @@ public class SGFParser extends Parser { // $ANTLR start "blackCountry" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:111:1: blackCountry : 'BC' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:114:1: blackCountry : 'BC' ; public final void blackCountry() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:112:2: ( 'BC' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:112:4: 'BC' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:115:2: ( 'BC' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:115:4: 'BC' { - match(input,25,FOLLOW_25_in_blackCountry684); + match(input,25,FOLLOW_25_in_blackCountry713); } @@ -4157,13 +4215,13 @@ public class SGFParser extends Parser { // $ANTLR start "whiteCountry" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:113:1: whiteCountry : 'WC' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:116:1: whiteCountry : 'WC' ; public final void whiteCountry() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:114:2: ( 'WC' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:114:4: 'WC' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:117:2: ( 'WC' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:117:4: 'WC' { - match(input,45,FOLLOW_45_in_whiteCountry693); + match(input,45,FOLLOW_45_in_whiteCountry722); } @@ -4183,13 +4241,13 @@ public class SGFParser extends Parser { // $ANTLR start "event" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:115:1: event : 'EV' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:118:1: event : 'EV' ; public final void event() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:115:7: ( 'EV' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:115:9: 'EV' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:118:7: ( 'EV' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:118:9: 'EV' { - match(input,30,FOLLOW_30_in_event700); + match(input,30,FOLLOW_30_in_event729); } @@ -4209,13 +4267,13 @@ public class SGFParser extends Parser { // $ANTLR start "playerBlack" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:116:1: playerBlack : 'PB' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:119:1: playerBlack : 'PB' ; public final void playerBlack() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:117:2: ( 'PB' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:117:4: 'PB' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:120:2: ( 'PB' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:120:4: 'PB' { - match(input,34,FOLLOW_34_in_playerBlack708); + match(input,34,FOLLOW_34_in_playerBlack737); } @@ -4235,13 +4293,13 @@ public class SGFParser extends Parser { // $ANTLR start "playerWhite" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:118:1: playerWhite : 'PW' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:121:1: playerWhite : 'PW' ; public final void playerWhite() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:119:2: ( 'PW' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:119:4: 'PW' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:122:2: ( 'PW' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:122:4: 'PW' { - match(input,36,FOLLOW_36_in_playerWhite716); + match(input,36,FOLLOW_36_in_playerWhite745); } @@ -4261,13 +4319,13 @@ public class SGFParser extends Parser { // $ANTLR start "blackRank" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:120:1: blackRank : 'BR' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:123:1: blackRank : 'BR' ; public final void blackRank() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:121:2: ( 'BR' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:121:4: 'BR' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:124:2: ( 'BR' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:124:4: 'BR' { - match(input,26,FOLLOW_26_in_blackRank724); + match(input,26,FOLLOW_26_in_blackRank753); } @@ -4287,13 +4345,13 @@ public class SGFParser extends Parser { // $ANTLR start "whiteRank" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:122:1: whiteRank : 'WR' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:125:1: whiteRank : 'WR' ; public final void whiteRank() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:123:2: ( 'WR' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:123:5: 'WR' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:126:2: ( 'WR' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:126:5: 'WR' { - match(input,46,FOLLOW_46_in_whiteRank734); + match(input,46,FOLLOW_46_in_whiteRank763); } @@ -4313,13 +4371,13 @@ public class SGFParser extends Parser { // $ANTLR start "komi" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:124:1: komi : 'KM' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:127:1: komi : 'KM' ; public final void komi() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:124:7: ( 'KM' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:124:9: 'KM' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:127:7: ( 'KM' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:127:9: 'KM' { - match(input,33,FOLLOW_33_in_komi742); + match(input,33,FOLLOW_33_in_komi771); } @@ -4339,13 +4397,13 @@ public class SGFParser extends Parser { // $ANTLR start "result" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:125:1: result : 'RE' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:128:1: result : 'RE' ; public final void result() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:125:9: ( 'RE' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:125:11: 'RE' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:128:9: ( 'RE' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:128:11: 'RE' { - match(input,38,FOLLOW_38_in_result750); + match(input,38,FOLLOW_38_in_result779); } @@ -4365,13 +4423,13 @@ public class SGFParser extends Parser { // $ANTLR start "rules" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:126:1: rules : 'RU' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:129:1: rules : 'RU' ; public final void rules() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:126:7: ( 'RU' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:126:9: 'RU' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:129:7: ( 'RU' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:129:9: 'RU' { - match(input,39,FOLLOW_39_in_rules757); + match(input,39,FOLLOW_39_in_rules786); } @@ -4391,13 +4449,13 @@ public class SGFParser extends Parser { // $ANTLR start "place" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:127:1: place : 'PC' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:130:1: place : 'PC' ; public final void place() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:127:8: ( 'PC' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:127:11: 'PC' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:130:8: ( 'PC' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:130:11: 'PC' { - match(input,35,FOLLOW_35_in_place766); + match(input,35,FOLLOW_35_in_place795); } @@ -4417,13 +4475,13 @@ public class SGFParser extends Parser { // $ANTLR start "application" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:128:1: application : 'AP' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:131:1: application : 'AP' ; public final void application() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:129:2: ( 'AP' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:129:4: 'AP' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:132:2: ( 'AP' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:132:4: 'AP' { - match(input,22,FOLLOW_22_in_application774); + match(input,22,FOLLOW_22_in_application803); } @@ -4443,13 +4501,13 @@ public class SGFParser extends Parser { // $ANTLR start "time" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:130:1: time : 'TM' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:133:1: time : 'TM' ; public final void time() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:130:6: ( 'TM' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:130:8: 'TM' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:133:6: ( 'TM' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:133:8: 'TM' { - match(input,42,FOLLOW_42_in_time781); + match(input,42,FOLLOW_42_in_time810); } @@ -4469,13 +4527,13 @@ public class SGFParser extends Parser { // $ANTLR start "date" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:131:1: date : 'DT' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:134:1: date : 'DT' ; public final void date() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:131:7: ( 'DT' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:131:9: 'DT' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:134:7: ( 'DT' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:134:9: 'DT' { - match(input,29,FOLLOW_29_in_date789); + match(input,29,FOLLOW_29_in_date818); } @@ -4495,16 +4553,16 @@ public class SGFParser extends Parser { // $ANTLR start "addBlack" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:133:1: addBlack returns [SGFIdentifier sgfIdent] : 'AB' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:136:1: addBlack returns [SGFIdentifier sgfIdent] : 'AB' ; public final SGFIdentifier addBlack() throws RecognitionException { SGFIdentifier sgfIdent = null; try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:134:2: ( 'AB' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:134:4: 'AB' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:137:2: ( 'AB' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:137:4: 'AB' { - match(input,21,FOLLOW_21_in_addBlack802); + match(input,21,FOLLOW_21_in_addBlack831); sgfIdent = SGFIdentifier.ADD_BLACK; @@ -4526,16 +4584,16 @@ public class SGFParser extends Parser { // $ANTLR start "addWhite" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:137:1: addWhite returns [SGFIdentifier sgfIdent] : 'AW' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:140:1: addWhite returns [SGFIdentifier sgfIdent] : 'AW' ; public final SGFIdentifier addWhite() throws RecognitionException { SGFIdentifier sgfIdent = null; try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:138:2: ( 'AW' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:138:4: 'AW' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:141:2: ( 'AW' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:141:4: 'AW' { - match(input,23,FOLLOW_23_in_addWhite819); + match(input,23,FOLLOW_23_in_addWhite848); sgfIdent = SGFIdentifier.ADD_WHITE; @@ -4557,13 +4615,13 @@ public class SGFParser extends Parser { // $ANTLR start "copyright" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:141:1: copyright : 'CP' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:144:1: copyright : 'CP' ; public final void copyright() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:142:2: ( 'CP' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:142:4: 'CP' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:145:2: ( 'CP' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:145:4: 'CP' { - match(input,28,FOLLOW_28_in_copyright831); + match(input,28,FOLLOW_28_in_copyright860); } @@ -4583,13 +4641,13 @@ public class SGFParser extends Parser { // $ANTLR start "username" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:143:1: username : 'US' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:146:1: username : 'US' ; public final void username() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:143:9: ( 'US' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:143:11: 'US' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:146:9: ( 'US' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:146:11: 'US' { - match(input,43,FOLLOW_43_in_username837); + match(input,43,FOLLOW_43_in_username866); } @@ -4612,17 +4670,17 @@ public class SGFParser extends Parser { // $ANTLR start "strValue" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:145:1: strValue : ( UCLETTER | LCLETTER | MINUS | DIGIT | SPACE | PERIOD | COMMA | PLUS | SLASH | COLON )+ ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:148:1: strValue : ( UCLETTER | LCLETTER | MINUS | DIGIT | SPACE | PERIOD | COMMA | PLUS | SLASH | COLON )+ ; public final SGFParser.strValue_return strValue() throws RecognitionException { SGFParser.strValue_return retval = new SGFParser.strValue_return(); retval.start = input.LT(1); try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:145:10: ( ( UCLETTER | LCLETTER | MINUS | DIGIT | SPACE | PERIOD | COMMA | PLUS | SLASH | COLON )+ ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:145:12: ( UCLETTER | LCLETTER | MINUS | DIGIT | SPACE | PERIOD | COMMA | PLUS | SLASH | COLON )+ + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:148:10: ( ( UCLETTER | LCLETTER | MINUS | DIGIT | SPACE | PERIOD | COMMA | PLUS | SLASH | COLON )+ ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:148:12: ( UCLETTER | LCLETTER | MINUS | DIGIT | SPACE | PERIOD | COMMA | PLUS | SLASH | COLON )+ { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:145:12: ( UCLETTER | LCLETTER | MINUS | DIGIT | SPACE | PERIOD | COMMA | PLUS | SLASH | COLON )+ + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:148:12: ( UCLETTER | LCLETTER | MINUS | DIGIT | SPACE | PERIOD | COMMA | PLUS | SLASH | COLON )+ int cnt21=0; loop21: do { @@ -4697,87 +4755,90 @@ public class SGFParser extends Parser { public static final BitSet FOLLOW_numValue_in_property148 = new BitSet(new long[]{0x0000000000008000L}); public static final BitSet FOLLOW_RBRACKET_in_property150 = new BitSet(new long[]{0x0000000000000102L}); public static final BitSet FOLLOW_playerIdent_in_property164 = new BitSet(new long[]{0x0000000000000100L}); - public static final BitSet FOLLOW_LBRACKET_in_property169 = new BitSet(new long[]{0x0000000000008200L}); - public static final BitSet FOLLOW_coordValue_in_property171 = new BitSet(new long[]{0x0000000000008000L}); - public static final BitSet FOLLOW_RBRACKET_in_property174 = new BitSet(new long[]{0x0000000000000102L}); - public static final BitSet FOLLOW_strIdent_in_property186 = new BitSet(new long[]{0x0000000000000100L}); - public static final BitSet FOLLOW_LBRACKET_in_property192 = new BitSet(new long[]{0x0000000000008000L}); - public static final BitSet FOLLOW_RBRACKET_in_property194 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_strIdent_in_property203 = new BitSet(new long[]{0x0000000000000100L}); - public static final BitSet FOLLOW_LBRACKET_in_property209 = new BitSet(new long[]{0x00000000001C6AB0L}); - public static final BitSet FOLLOW_strValue_in_property211 = new BitSet(new long[]{0x0000000000008000L}); - public static final BitSet FOLLOW_RBRACKET_in_property213 = new BitSet(new long[]{0x0000000000000102L}); - public static final BitSet FOLLOW_result_in_property225 = new BitSet(new long[]{0x0000000000000100L}); - public static final BitSet FOLLOW_LBRACKET_in_property231 = new BitSet(new long[]{0x000079DC7F400000L}); - public static final BitSet FOLLOW_resValue_in_property233 = new BitSet(new long[]{0x0000000000008000L}); - public static final BitSet FOLLOW_RBRACKET_in_property235 = new BitSet(new long[]{0x0000000000000102L}); - public static final BitSet FOLLOW_komi_in_property245 = new BitSet(new long[]{0x0000000000000100L}); - public static final BitSet FOLLOW_LBRACKET_in_property251 = new BitSet(new long[]{0x0000000000000080L}); - public static final BitSet FOLLOW_realValue_in_property253 = new BitSet(new long[]{0x0000000000008000L}); + public static final BitSet FOLLOW_LBRACKET_in_property170 = new BitSet(new long[]{0x0000000000008000L}); + public static final BitSet FOLLOW_RBRACKET_in_property172 = new BitSet(new long[]{0x0000000000000102L}); + public static final BitSet FOLLOW_playerIdent_in_property182 = new BitSet(new long[]{0x0000000000000100L}); + public static final BitSet FOLLOW_LBRACKET_in_property188 = new BitSet(new long[]{0x0000000000000200L}); + public static final BitSet FOLLOW_coordValue_in_property190 = new BitSet(new long[]{0x0000000000008000L}); + public static final BitSet FOLLOW_RBRACKET_in_property192 = new BitSet(new long[]{0x0000000000000102L}); + public static final BitSet FOLLOW_strIdent_in_property206 = new BitSet(new long[]{0x0000000000000100L}); + public static final BitSet FOLLOW_LBRACKET_in_property212 = new BitSet(new long[]{0x0000000000008000L}); + public static final BitSet FOLLOW_RBRACKET_in_property214 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_strIdent_in_property223 = new BitSet(new long[]{0x0000000000000100L}); + public static final BitSet FOLLOW_LBRACKET_in_property229 = new BitSet(new long[]{0x00000000001C6AB0L}); + public static final BitSet FOLLOW_strValue_in_property231 = new BitSet(new long[]{0x0000000000008000L}); + public static final BitSet FOLLOW_RBRACKET_in_property233 = new BitSet(new long[]{0x0000000000000102L}); + public static final BitSet FOLLOW_result_in_property245 = new BitSet(new long[]{0x0000000000000100L}); + public static final BitSet FOLLOW_LBRACKET_in_property251 = new BitSet(new long[]{0x000079DC7F400000L}); + public static final BitSet FOLLOW_resValue_in_property253 = new BitSet(new long[]{0x0000000000008000L}); public static final BitSet FOLLOW_RBRACKET_in_property255 = new BitSet(new long[]{0x0000000000000102L}); - public static final BitSet FOLLOW_coordIdent_in_property265 = new BitSet(new long[]{0x0000000000000100L}); - public static final BitSet FOLLOW_LBRACKET_in_property270 = new BitSet(new long[]{0x0000000000000200L}); - public static final BitSet FOLLOW_coordValue_in_property272 = new BitSet(new long[]{0x0000000000008000L}); - public static final BitSet FOLLOW_RBRACKET_in_property274 = new BitSet(new long[]{0x0000000000000102L}); - public static final BitSet FOLLOW_strIdent_in_playerIdent297 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_strIdent_in_playerIdent306 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_charEnc_in_strIdent323 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_source_in_strIdent335 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_blackCountry_in_strIdent346 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_whiteCountry_in_strIdent357 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_event_in_strIdent362 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_playerBlack_in_strIdent367 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_playerWhite_in_strIdent372 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_blackRank_in_strIdent377 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_whiteRank_in_strIdent382 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_result_in_strIdent387 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_rules_in_strIdent392 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_place_in_strIdent397 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_application_in_strIdent410 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_copyright_in_strIdent422 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_username_in_strIdent434 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_date_in_strIdent446 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_24_in_strIdent458 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_44_in_strIdent471 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_addBlack_in_coordIdent517 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_addWhite_in_coordIdent525 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_fileFormat_in_numIdent542 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_game_in_numIdent548 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_size_in_numIdent554 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_time_in_numIdent560 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_DIGIT_in_numValue575 = new BitSet(new long[]{0x0000000000000082L}); - public static final BitSet FOLLOW_komi_in_realIdent588 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_playerIdent_in_resValue598 = new BitSet(new long[]{0x0000000000004000L}); - public static final BitSet FOLLOW_PLUS_in_resValue600 = new BitSet(new long[]{0x0000002000000080L}); - public static final BitSet FOLLOW_37_in_resValue603 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_realValue_in_resValue607 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_DIGIT_in_realValue618 = new BitSet(new long[]{0x0000000000002080L}); - public static final BitSet FOLLOW_PERIOD_in_realValue621 = new BitSet(new long[]{0x0000000000000080L}); - public static final BitSet FOLLOW_DIGIT_in_realValue623 = new BitSet(new long[]{0x0000000000000082L}); - public static final BitSet FOLLOW_LCLETTER_in_coordValue633 = new BitSet(new long[]{0x0000000000000200L}); - public static final BitSet FOLLOW_LCLETTER_in_coordValue635 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_31_in_fileFormat645 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_32_in_game653 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_41_in_size661 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_27_in_charEnc668 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_40_in_source675 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_25_in_blackCountry684 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_45_in_whiteCountry693 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_30_in_event700 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_34_in_playerBlack708 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_36_in_playerWhite716 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_26_in_blackRank724 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_46_in_whiteRank734 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_33_in_komi742 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_38_in_result750 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_39_in_rules757 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_35_in_place766 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_22_in_application774 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_42_in_time781 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_29_in_date789 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_21_in_addBlack802 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_23_in_addWhite819 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_28_in_copyright831 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_43_in_username837 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_komi_in_property265 = new BitSet(new long[]{0x0000000000000100L}); + public static final BitSet FOLLOW_LBRACKET_in_property271 = new BitSet(new long[]{0x0000000000000080L}); + public static final BitSet FOLLOW_realValue_in_property273 = new BitSet(new long[]{0x0000000000008000L}); + public static final BitSet FOLLOW_RBRACKET_in_property275 = new BitSet(new long[]{0x0000000000000102L}); + public static final BitSet FOLLOW_coordIdent_in_property285 = new BitSet(new long[]{0x0000000000000100L}); + public static final BitSet FOLLOW_LBRACKET_in_property290 = new BitSet(new long[]{0x0000000000000200L}); + public static final BitSet FOLLOW_coordValue_in_property292 = new BitSet(new long[]{0x0000000000008000L}); + public static final BitSet FOLLOW_RBRACKET_in_property294 = new BitSet(new long[]{0x0000000000000102L}); + public static final BitSet FOLLOW_strIdent_in_playerIdent317 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_strIdent_in_playerIdent326 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_charEnc_in_strIdent343 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_source_in_strIdent355 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_blackCountry_in_strIdent366 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_whiteCountry_in_strIdent377 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_event_in_strIdent382 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_playerBlack_in_strIdent387 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_playerWhite_in_strIdent392 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_blackRank_in_strIdent397 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_whiteRank_in_strIdent402 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_result_in_strIdent407 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_rules_in_strIdent412 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_place_in_strIdent417 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_application_in_strIdent430 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_copyright_in_strIdent442 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_username_in_strIdent454 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_date_in_strIdent466 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_24_in_strIdent478 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_44_in_strIdent491 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_addBlack_in_coordIdent537 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_addWhite_in_coordIdent545 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_fileFormat_in_numIdent562 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_game_in_numIdent568 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_size_in_numIdent574 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_time_in_numIdent580 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_DIGIT_in_numValue595 = new BitSet(new long[]{0x0000000000000082L}); + public static final BitSet FOLLOW_komi_in_realIdent608 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_playerIdent_in_resValue618 = new BitSet(new long[]{0x0000000000004000L}); + public static final BitSet FOLLOW_PLUS_in_resValue620 = new BitSet(new long[]{0x0000002000000080L}); + public static final BitSet FOLLOW_37_in_resValue623 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_realValue_in_resValue627 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_DIGIT_in_realValue638 = new BitSet(new long[]{0x0000000000002080L}); + public static final BitSet FOLLOW_PERIOD_in_realValue641 = new BitSet(new long[]{0x0000000000000080L}); + public static final BitSet FOLLOW_DIGIT_in_realValue643 = new BitSet(new long[]{0x0000000000000082L}); + public static final BitSet FOLLOW_LCLETTER_in_coordValue658 = new BitSet(new long[]{0x0000000000000200L}); + public static final BitSet FOLLOW_LCLETTER_in_coordValue660 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_31_in_fileFormat674 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_32_in_game682 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_41_in_size690 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_27_in_charEnc697 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_40_in_source704 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_25_in_blackCountry713 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_45_in_whiteCountry722 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_30_in_event729 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_34_in_playerBlack737 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_36_in_playerWhite745 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_26_in_blackRank753 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_46_in_whiteRank763 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_33_in_komi771 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_38_in_result779 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_39_in_rules786 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_35_in_place795 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_22_in_application803 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_42_in_time810 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_29_in_date818 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_21_in_addBlack831 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_23_in_addWhite848 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_28_in_copyright860 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_43_in_username866 = new BitSet(new long[]{0x0000000000000002L}); } \ No newline at end of file diff --git a/src/net/woodyfolsom/msproj/sgf/SGFProperty.java b/src/net/woodyfolsom/msproj/sgf/SGFProperty.java index 3dca4ee..5c79115 100644 --- a/src/net/woodyfolsom/msproj/sgf/SGFProperty.java +++ b/src/net/woodyfolsom/msproj/sgf/SGFProperty.java @@ -5,7 +5,7 @@ import java.util.Collections; import java.util.List; public class SGFProperty { - private SGFIdentifier ident; + private SGFIdentifier identifier; private List> values = new ArrayList>(); public void addValue(SGFValue value) { @@ -13,7 +13,7 @@ public class SGFProperty { } public SGFIdentifier getIdentifier() { - return ident; + return identifier; } public List> getValues() { @@ -21,6 +21,19 @@ public class SGFProperty { } public void setIdentifier(SGFIdentifier ident) { - this.ident = ident; - } + this.identifier = ident; + } + + public String toSGF() { + if (values.size() == 0) { + return identifier + "[]"; + } + + String sgfFormatString = identifier + "[" + values.get(0) + "]"; + for (int i = 1; i < values.size(); i++) { + sgfFormatString += "[" + values.get(i) + "]"; + } + + return sgfFormatString; + } } diff --git a/src/net/woodyfolsom/msproj/sgf/SGFResult.java b/src/net/woodyfolsom/msproj/sgf/SGFResult.java index b118860..490eead 100644 --- a/src/net/woodyfolsom/msproj/sgf/SGFResult.java +++ b/src/net/woodyfolsom/msproj/sgf/SGFResult.java @@ -18,6 +18,16 @@ public class SGFResult { } } + public String getFullText() { + if (resignation == false && tie == false) { + return winner.getColor() + " wins by " + score; + } else if (resignation == true && tie == false) { + return winner.getColor() + " wins by resignation"; + } else { + throw new UnsupportedOperationException("Not implemented"); + } + } + @Override public String toString() { if (resignation == false && tie == false) { diff --git a/src/net/woodyfolsom/msproj/sgf/SGFValue.java b/src/net/woodyfolsom/msproj/sgf/SGFValue.java index fdbfbe7..974b73e 100644 --- a/src/net/woodyfolsom/msproj/sgf/SGFValue.java +++ b/src/net/woodyfolsom/msproj/sgf/SGFValue.java @@ -11,6 +11,10 @@ public class SGFValue { this.value = value; } + public boolean isEmpty() { + return text.length() == 0; + } + public String getText() { return text; } @@ -18,4 +22,9 @@ public class SGFValue { public T getValue() { return value; } + + @Override + public String toString() { + return value.toString(); + } } diff --git a/src/net/woodyfolsom/msproj/sgf/SGFWriter.java b/src/net/woodyfolsom/msproj/sgf/SGFWriter.java deleted file mode 100644 index 8a41d18..0000000 --- a/src/net/woodyfolsom/msproj/sgf/SGFWriter.java +++ /dev/null @@ -1,5 +0,0 @@ -package net.woodyfolsom.msproj.sgf; - -public class SGFWriter { - -} diff --git a/test/net/woodyfolsom/msproj/sgf/1334-gokifu-20120916-Gu_Li-Lee_Sedol.sgf b/test/net/woodyfolsom/msproj/sgf/1334-gokifu-20120916-Gu_Li-Lee_Sedol.sgf new file mode 100644 index 0000000..af40f40 --- /dev/null +++ b/test/net/woodyfolsom/msproj/sgf/1334-gokifu-20120916-Gu_Li-Lee_Sedol.sgf @@ -0,0 +1,15 @@ +(;FF[4]GM[1]SZ[19]CA[UTF-8]SO[gokifu.com]BC[kr]WC[cn]EV[]PB[Lee Sedol]BR[9p]PW[Gu Li]WR[9p]KM[7.5] +DT[2012-09-16]RE[W+R];B[qd];W[dc];B[dq];W[do];B[pp];W[cq];B[de];W[cg];B[cc];W[gc];B[gd];W[hd];B[fc] +;W[fd];B[ge];W[fb];B[hc];W[ec];B[gb];W[fc];B[id];W[cd];B[he];W[oc];B[pe];W[qk];B[qi];W[qn];B[qo] +;W[pn];B[np];W[oj];B[oi];W[ni];B[nj];W[pi];B[oh];W[pj];B[ph];W[qh];B[qg];W[rh];B[ri];W[rg];B[rf] +;W[oo];B[op];W[mj];B[mc];W[nk];B[cr];W[cp];B[gq];W[md];B[nc];W[qf];B[sh];W[pg];B[sg];W[od];B[nd] +;W[oe];B[ne];W[nf];B[qg];W[og];B[nh];W[mh];B[mg];W[ng];B[qh];W[mf];B[lg];W[lf];B[ld];W[qc];B[rc] +;W[pb];B[rb];W[kg];B[lh];W[mi];B[dl];W[br];B[ce];W[bd];B[dg];W[dh];B[be];W[eg];B[fe];W[dd];B[df] +;W[ci];B[gl];W[fh];B[ad];W[bc];B[dr];W[dm];B[em];W[cm];B[gg];W[gh];B[jq];W[fo];B[il];W[hg];B[ho] +;W[lo];B[lq];W[kp];B[kq];W[ee];B[ef];W[ff];B[ed];W[gp];B[hq];W[ee];B[pf];W[of];B[ed];W[gn];B[ei] +;W[eh];B[ii];W[kd];B[kc];W[ke];B[nb];W[fl];B[fk];W[ek];B[fj];W[dj];B[gf];W[gm];B[kh];W[jh];B[jg] +;W[ig];B[jf];W[jd];B[je];W[kf];B[ki];W[jc];B[kb];W[jb];B[ib];W[ja];B[ob];W[ic];B[ih];W[ha];B[hb] +;W[ga];B[ma];W[hh];B[hk];W[kl];B[kk];W[jk];B[jj];W[lk];B[bg];W[bh];B[cf];W[ch];B[ag];W[ac];B[el] +;W[fm];B[ae];W[rn];B[ro];W[fq];B[fr];W[so];B[sp];W[sn];B[rp];W[gj];B[hj];W[ej];B[fi];W[gi];B[gk] +;W[bj];B[jl];W[kj];B[ik];W[fg];B[ee];W[eq];B[er];W[km];B[bs];W[ar];B[rk];W[rl];B[qj];W[no];B[mp] +;W[ql];B[qb];W[ia];B[hd];W[pc];B[pa];W[jo];B[hm];W[dp]) \ No newline at end of file diff --git a/test/net/woodyfolsom/msproj/sgf/CollectionTest.java b/test/net/woodyfolsom/msproj/sgf/CollectionTest.java new file mode 100644 index 0000000..0e8d287 --- /dev/null +++ b/test/net/woodyfolsom/msproj/sgf/CollectionTest.java @@ -0,0 +1,57 @@ +package net.woodyfolsom.msproj.sgf; + +import static org.junit.Assert.assertEquals; + +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; + +import org.antlr.runtime.ANTLRInputStream; +import org.antlr.runtime.ANTLRStringStream; +import org.antlr.runtime.CommonTokenStream; +import org.antlr.runtime.RecognitionException; +import org.junit.Test; + +public class CollectionTest { + public static final String TEST_SGF = + "(;FF[4]SZ[9]KM[5.5]RE[W+6.5]"+ + ";W[ee];B[];W[])"; + public static final String TEST_LATEX = + "\\white{e5}\n" + + "\\begin{center}\n" + + "\\gobansize{9}\n" + + "\\shortstack{\\showfullgoban\\\\White wins by 6.5}\n" + + "\\end{center}"; + + @Test + public void testToSGF() throws RecognitionException, IOException { + ByteArrayInputStream bis = new ByteArrayInputStream( + ("(;FF[4]SZ[9]KM[5.5]RE[W+6.5]" + + ";W[ee];B[];W[])" + ).getBytes()); + ANTLRStringStream in = new ANTLRInputStream(bis); + SGFLexer lexer = new SGFLexer(in); + CommonTokenStream tokens = new CommonTokenStream(lexer); + SGFParser parser = new SGFParser(tokens); + SGFNodeCollection nodeCollection = parser.collection(); + + assertEquals(TEST_SGF, nodeCollection.toSGF()); + } + + @Test + public void testToLaTeX() throws RecognitionException, IOException { + ByteArrayInputStream bis = new ByteArrayInputStream( + ("(;FF[4]SZ[9]RE[W+6.5]" + + ";W[ee];B[];W[])" + ).getBytes()); + ANTLRStringStream in = new ANTLRInputStream(bis); + SGFLexer lexer = new SGFLexer(in); + CommonTokenStream tokens = new CommonTokenStream(lexer); + SGFParser parser = new SGFParser(tokens); + SGFNodeCollection nodeCollection = parser.collection(); + + assertEquals(TEST_LATEX, nodeCollection.toLateX()); + } +} diff --git a/test/net/woodyfolsom/msproj/sgf/SGFParserTest.java b/test/net/woodyfolsom/msproj/sgf/SGFParserTest.java new file mode 100644 index 0000000..c96cd1d --- /dev/null +++ b/test/net/woodyfolsom/msproj/sgf/SGFParserTest.java @@ -0,0 +1,34 @@ +package net.woodyfolsom.msproj.sgf; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; + +import org.antlr.runtime.ANTLRInputStream; +import org.antlr.runtime.ANTLRStringStream; +import org.antlr.runtime.CommonTokenStream; +import org.antlr.runtime.RecognitionException; +import org.junit.Test; + +public class SGFParserTest { + + @Test + public void testParse() throws RecognitionException, IOException { + FileInputStream fis = new FileInputStream(new File("data/games/1334-gokifu-20120916-Gu_Li-Lee_Sedol.sgf")); + ANTLRStringStream in = new ANTLRInputStream(fis); + SGFLexer lexer = new SGFLexer(in); + CommonTokenStream tokens = new CommonTokenStream(lexer); + SGFParser parser = new SGFParser(tokens); + SGFNodeCollection nodeCollection = parser.collection(); + + System.out.println("To SGF:"); + System.out.println(nodeCollection.toSGF()); + System.out.println(""); + + System.out.println("To LaTeX:"); + System.out.println(nodeCollection.toLateX()); + System.out.println(""); + + } +}