From b60c176d39a2043825eab5a9facf3644a45c9219 Mon Sep 17 00:00:00 2001 From: Woody Folsom Date: Fri, 9 Nov 2012 18:40:51 -0500 Subject: [PATCH] Code cleanup; Initial implementation of root parallelization. --- src/net/woodyfolsom/msproj/Action.java | 1 - src/net/woodyfolsom/msproj/Command.java | 20 +- src/net/woodyfolsom/msproj/CommandParser.java | 39 +- src/net/woodyfolsom/msproj/GameBoard.java | 31 +- src/net/woodyfolsom/msproj/GameConfig.java | 26 +- .../woodyfolsom/msproj/GameController.java | 5 - src/net/woodyfolsom/msproj/GameResult.java | 61 +- src/net/woodyfolsom/msproj/GameState.java | 109 +- src/net/woodyfolsom/msproj/GoGame.java | 2 +- .../woodyfolsom/msproj/LibertyCounter.java | 47 +- src/net/woodyfolsom/msproj/Player.java | 21 +- src/net/woodyfolsom/msproj/Referee.java | 10 +- .../woodyfolsom/msproj/StandAloneGame.java | 60 +- .../woodyfolsom/msproj/TerritoryMarker.java | 34 +- .../msproj/policy/ActionGenerator.java | 4 +- .../woodyfolsom/msproj/policy/AlphaBeta.java | 25 +- .../msproj/policy/HumanKeyboardInput.java | 32 +- .../woodyfolsom/msproj/policy/Minimax.java | 23 +- .../woodyfolsom/msproj/policy/MonteCarlo.java | 105 +- .../msproj/policy/MonteCarloUCT.java | 128 +- src/net/woodyfolsom/msproj/policy/Policy.java | 9 +- .../msproj/policy/RandomMovePolicy.java | 57 +- .../msproj/policy/RootParallelization.java | 145 + .../msproj/policy/ValidMoveGenerator.java | 2 +- src/net/woodyfolsom/msproj/sgf/SGFCoord.java | 12 +- .../woodyfolsom/msproj/sgf/SGFGameTree.java | 58 +- .../woodyfolsom/msproj/sgf/SGFIdentifier.java | 6 +- src/net/woodyfolsom/msproj/sgf/SGFLexer.java | 3391 +++--- src/net/woodyfolsom/msproj/sgf/SGFNode.java | 26 +- .../msproj/sgf/SGFNodeCollection.java | 16 +- src/net/woodyfolsom/msproj/sgf/SGFParser.java | 9505 ++++++++--------- src/net/woodyfolsom/msproj/sgf/SGFValue.java | 12 +- src/net/woodyfolsom/msproj/sgf/StrValue.java | 2 +- .../msproj/tree/AlphaBetaProperties.java | 10 +- .../woodyfolsom/msproj/tree/GameTreeNode.java | 5 +- .../msproj/tree/MonteCarloProperties.java | 8 +- .../msproj/policy/AlphaBetaTest.java | 5 + .../msproj/policy/MonteCarloUCTTest.java | 3 + .../msproj/sgf/CollectionTest.java | 3 - .../woodyfolsom/msproj/sgf/SGFParserTest.java | 32 +- 40 files changed, 7046 insertions(+), 7044 deletions(-) delete mode 100644 src/net/woodyfolsom/msproj/GameController.java create mode 100644 src/net/woodyfolsom/msproj/policy/RootParallelization.java diff --git a/src/net/woodyfolsom/msproj/Action.java b/src/net/woodyfolsom/msproj/Action.java index 97b728f..7dd22a6 100644 --- a/src/net/woodyfolsom/msproj/Action.java +++ b/src/net/woodyfolsom/msproj/Action.java @@ -9,7 +9,6 @@ public class Action { private char column = 'x'; private int row = 0; - //private Player player; private String move; public static final Action NONE = new Action("NONE", 'x', 0); diff --git a/src/net/woodyfolsom/msproj/Command.java b/src/net/woodyfolsom/msproj/Command.java index 26440d4..cbb96af 100644 --- a/src/net/woodyfolsom/msproj/Command.java +++ b/src/net/woodyfolsom/msproj/Command.java @@ -1,38 +1,40 @@ package net.woodyfolsom.msproj; public class Command { - public enum TYPE { boardsize, clear_board, final_status_list, genmove, INVALID, komi, list_commands, name, play, quit, version }; - + public enum TYPE { + boardsize, clear_board, final_status_list, genmove, INVALID, komi, list_commands, name, play, quit, version + }; + private String[] cmdFields; private String text; private TYPE type; - + public Command(TYPE type, String text, String[] cmdFields) { this.type = type; this.text = text; this.cmdFields = cmdFields; } - + public double getDoubleField(int index) { return Double.valueOf(cmdFields[index]); } - + public int getIntField(int index) { return Integer.valueOf(cmdFields[index]); } - + public String getStringField(int index) { return cmdFields[index]; } - + public String getText() { return text; } - + public TYPE getType() { return type; } - + public String toString() { return "[" + type.toString() + "] " + text; } diff --git a/src/net/woodyfolsom/msproj/CommandParser.java b/src/net/woodyfolsom/msproj/CommandParser.java index 0dab934..d7679c1 100644 --- a/src/net/woodyfolsom/msproj/CommandParser.java +++ b/src/net/woodyfolsom/msproj/CommandParser.java @@ -6,8 +6,6 @@ public class CommandParser { private static final Logger LOGGER = Logger.getLogger(CommandParser.class .getName()); - //private static final String INT_PATTERN = "^(\\d+.*|-\\d+.*)"; - /** * This very simple parser converts a small subset of GTP command strings * into Commands. @@ -17,38 +15,43 @@ public class CommandParser { */ public static Command parse(String commandString) { LOGGER.info("Parsing command: " + commandString); - //split on whitespace + // split on whitespace if (commandString == null) { - return new Command(Command.TYPE.INVALID,commandString,new String[0]); + return new Command(Command.TYPE.INVALID, commandString, + new String[0]); } - + String cmdFields[] = commandString.split("\\s+"); if (cmdFields.length == 0) { - return new Command(Command.TYPE.INVALID,commandString,new String[0]); + return new Command(Command.TYPE.INVALID, commandString, + new String[0]); } - + if ("boardsize".equals(cmdFields[0])) { - return new Command(Command.TYPE.boardsize,commandString,cmdFields); + return new Command(Command.TYPE.boardsize, commandString, cmdFields); } else if ("clear_board".equals(cmdFields[0])) { - return new Command(Command.TYPE.clear_board,commandString,cmdFields); + return new Command(Command.TYPE.clear_board, commandString, + cmdFields); } else if ("final_status_list".equals(cmdFields[0])) { - return new Command(Command.TYPE.final_status_list,commandString,cmdFields); + return new Command(Command.TYPE.final_status_list, commandString, + cmdFields); } else if ("genmove".equals(cmdFields[0])) { - return new Command(Command.TYPE.genmove,commandString,cmdFields); + return new Command(Command.TYPE.genmove, commandString, cmdFields); } else if ("komi".equals(cmdFields[0])) { - return new Command(Command.TYPE.komi,commandString,cmdFields); + return new Command(Command.TYPE.komi, commandString, cmdFields); } else if ("list_commands".equals(cmdFields[0])) { - return new Command(Command.TYPE.list_commands,commandString,cmdFields); + return new Command(Command.TYPE.list_commands, commandString, + cmdFields); } else if ("name".equals(cmdFields[0])) { - return new Command(Command.TYPE.name,commandString,cmdFields); + return new Command(Command.TYPE.name, commandString, cmdFields); } else if ("play".equals(cmdFields[0])) { - return new Command(Command.TYPE.play,commandString,cmdFields); + return new Command(Command.TYPE.play, commandString, cmdFields); } else if ("quit".equals(cmdFields[0])) { - return new Command(Command.TYPE.quit,commandString,cmdFields); + return new Command(Command.TYPE.quit, commandString, cmdFields); } else if ("version".equals(cmdFields[0])) { - return new Command(Command.TYPE.version,commandString,cmdFields); + return new Command(Command.TYPE.version, commandString, cmdFields); } else { - return new Command(Command.TYPE.INVALID,commandString,cmdFields); + return new Command(Command.TYPE.INVALID, commandString, cmdFields); } } } diff --git a/src/net/woodyfolsom/msproj/GameBoard.java b/src/net/woodyfolsom/msproj/GameBoard.java index 62f19e0..60db6f9 100644 --- a/src/net/woodyfolsom/msproj/GameBoard.java +++ b/src/net/woodyfolsom/msproj/GameBoard.java @@ -19,7 +19,7 @@ public class GameBoard { private char[] board; private List captureList; private List boardHashHistory = new ArrayList(); - + private ZobristHashGenerator zobristHashGenerator; public GameBoard(int size) { @@ -143,11 +143,11 @@ public class GameBoard { public char getSymbolAt(char colLabel, int rowNumber) { return getSymbolAt(getColumnIndex(colLabel), rowNumber - 1); } - + public char getSymbolAt(int index) { return board[index]; } - + /** * 0-based. * @@ -222,7 +222,7 @@ public class GameBoard { for (int i = 0; i < board.length; i++) { if (board[i] == MARKED_GROUP) { board[i] = opponentSymbol; - setSymbolAt(i,EMPTY_INTERSECTION); + setSymbolAt(i, EMPTY_INTERSECTION); captureList.add(i); numReplaced++; } @@ -250,12 +250,13 @@ public class GameBoard { } } } - - //TODO change boardHashHistory to stack + + // TODO change boardHashHistory to stack public void popHashHistory() { - boardHashHistory.remove(boardHashHistory.get(boardHashHistory.size() - 1)); + boardHashHistory + .remove(boardHashHistory.get(boardHashHistory.size() - 1)); } - + public void pushHashHistory() { boardHashHistory.add(boardHashHistory.get(boardHashHistory.size() - 1)); } @@ -266,12 +267,14 @@ public class GameBoard { public void setSymbolAt(int index, char newSymbol) { char oldSymbol = board[index]; - - //TODO marked intersections should really be stored in - //a separate array to ensure that the hash code is always in sync with - //an actual or transitional board position - if (oldSymbol == MARKED_GROUP || newSymbol == MARKED_GROUP || oldSymbol == MARKED_TERRITORY || newSymbol == MARKED_TERRITORY) { - board[index] = newSymbol; + + // TODO marked intersections should really be stored in + // a separate array to ensure that the hash code is always in sync with + // an actual or transitional board position + if (oldSymbol == MARKED_GROUP || newSymbol == MARKED_GROUP + || oldSymbol == MARKED_TERRITORY + || newSymbol == MARKED_TERRITORY) { + board[index] = newSymbol; } else { int hashIndex = boardHashHistory.size() - 1; long currentHashCode = boardHashHistory.get(hashIndex); diff --git a/src/net/woodyfolsom/msproj/GameConfig.java b/src/net/woodyfolsom/msproj/GameConfig.java index 761f8ae..5095c7d 100644 --- a/src/net/woodyfolsom/msproj/GameConfig.java +++ b/src/net/woodyfolsom/msproj/GameConfig.java @@ -4,49 +4,49 @@ public class GameConfig { private double komi; private int size; private int timeLimit; - + public GameConfig(int size, double komi) { this(size); this.komi = komi; } - + public GameConfig(int size) { timeLimit = 0; this.size = size; - switch(size) { - case 9 : + switch (size) { + case 9: komi = 6.5; - default : + default: komi = 5.5; } } - + public GameConfig(GameConfig that) { this.komi = that.komi; this.size = that.size; this.timeLimit = that.timeLimit; } - + public double getKomi() { return komi; } - + public int getSize() { return size; } - - public int getTimeLimit(){ + + public int getTimeLimit() { return timeLimit; } - + public void setKomi(double komi) { this.komi = komi; } - + public void setSize(int size) { this.size = size; } - + public void setTimeLimit(int timeLimit) { this.timeLimit = timeLimit; } diff --git a/src/net/woodyfolsom/msproj/GameController.java b/src/net/woodyfolsom/msproj/GameController.java deleted file mode 100644 index afdac7e..0000000 --- a/src/net/woodyfolsom/msproj/GameController.java +++ /dev/null @@ -1,5 +0,0 @@ -package net.woodyfolsom.msproj; - -public class GameController { - -} \ No newline at end of file diff --git a/src/net/woodyfolsom/msproj/GameResult.java b/src/net/woodyfolsom/msproj/GameResult.java index 3bbeb28..2311262 100644 --- a/src/net/woodyfolsom/msproj/GameResult.java +++ b/src/net/woodyfolsom/msproj/GameResult.java @@ -1,25 +1,29 @@ package net.woodyfolsom.msproj; - public class GameResult { - public static final GameResult BLACK_BY_RESIGNATION = new GameResult(RESULT_TYPE.BLACK_BY_RESIGNATION); + public static final GameResult BLACK_BY_RESIGNATION = new GameResult( + RESULT_TYPE.BLACK_BY_RESIGNATION); public static final GameResult VOID = new GameResult(RESULT_TYPE.VOID); - public static final GameResult WHITE_BY_RESIGNATION = new GameResult(RESULT_TYPE.WHITE_BY_RESIGNATION); - + public static final GameResult WHITE_BY_RESIGNATION = new GameResult( + RESULT_TYPE.WHITE_BY_RESIGNATION); + private double komi; private int blackScore; private int whiteScore; private int normalizedZeroScore; - - public enum RESULT_TYPE { BLACK_BY_RESIGNATION, WHITE_BY_RESIGNATION, IN_PROGRESS, SCORED, VOID} - + + public enum RESULT_TYPE { + BLACK_BY_RESIGNATION, WHITE_BY_RESIGNATION, IN_PROGRESS, SCORED, VOID + } + private RESULT_TYPE resultType; - - public GameResult(int blackScore, int whiteScore, int size, double komi, boolean finished) { + + public GameResult(int blackScore, int whiteScore, int size, double komi, + boolean finished) { this.blackScore = blackScore; this.komi = komi; this.whiteScore = whiteScore; - this.normalizedZeroScore = size * size + ((int)(komi * 2)); + this.normalizedZeroScore = size * size + ((int) (komi * 2)); if (finished) { resultType = RESULT_TYPE.SCORED; } else { @@ -32,10 +36,10 @@ public class GameResult { blackScore = 0; whiteScore = 0; normalizedZeroScore = 0; - + this.resultType = resultType; } - + public double getBlackScore() { return blackScore; } @@ -43,17 +47,20 @@ public class GameResult { public int getNormalizedZeroScore() { return normalizedZeroScore; } - + /** - * Gets a representation for the game score as an integer. Lower numbers are better for white. - * The minimum value is 0 (Chinese scoring - white owns every intersection on 19x19 and has 9 stone komi). - * Likewise, the maximum value if 379x2 (black owns every intersection with zero komi). + * Gets a representation for the game score as an integer. Lower numbers are + * better for white. The minimum value is 0 (Chinese scoring - white owns + * every intersection on 19x19 and has 9 stone komi). Likewise, the maximum + * value if 379x2 (black owns every intersection with zero komi). + * * @return */ public int getNormalizedScore() { - return normalizedZeroScore + 2 * blackScore - ((int)(2 * (whiteScore + komi))); + return normalizedZeroScore + 2 * blackScore + - ((int) (2 * (whiteScore + komi))); } - + public double getScore(Player color) { if (color == Player.BLACK) { return getBlackScore(); @@ -63,9 +70,9 @@ public class GameResult { return 0.0; } } - + public double getWhiteScore() { - return (double)whiteScore + komi; + return (double) whiteScore + komi; } public boolean isWinner(Player player) { @@ -75,12 +82,12 @@ public class GameResult { return blackScore > whiteScore + komi; } } - + public String toString() { switch (resultType) { - case BLACK_BY_RESIGNATION : + case BLACK_BY_RESIGNATION: return "B+R"; - case SCORED : + case SCORED: double blackScore = getBlackScore(); double whiteScore = getWhiteScore(); if (blackScore > whiteScore) { @@ -90,12 +97,12 @@ public class GameResult { } else { return "DRAW"; } - case WHITE_BY_RESIGNATION : + case WHITE_BY_RESIGNATION: return "W+R"; - case IN_PROGRESS : - case VOID : // intentional fall-through + case IN_PROGRESS: + case VOID: // intentional fall-through return "Void"; - default : + default: return "?"; } } diff --git a/src/net/woodyfolsom/msproj/GameState.java b/src/net/woodyfolsom/msproj/GameState.java index bcf476a..a629174 100644 --- a/src/net/woodyfolsom/msproj/GameState.java +++ b/src/net/woodyfolsom/msproj/GameState.java @@ -10,7 +10,7 @@ public class GameState { private GameConfig gameConfig; private Player playerToMove; private List moveHistory = new ArrayList(); - + public GameState(GameConfig gameConfig) { this.gameConfig = gameConfig; int size = gameConfig.getSize(); @@ -40,27 +40,28 @@ public class GameState { public int getBlackPrisoners() { return blackPrisoners; } - + public GameResult getResult() { GameBoard markedBoard; - + if (gameBoard.isTerritoryMarked()) { markedBoard = gameBoard; } else { markedBoard = new GameBoard(gameBoard); TerritoryMarker.markTerritory(markedBoard); } - + int gameLength = moveHistory.size(); - - //This functionality duplicates isTerminal(), - //however for the result to be reported, we need to know - //how the game was terminated to differentiate between resignation, scored complete - //and (eventually) time out/forfeit. + + // This functionality duplicates isTerminal(), + // however for the result to be reported, we need to know + // how the game was terminated to differentiate between resignation, + // scored complete + // and (eventually) time out/forfeit. boolean isFinished = false; - + if (gameLength >= 1) { - if (moveHistory.get(gameLength-1).isResign()) { + if (moveHistory.get(gameLength - 1).isResign()) { if (gameLength % 2 == 1) { return GameResult.WHITE_BY_RESIGNATION; } else { @@ -68,21 +69,20 @@ public class GameState { } } if (gameLength >= 2) { - if (moveHistory.get(gameLength-1).isPass() - && moveHistory.get(gameLength-2).isPass()) { + if (moveHistory.get(gameLength - 1).isPass() + && moveHistory.get(gameLength - 2).isPass()) { isFinished = true; } } } - - int blackScore = gameBoard.countSymbols(GameBoard.BLACK_STONE,GameBoard.BLACK_TERRITORY); - int whiteScore = gameBoard.countSymbols(GameBoard.WHITE_STONE,GameBoard.WHITE_TERRITORY); - - return new GameResult( blackScore, - whiteScore, - markedBoard.getSize(), - gameConfig.getKomi(), - isFinished); + + int blackScore = gameBoard.countSymbols(GameBoard.BLACK_STONE, + GameBoard.BLACK_TERRITORY); + int whiteScore = gameBoard.countSymbols(GameBoard.WHITE_STONE, + GameBoard.WHITE_TERRITORY); + + return new GameResult(blackScore, whiteScore, markedBoard.getSize(), + gameConfig.getKomi(), isFinished); } public List getEmptyCoords() { @@ -92,7 +92,8 @@ public class GameState { for (int rowIndex = 0; rowIndex < gameBoard.getSize(); rowIndex++) { if (GameBoard.EMPTY_INTERSECTION == gameBoard.getSymbolAt( colIndex, rowIndex)) - emptyCoords.add(GameBoard.getCoordinate(colIndex, rowIndex)); + emptyCoords + .add(GameBoard.getCoordinate(colIndex, rowIndex)); } } @@ -106,11 +107,11 @@ public class GameState { public GameConfig getGameConfig() { return gameConfig; } - + public Player getPlayerToMove() { return playerToMove; } - + public int getWhitePrisoners() { return whitePrisoners; } @@ -135,13 +136,14 @@ public class GameState { */ public boolean playStone(Player player, Action action) { if (player != playerToMove) { - throw new IllegalArgumentException("Requested " + player + " move, but it is " + playerToMove +"'s turn!"); + throw new IllegalArgumentException("Requested " + player + + " move, but it is " + playerToMove + "'s turn!"); } - + if (player == Player.NONE) { throw new IllegalArgumentException("Cannot play as " + player); } - + if (action.isPass()) { playerToMove = GoGame.getNextPlayer(player); moveHistory.add(action); @@ -153,11 +155,11 @@ public class GameState { moveHistory.add(action); return true; } - + if (action.isNone()) { return false; } - + char currentStone = gameBoard.getSymbolAt(action.getColumn(), action.getRow()); @@ -165,17 +167,17 @@ public class GameState { return false; } - //assertCorrectHash(); - + // assertCorrectHash(); + gameBoard.pushHashHistory(); - + gameBoard.clearCaptureList(); - + // Place stone as requested, then check for (1) captured neighbors and // (2) illegal move due to 0 liberties. char stoneSymbol = player.getStoneSymbol(); - //Player opponent = GoGame.getNextPlayer(player); - + // Player opponent = GoGame.getNextPlayer(player); + gameBoard.setSymbolAt(action.getColumn(), action.getRow(), stoneSymbol); // look for captured adjacent groups and increment the prisoner counter @@ -232,13 +234,14 @@ public class GameState { // Moved test for 0 liberties until after attempting to capture // neighboring groups. - // This will only happen if no neighboring groups were capture, hence there is nothing to undo. + // This will only happen if no neighboring groups were capture, hence + // there is nothing to undo. // So return now. if (0 == LibertyCounter.countLiberties(gameBoard, action.getColumn(), action.getRow(), stoneSymbol)) { gameBoard.removeStone(action.getColumn(), action.getRow()); gameBoard.popHashHistory(); - + return false; } @@ -250,18 +253,19 @@ public class GameState { for (int i : captureList) { gameBoard.setSymbolAt(i, opponentSymbol); } - - //And finally, remove the originally played stone, which was never valid due to ko. + + // And finally, remove the originally played stone, which was never + // valid due to ko. gameBoard.removeStone(action.getColumn(), action.getRow()); - - gameBoard.clearCaptureList(); - + + gameBoard.clearCaptureList(); + gameBoard.popHashHistory(); - - //assertCorrectHash(); + + // assertCorrectHash(); return false; - } else { - //assertCorrectHash(); + } else { + // assertCorrectHash(); playerToMove = GoGame.getNextPlayer(player); moveHistory.add(action); return true; @@ -271,12 +275,15 @@ public class GameState { 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 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(); + 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/GoGame.java b/src/net/woodyfolsom/msproj/GoGame.java index 411472f..1dcffcb 100644 --- a/src/net/woodyfolsom/msproj/GoGame.java +++ b/src/net/woodyfolsom/msproj/GoGame.java @@ -13,8 +13,8 @@ import java.util.Properties; import net.woodyfolsom.msproj.Command.TYPE; import net.woodyfolsom.msproj.policy.AlphaBeta; import net.woodyfolsom.msproj.policy.Minimax; -import net.woodyfolsom.msproj.policy.Policy; import net.woodyfolsom.msproj.policy.MonteCarloUCT; +import net.woodyfolsom.msproj.policy.Policy; import net.woodyfolsom.msproj.policy.RandomMovePolicy; import org.apache.log4j.Logger; diff --git a/src/net/woodyfolsom/msproj/LibertyCounter.java b/src/net/woodyfolsom/msproj/LibertyCounter.java index 115cdc6..f03c7ae 100644 --- a/src/net/woodyfolsom/msproj/LibertyCounter.java +++ b/src/net/woodyfolsom/msproj/LibertyCounter.java @@ -1,21 +1,25 @@ package net.woodyfolsom.msproj; public class LibertyCounter { - public static int countLiberties(GameBoard gameBoard, char colLabel, int rowNum, char groupColor) { - return countLiberties(gameBoard, GameBoard.getColumnIndex(colLabel),rowNum-1,groupColor,false); + public static int countLiberties(GameBoard gameBoard, char colLabel, + int rowNum, char groupColor) { + return countLiberties(gameBoard, GameBoard.getColumnIndex(colLabel), + rowNum - 1, groupColor, false); } - - public static int countLiberties(GameBoard gameBoard, int col, int row, char groupColor, boolean markGroup) { + + public static int countLiberties(GameBoard gameBoard, int col, int row, + char groupColor, boolean markGroup) { int liberties = markGroup(gameBoard, col, row, groupColor); - + if (!markGroup) { gameBoard.unmarkGroup(groupColor); } - + return liberties; } - - public static int markGroup(GameBoard gameBoard, int col, int row, char groupColor) { + + public static int markGroup(GameBoard gameBoard, int col, int row, + char groupColor) { char stoneSymbol = gameBoard.getSymbolAt(col, row); if (stoneSymbol == GameBoard.EMPTY_INTERSECTION) { return 1; // one liberty @@ -27,27 +31,30 @@ public class LibertyCounter { int liberties = 0; gameBoard.setSymbolAt(col, row, GameBoard.MARKED_GROUP); if (col > 0) { - liberties += markGroup(gameBoard,col-1,row,groupColor); + liberties += markGroup(gameBoard, col - 1, row, groupColor); } if (col < gameBoard.getSize() - 1) { - liberties += markGroup(gameBoard,col+1,row,groupColor); + liberties += markGroup(gameBoard, col + 1, row, groupColor); } - if (row > 0) { - liberties += markGroup(gameBoard,col,row-1,groupColor); + if (row > 0) { + liberties += markGroup(gameBoard, col, row - 1, groupColor); } if (row < gameBoard.getSize() - 1) { - liberties += markGroup(gameBoard,col,row+1,groupColor); + liberties += markGroup(gameBoard, col, row + 1, groupColor); } return liberties; } - - if (groupColor == GameBoard.WHITE_STONE && stoneSymbol == GameBoard.BLACK_STONE) { - return 0; //opposing stone - not a liberty + + if (groupColor == GameBoard.WHITE_STONE + && stoneSymbol == GameBoard.BLACK_STONE) { + return 0; // opposing stone - not a liberty } - if (groupColor == GameBoard.BLACK_STONE && stoneSymbol == GameBoard.WHITE_STONE) { - return 0; //opposing stone - not a liberty + if (groupColor == GameBoard.BLACK_STONE + && stoneSymbol == GameBoard.WHITE_STONE) { + return 0; // opposing stone - not a liberty } - - throw new IllegalStateException("Cannot continue marking group - symbol at current location is not empty intersection, white stone, black stone or group marker"); + + throw new IllegalStateException( + "Cannot continue marking group - symbol at current location is not empty intersection, white stone, black stone or group marker"); } } diff --git a/src/net/woodyfolsom/msproj/Player.java b/src/net/woodyfolsom/msproj/Player.java index 328e362..62a0f4c 100644 --- a/src/net/woodyfolsom/msproj/Player.java +++ b/src/net/woodyfolsom/msproj/Player.java @@ -1,18 +1,21 @@ package net.woodyfolsom.msproj; public class Player { - public static final Player BLACK = new Player("BLACK", GameBoard.BLACK_STONE); - public static final Player NONE = new Player("NONE", GameBoard.EMPTY_INTERSECTION); - public static final Player WHITE = new Player("WHITE", GameBoard.WHITE_STONE); - + public static final Player BLACK = new Player("BLACK", + GameBoard.BLACK_STONE); + public static final Player NONE = new Player("NONE", + GameBoard.EMPTY_INTERSECTION); + public static final Player WHITE = new Player("WHITE", + GameBoard.WHITE_STONE); + private char stoneSymbol; private String name; - + private Player(String name, char stoneSymbol) { this.name = name; this.stoneSymbol = stoneSymbol; } - + public static Player getInstance(String stoneSymbol) { if ("b".equals(stoneSymbol)) { return Player.BLACK; @@ -22,15 +25,15 @@ public class Player { return Player.NONE; } } - + public char getStoneSymbol() { return stoneSymbol; } - + public boolean isNone() { return "NONE".equals(name); } - + @Override public String toString() { return name; diff --git a/src/net/woodyfolsom/msproj/Referee.java b/src/net/woodyfolsom/msproj/Referee.java index e94490f..3e3334d 100644 --- a/src/net/woodyfolsom/msproj/Referee.java +++ b/src/net/woodyfolsom/msproj/Referee.java @@ -12,7 +12,7 @@ import net.woodyfolsom.msproj.policy.Policy; public class Referee { private Policy blackPolicy; private Policy whitePolicy; - + public Policy getPolicy(Player player) { if (Player.BLACK.equals(player)) { return blackPolicy; @@ -37,7 +37,7 @@ public class Referee { public GameResult play(GameConfig gameConfig) { GameState gameState = new GameState(gameConfig); - + System.out.println("Game started."); try { @@ -55,9 +55,9 @@ public class Referee { ex.printStackTrace(); return GameResult.VOID; } - + GameResult result = gameState.getResult(); - + System.out.println("Game over. Result: " + result); DateFormat dateFormat = new SimpleDateFormat("yyMMddHHmmssZ"); @@ -84,7 +84,7 @@ public class Referee { } System.out.println("Game finished."); - + return result; } } diff --git a/src/net/woodyfolsom/msproj/StandAloneGame.java b/src/net/woodyfolsom/msproj/StandAloneGame.java index ea7d740..20aadd9 100644 --- a/src/net/woodyfolsom/msproj/StandAloneGame.java +++ b/src/net/woodyfolsom/msproj/StandAloneGame.java @@ -7,22 +7,31 @@ import net.woodyfolsom.msproj.policy.HumanKeyboardInput; import net.woodyfolsom.msproj.policy.MonteCarloUCT; import net.woodyfolsom.msproj.policy.Policy; import net.woodyfolsom.msproj.policy.RandomMovePolicy; +import net.woodyfolsom.msproj.policy.RootParallelization; public class StandAloneGame { - enum PLAYER_TYPE { HUMAN, UCT_FAST, UCT_SLOW }; - + enum PLAYER_TYPE { + HUMAN, ROOT_PAR, UCT_FAST, UCT_SLOW + }; + public static void main(String[] args) { if (args.length != 3) { - System.out.println("Incorrect # of arguments: use StandAloneGame <# rounds>"); - System.out.println("For example to play 10 games against MC UCT w/ slow moves: StandAloneGame UCT_SLOW HUMAN 10"); + System.out + .println("Incorrect # of arguments: use StandAloneGame <# rounds>"); + System.out + .println("For example to play 10 games against MC UCT w/ slow moves: StandAloneGame UCT_SLOW HUMAN 10"); } - new StandAloneGame().playGame(parsePlayerType(args[0]), parsePlayerType(args[1]), Integer.valueOf(args[2])); + new StandAloneGame().playGame(parsePlayerType(args[0]), + parsePlayerType(args[1]), Integer.valueOf(args[2])); } private static PLAYER_TYPE parsePlayerType(String playerTypeStr) { if ("UCT_FAST".equalsIgnoreCase(playerTypeStr)) { return PLAYER_TYPE.UCT_FAST; - } else if ("UCT_SLOW".equalsIgnoreCase(playerTypeStr) || "UCT".equalsIgnoreCase(playerTypeStr)) { + } else if ("ROOT_PAR".equalsIgnoreCase(playerTypeStr)) { + return PLAYER_TYPE.ROOT_PAR; + } else if ("UCT_SLOW".equalsIgnoreCase(playerTypeStr) + || "UCT".equalsIgnoreCase(playerTypeStr)) { return PLAYER_TYPE.UCT_SLOW; } else if ("HUMAN".equalsIgnoreCase(playerTypeStr)) { return PLAYER_TYPE.HUMAN; @@ -30,38 +39,43 @@ public class StandAloneGame { throw new RuntimeException("Unknown player type: " + playerTypeStr); } } - - public void playGame(PLAYER_TYPE playerType1, PLAYER_TYPE playerType2, int rounds) { - + + public void playGame(PLAYER_TYPE playerType1, PLAYER_TYPE playerType2, + int rounds) { + Policy player1 = getPolicy(playerType1); Policy player2 = getPolicy(playerType2); - + Referee referee = new Referee(); referee.setPolicy(Player.BLACK, player1); referee.setPolicy(Player.WHITE, player2); - + List results = new ArrayList(); GameConfig gameConfig = new GameConfig(5); - for (int round = 0; round < rounds; ) { + for (int round = 0; round < rounds; round++) { results.add(referee.play(gameConfig)); } - - System.out.println("Cumulative results for 10 games (BLACK=" + playerType1 + ", WHITE=" + playerType2 + ")"); - for (int i = 0; i < rounds; i ++) { - System.out.println(i +". " + results.get(i)); + + System.out.println("Cumulative results for " + rounds + " games (BLACK=" + + playerType1 + ", WHITE=" + playerType2 + ")"); + for (int i = 0; i < rounds; i++) { + System.out.println(i + ". " + results.get(i)); } } - + private Policy getPolicy(PLAYER_TYPE playerType) { switch (playerType) { - case HUMAN : + case HUMAN: return new HumanKeyboardInput(); - case UCT_SLOW : - return new MonteCarloUCT(new RandomMovePolicy(), 3000L); - case UCT_FAST : + case ROOT_PAR: + return new RootParallelization(3, 4000L); + case UCT_SLOW: + return new MonteCarloUCT(new RandomMovePolicy(), 4000L); + case UCT_FAST: return new MonteCarloUCT(new RandomMovePolicy(), 1000L); - default : - throw new IllegalArgumentException("Invalid PLAYER_TYPE: " + playerType); + default: + throw new IllegalArgumentException("Invalid PLAYER_TYPE: " + + playerType); } } } diff --git a/src/net/woodyfolsom/msproj/TerritoryMarker.java b/src/net/woodyfolsom/msproj/TerritoryMarker.java index ad0f1a1..6309044 100644 --- a/src/net/woodyfolsom/msproj/TerritoryMarker.java +++ b/src/net/woodyfolsom/msproj/TerritoryMarker.java @@ -5,19 +5,19 @@ public class TerritoryMarker { public static final char WHITE_TERRITORY = 'o'; public static final char UNOWNED_TERRITORY = '-'; public static final char TERRITORY_MARKER = '?'; - + public static final int EMPTY = 0; public static final int BLACK = 1; public static final int WHITE = 2; - + public static GameBoard markTerritory(GameBoard gameBoard) { for (int row = 0; row < gameBoard.getSize(); row++) { for (int col = 0; col < gameBoard.getSize(); col++) { - char symbol = gameBoard.getSymbolAt(col,row); + char symbol = gameBoard.getSymbolAt(col, row); if (symbol != '.') { continue; } - int ownedBy = findTerritory(gameBoard,col,row); + int ownedBy = findTerritory(gameBoard, col, row); if (ownedBy == BLACK) { gameBoard.markTerritory(BLACK_TERRITORY); } else if (ownedBy == WHITE) { @@ -30,9 +30,9 @@ public class TerritoryMarker { gameBoard.setTerritoryMarked(true); return gameBoard; } - + public static int getStoneColor(GameBoard gameBoard, int col, int row) { - char symbol = gameBoard.getSymbolAt(col,row); + char symbol = gameBoard.getSymbolAt(col, row); if (symbol == GameBoard.BLACK_STONE) { return BLACK; } else if (symbol == GameBoard.WHITE_STONE) { @@ -41,9 +41,9 @@ public class TerritoryMarker { return EMPTY; } } - + public static int findTerritory(GameBoard gameBoard, int col, int row) { - char symbol = gameBoard.getSymbolAt(col,row); + char symbol = gameBoard.getSymbolAt(col, row); if (symbol == GameBoard.BLACK_STONE) { return BLACK; @@ -52,23 +52,23 @@ public class TerritoryMarker { } else if (symbol == TERRITORY_MARKER) { return EMPTY; } - - gameBoard.markTerritory(col,row,TERRITORY_MARKER); + + gameBoard.markTerritory(col, row, TERRITORY_MARKER); int borderBits = EMPTY; - + if (col > 0) { - borderBits |= findTerritory(gameBoard,col-1,row); + borderBits |= findTerritory(gameBoard, col - 1, row); } if (col < gameBoard.getSize() - 1) { - borderBits |= findTerritory(gameBoard,col+1,row); + borderBits |= findTerritory(gameBoard, col + 1, row); } - if (row > 0) { - borderBits |= findTerritory(gameBoard,col,row-1); + if (row > 0) { + borderBits |= findTerritory(gameBoard, col, row - 1); } if (row < gameBoard.getSize() - 1) { - borderBits |= findTerritory(gameBoard,col,row+1); + borderBits |= findTerritory(gameBoard, col, row + 1); } - + return borderBits; } } \ No newline at end of file diff --git a/src/net/woodyfolsom/msproj/policy/ActionGenerator.java b/src/net/woodyfolsom/msproj/policy/ActionGenerator.java index 3216ba0..47f8261 100644 --- a/src/net/woodyfolsom/msproj/policy/ActionGenerator.java +++ b/src/net/woodyfolsom/msproj/policy/ActionGenerator.java @@ -10,10 +10,10 @@ import net.woodyfolsom.msproj.Player; public interface ActionGenerator { public static final int ALL_ACTIONS = 0; - + public List getActions(GameConfig gameConfig, GameState gameState, Player color, int numActions); - + public List getActions(GameConfig gameConfig, GameState gameState, Collection prohibitedMoves, Player color, int numActions); } diff --git a/src/net/woodyfolsom/msproj/policy/AlphaBeta.java b/src/net/woodyfolsom/msproj/policy/AlphaBeta.java index 4b69223..1b1aa3d 100644 --- a/src/net/woodyfolsom/msproj/policy/AlphaBeta.java +++ b/src/net/woodyfolsom/msproj/policy/AlphaBeta.java @@ -18,7 +18,7 @@ public class AlphaBeta implements Policy { private int lookAhead; private int numStateEvaluations = 0; - + public AlphaBeta() { this(DEFAULT_LOOKAHEAD); } @@ -52,8 +52,8 @@ public class AlphaBeta implements Policy { GameState gameState = new GameState(node.getGameState()); - List validMoves = validMoveGenerator.getActions( - node.getGameState().getGameConfig(), node.getGameState(), player, + List validMoves = validMoveGenerator.getActions(node + .getGameState().getGameConfig(), node.getGameState(), player, ActionGenerator.ALL_ACTIONS); boolean terminal = isTerminal(validMoves.size(), recursionLevels); @@ -64,9 +64,9 @@ public class AlphaBeta implements Policy { if (terminal) { node.getProperties().setReward( gameState.getResult().getNormalizedScore()); - + numStateEvaluations++; - + return bestAction; } else { @@ -111,8 +111,8 @@ public class AlphaBeta implements Policy { GameState gameState = new GameState(node.getGameState()); - List validMoves = validMoveGenerator.getActions( - node.getGameState().getGameConfig(), node.getGameState(), player, + List validMoves = validMoveGenerator.getActions(node + .getGameState().getGameConfig(), node.getGameState(), player, ActionGenerator.ALL_ACTIONS); boolean terminal = isTerminal(validMoves.size(), recursionLevels); @@ -123,9 +123,9 @@ public class AlphaBeta implements Policy { if (terminal) { node.getProperties().setReward( gameState.getResult().getNormalizedScore()); - + numStateEvaluations++; - + return bestAction; } else { @@ -164,15 +164,16 @@ public class AlphaBeta implements Policy { return bestAction; } } - + @Override public int getNumStateEvaluations() { return numStateEvaluations; } - + @Override public Action getAction(GameConfig gameConfig, GameState gameState, Collection prohibitedActions, Player player) { - throw new UnsupportedOperationException("Prohibited actions not supported by this class."); + throw new UnsupportedOperationException( + "Prohibited actions not supported by this class."); } } \ No newline at end of file diff --git a/src/net/woodyfolsom/msproj/policy/HumanKeyboardInput.java b/src/net/woodyfolsom/msproj/policy/HumanKeyboardInput.java index 61655fa..67fb891 100644 --- a/src/net/woodyfolsom/msproj/policy/HumanKeyboardInput.java +++ b/src/net/woodyfolsom/msproj/policy/HumanKeyboardInput.java @@ -16,17 +16,21 @@ public class HumanKeyboardInput implements Policy { byte[] inputBytes = new byte[4]; Action action = null; String input = ""; - + do { try { - System.out.println(player + " to move: (enter coord or PASS/RESIGN)"); + System.out.println(player + + " to move: (enter coord or PASS/RESIGN)"); System.in.read(inputBytes); - input = new String(inputBytes).trim().toUpperCase(); + input = new String(inputBytes).trim().toUpperCase(); action = Action.getInstance(input); - + if (action.isNone()) { - System.out.println("'" + input +"' is not a valid move. Please enter a coordinate (A1-T19) or 'PASS'."); + System.out + .println("'" + + input + + "' is not a valid move. Please enter a coordinate (A1-T19) or 'PASS'."); System.out.println(gameState); continue; } @@ -34,27 +38,29 @@ public class HumanKeyboardInput implements Policy { } catch (IOException ioe) { System.out.println("IOException: " + ioe.getMessage()); } catch (IllegalArgumentException iae) { - System.out.println("IllegalArgumentException - '"+input+"' is not a valid action or coordinate."); + System.out.println("IllegalArgumentException - '" + input + + "' is not a valid action or coordinate."); } } while (action == null); - + return action; } @Override public Action getAction(GameConfig gameConfig, GameState gameState, Collection prohibitedActions, Player player) { - Action action = getAction(gameConfig,gameState,player); - + Action action = getAction(gameConfig, gameState, player); + if (!prohibitedActions.contains(action)) { return action; } - + do { - System.out.println("Sorry, that action is prohibited. Please make another move."); - action = getAction(gameConfig,gameState,player); + System.out + .println("Sorry, that action is prohibited. Please make another move."); + action = getAction(gameConfig, gameState, player); } while (prohibitedActions.contains(action)); - + return action; } diff --git a/src/net/woodyfolsom/msproj/policy/Minimax.java b/src/net/woodyfolsom/msproj/policy/Minimax.java index 7ae4df5..8a422b6 100644 --- a/src/net/woodyfolsom/msproj/policy/Minimax.java +++ b/src/net/woodyfolsom/msproj/policy/Minimax.java @@ -18,7 +18,7 @@ public class Minimax implements Policy { private int lookAhead; private int numStateEvaluations = 0; - + public Minimax() { this(DEFAULT_LOOKAHEAD); } @@ -51,8 +51,8 @@ public class Minimax implements Policy { GameState gameState = new GameState(node.getGameState()); - List validMoves = validMoveGenerator.getActions( - node.getGameState().getGameConfig(), node.getGameState(), player, + List validMoves = validMoveGenerator.getActions(node + .getGameState().getGameConfig(), node.getGameState(), player, ActionGenerator.ALL_ACTIONS); boolean terminal = isTerminal(validMoves.size(), recursionLevels); @@ -63,9 +63,9 @@ public class Minimax implements Policy { if (terminal) { node.getProperties().setReward( gameState.getResult().getNormalizedScore()); - + numStateEvaluations++; - + return bestAction; } else { @@ -97,8 +97,8 @@ public class Minimax implements Policy { GameState gameState = new GameState(node.getGameState()); - List validMoves = validMoveGenerator.getActions( - node.getGameState().getGameConfig(), node.getGameState(), player, + List validMoves = validMoveGenerator.getActions(node + .getGameState().getGameConfig(), node.getGameState(), player, ActionGenerator.ALL_ACTIONS); boolean terminal = isTerminal(validMoves.size(), recursionLevels); @@ -109,9 +109,9 @@ public class Minimax implements Policy { if (terminal) { node.getProperties().setReward( gameState.getResult().getNormalizedScore()); - + numStateEvaluations++; - + return bestAction; } else { @@ -137,7 +137,7 @@ public class Minimax implements Policy { return bestAction; } } - + @Override public int getNumStateEvaluations() { return numStateEvaluations; @@ -146,6 +146,7 @@ public class Minimax implements Policy { @Override public Action getAction(GameConfig gameConfig, GameState gameState, Collection prohibitedActions, Player player) { - throw new UnsupportedOperationException("Prohibited actions not supported by this class."); + throw new UnsupportedOperationException( + "Prohibited actions not supported by this class."); } } \ No newline at end of file diff --git a/src/net/woodyfolsom/msproj/policy/MonteCarlo.java b/src/net/woodyfolsom/msproj/policy/MonteCarlo.java index 43d5bca..4f3de3a 100644 --- a/src/net/woodyfolsom/msproj/policy/MonteCarlo.java +++ b/src/net/woodyfolsom/msproj/policy/MonteCarlo.java @@ -1,7 +1,9 @@ package net.woodyfolsom.msproj.policy; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import net.woodyfolsom.msproj.Action; import net.woodyfolsom.msproj.GameConfig; @@ -12,88 +14,109 @@ import net.woodyfolsom.msproj.tree.MonteCarloProperties; public abstract class MonteCarlo implements Policy { protected static final int ROLLOUT_DEPTH_LIMIT = 100; - + protected int numStateEvaluations = 0; protected Policy movePolicy; - + protected long searchTimeLimit; protected volatile long elapsedTime = 0L; - + public MonteCarlo(Policy movePolicy, long searchTimeLimit) { this.movePolicy = movePolicy; this.searchTimeLimit = searchTimeLimit; } - + /** - * Descend the tree from the specified node and return a list of nodes to grow. + * Descend the tree from the specified node and return a list of nodes to + * grow. * * @param node * @return */ - public abstract List> descend(GameTreeNode node); - - @Override - public Action getAction(GameConfig gameConfig, GameState gameState, - Player player) { - System.out.println(player + " is thinking for up to " + (searchTimeLimit / 1000.0) + " seconds..."); + public abstract List> descend( + GameTreeNode node); + + private GameTreeNode buildTree(GameConfig gameConfig, GameState gameState, Player player) { + System.out.println(player + " is thinking for up to " + + (searchTimeLimit / 1000.0) + " seconds..."); long startTime = System.currentTimeMillis(); - + if (gameState.getPlayerToMove() != player) { - throw new RuntimeException("getAction(..." + player +") was requested but GameState.playerToMove was " + gameState.getPlayerToMove()); + throw new RuntimeException("getAction(..." + player + + ") was requested but GameState.playerToMove was " + + gameState.getPlayerToMove()); } - //If for some reason no moves are evaluated within the time limit, pass. - //Note that this may lose the game by forfeit even when picking any random move could - //result in a win. - - GameTreeNode rootNode = new GameTreeNode(gameState, new MonteCarloProperties()); + + GameTreeNode rootNode = new GameTreeNode( + gameState, new MonteCarloProperties()); do { - - //TODO these return types may need to be lists for some MC methods + + // TODO these return types may need to be lists for some MC methods List> selectedNodes = descend(rootNode); List> newLeaves = new ArrayList>(); - - for (GameTreeNode selectedNode: selectedNodes) { - Player playerToMove = selectedNode.getGameState().getPlayerToMove(); - - for (GameTreeNode newLeaf : grow(gameConfig, selectedNode, playerToMove)) { + + for (GameTreeNode selectedNode : selectedNodes) { + Player playerToMove = selectedNode.getGameState() + .getPlayerToMove(); + + for (GameTreeNode newLeaf : grow( + gameConfig, selectedNode, playerToMove)) { newLeaves.add(newLeaf); } } - + for (GameTreeNode newLeaf : newLeaves) { int reward = rollout(gameConfig, newLeaf, player); update(newLeaf, reward); } - + elapsedTime = System.currentTimeMillis() - startTime; } while (elapsedTime < searchTimeLimit); - //TODO: for debugging, temporarily specify the number of state evaluations rather than time limit - //} while (numStateEvaluations < searchTimeLimit); - - return getBestAction(rootNode); + + return rootNode; } + @Override + public Action getAction(GameConfig gameConfig, GameState gameState, + Player player) { + return getBestAction(buildTree(gameConfig,gameState,player)); + } + + public Map getQvalues(GameConfig gameConfig, GameState gameState, + Player player) { + GameTreeNode rootNode = buildTree(gameConfig,gameState,player); + Map qValues = new HashMap(); + for (Action action : rootNode.getActions()) { + qValues.put(action, rootNode.getChild(action).getProperties()); + } + return qValues; + } + public long getElapsedTime() { return elapsedTime; } - + public abstract Action getBestAction(GameTreeNode node); - - public abstract List> grow(GameConfig gameConfig, GameTreeNode node, Player player); - - public abstract int rollout(GameConfig gameConfig, GameTreeNode node, Player player); - - public abstract void update(GameTreeNode node, int reward); - + + public abstract List> grow( + GameConfig gameConfig, GameTreeNode node, + Player player); + + public abstract int rollout(GameConfig gameConfig, + GameTreeNode node, Player player); + + public abstract void update(GameTreeNode node, + int reward); + public long getSearchTimeLimit() { return searchTimeLimit; } - + public int doRollout() { return 0; } - + public int getNumStateEvaluations() { return numStateEvaluations; } diff --git a/src/net/woodyfolsom/msproj/policy/MonteCarloUCT.java b/src/net/woodyfolsom/msproj/policy/MonteCarloUCT.java index 429d779..b57510e 100644 --- a/src/net/woodyfolsom/msproj/policy/MonteCarloUCT.java +++ b/src/net/woodyfolsom/msproj/policy/MonteCarloUCT.java @@ -16,46 +16,55 @@ import net.woodyfolsom.msproj.tree.MonteCarloProperties; public class MonteCarloUCT extends MonteCarlo { public static final double TUNING_CONSTANT = 0.50; - + public MonteCarloUCT(Policy movePolicy, long searchTimeLimit) { super(movePolicy, searchTimeLimit); } - + @Override - public List> descend(GameTreeNode node) { + public List> descend( + GameTreeNode node) { double bestScore = Double.NEGATIVE_INFINITY; GameTreeNode bestNode = node; - - //What if the optimum leaf node is actually a terminal node? - //From Kocsis and Szepesvari, the value of an actual terminal node is 0, so it will never be grown. - + + // What if the optimum leaf node is actually a terminal node? + // From Kocsis and Szepesvari, the value of an actual terminal node is + // 0, so it will never be grown. + double nodeVisits = node.getProperties().getVisits(); Set actionsExplored = node.getActions(); GameState gameState = node.getGameState(); - - Action randomNewChildAction = new RandomMovePolicy().getAction(node.getGameState().getGameConfig(), gameState, actionsExplored, gameState.getPlayerToMove()); - - //only descend to the best child if no new actions are available at this node + + Action randomNewChildAction = new RandomMovePolicy().getAction(node + .getGameState().getGameConfig(), gameState, actionsExplored, + gameState.getPlayerToMove()); + + // only descend to the best child if no new actions are available at + // this node if (randomNewChildAction == Action.NONE) { for (Action action : actionsExplored) { - GameTreeNode childNode = node.getChild(action); - - double childScore; - if (childNode.getGameState().isTerminal()) { - childScore = 0.0; - } else { - MonteCarloProperties properties = childNode.getProperties(); - childScore = (double) (properties.getWins() / properties.getVisits()) + (TUNING_CONSTANT * Math.sqrt(Math.log(nodeVisits) / childNode.getProperties().getVisits())); - } - //TODO add random tie breaker? - //otherwise the child that is selected first will be biased - if (childScore >= bestScore) { + GameTreeNode childNode = node + .getChild(action); + + double childScore; + if (childNode.getGameState().isTerminal()) { + childScore = 0.0; + } else { + MonteCarloProperties properties = childNode.getProperties(); + childScore = (double) (properties.getWins() / properties + .getVisits()) + + (TUNING_CONSTANT * Math.sqrt(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; + } } } - } - + if (bestNode == node) { List> bestNodeList = new ArrayList>(); bestNodeList.add(bestNode); @@ -70,76 +79,94 @@ public class MonteCarloUCT extends MonteCarlo { Action bestAction = Action.NONE; double bestScore = Double.NEGATIVE_INFINITY; GameTreeNode bestChild = null; - + for (Action action : node.getActions()) { - GameTreeNode childNode = node.getChild(action); - + GameTreeNode childNode = node + .getChild(action); + MonteCarloProperties properties = childNode.getProperties(); - double childScore = (double) properties.getWins() / properties.getVisits(); - + double childScore = (double) properties.getWins() + / properties.getVisits(); + if (childScore >= bestScore) { bestScore = childScore; bestAction = action; bestChild = childNode; } } - + if (bestAction == Action.NONE) { - System.out.println("MonteCarloUCT failed - no actions were found for the current game staet (not even PASS)."); + System.out + .println("MonteCarloUCT failed - no actions were found for the current game staet (not even PASS)."); } else { - System.out.println("Action " + bestAction + " selected for " + node.getGameState().getPlayerToMove() + " with simulated win ratio of " + (bestScore*100.0 + "%")); - System.out.println("It was visited " + bestChild.getProperties().getVisits() + " times out of " + node.getProperties().getVisits() + " rollouts among " + node.getNumChildren() + " valid actions from the current state."); + System.out.println("Action " + bestAction + " selected for " + + node.getGameState().getPlayerToMove() + + " with simulated win ratio of " + + (bestScore * 100.0 + "%")); + System.out.println("It was visited " + + bestChild.getProperties().getVisits() + " times out of " + + node.getProperties().getVisits() + " rollouts among " + + node.getNumChildren() + + " valid actions from the current state."); } return bestAction; } @Override - public List> grow(GameConfig gameConfig, GameTreeNode node, Player player) { + public List> grow(GameConfig gameConfig, + GameTreeNode node, Player player) { Policy randomMovePolicy = new RandomMovePolicy(); Set exploredActions = node.getActions(); - Action action = randomMovePolicy.getAction(gameConfig, node.getGameState(), exploredActions, player); + Action action = randomMovePolicy.getAction(gameConfig, + node.getGameState(), exploredActions, player); if (Action.NONE == action) { - throw new RuntimeException("Unable to grow node - are all actions already explored? Board state: " + node.getGameState() + "\nExplored actions: " + exploredActions); + throw new RuntimeException( + "Unable to grow node - are all actions already explored? Board state: " + + node.getGameState() + "\nExplored actions: " + + exploredActions); } GameState nextGameState = new GameState(node.getGameState()); nextGameState.playStone(player, action); List> newChildren = new ArrayList>(); - GameTreeNode newChild = new GameTreeNode(nextGameState,new MonteCarloProperties()); - + GameTreeNode newChild = new GameTreeNode( + nextGameState, new MonteCarloProperties()); + newChildren.add(newChild); node.addChild(action, newChild); - + return newChildren; } @Override - /** * Rollout currently depends on the hardcoded ROLLOUT_DEPTH_LIMIT superclass parameter, * Even with super-ko detection, a rollout might take an unrealistically long time due to unlikely playouts. */ - public int rollout(GameConfig gameConfig, GameTreeNode node, Player player) { + public int rollout(GameConfig gameConfig, + GameTreeNode node, Player player) { Policy randomMovePolicy = new RandomMovePolicy(); - + Action action; int rolloutDepth = 0; GameState rolloutGameState = new GameState(node.getGameState()); Player currentPlayer = rolloutGameState.getPlayerToMove(); do { rolloutDepth++; - action = randomMovePolicy.getAction(gameConfig, rolloutGameState, currentPlayer); + action = randomMovePolicy.getAction(gameConfig, rolloutGameState, + currentPlayer); if (action != Action.NONE) { if (!rolloutGameState.playStone(currentPlayer, action)) { - throw new RuntimeException("Failed to play move selected by RandomMovePolicy"); + throw new RuntimeException( + "Failed to play move selected by RandomMovePolicy"); } currentPlayer = GoGame.getNextPlayer(currentPlayer); } } while (action != Action.NONE && rolloutDepth < ROLLOUT_DEPTH_LIMIT); - + numStateEvaluations++; - + GameResult gameScore = rolloutGameState.getResult(); - + if (gameScore.isWinner(player)) { return 1; } else { @@ -161,9 +188,10 @@ public class MonteCarloUCT extends MonteCarlo { @Override public Action getAction(GameConfig gameConfig, GameState gameState, Collection prohibitedActions, Player player) { - throw new UnsupportedOperationException("Prohibited actions not supported by this class."); + throw new UnsupportedOperationException( + "Prohibited actions not supported by this class."); } - + @Override public String toString() { return "MonteCarloUCT"; diff --git a/src/net/woodyfolsom/msproj/policy/Policy.java b/src/net/woodyfolsom/msproj/policy/Policy.java index e6a90ef..981830b 100644 --- a/src/net/woodyfolsom/msproj/policy/Policy.java +++ b/src/net/woodyfolsom/msproj/policy/Policy.java @@ -7,9 +7,12 @@ import net.woodyfolsom.msproj.GameConfig; import net.woodyfolsom.msproj.GameState; import net.woodyfolsom.msproj.Player; - public interface Policy { - public Action getAction(GameConfig gameConfig, GameState gameState, Player player); - public Action getAction(GameConfig gameConfig, GameState gameState, Collection prohibitedActions, Player player); + public Action getAction(GameConfig gameConfig, GameState gameState, + Player player); + + public Action getAction(GameConfig gameConfig, GameState gameState, + Collection prohibitedActions, Player player); + public int getNumStateEvaluations(); } \ No newline at end of file diff --git a/src/net/woodyfolsom/msproj/policy/RandomMovePolicy.java b/src/net/woodyfolsom/msproj/policy/RandomMovePolicy.java index 6179a43..84501a9 100644 --- a/src/net/woodyfolsom/msproj/policy/RandomMovePolicy.java +++ b/src/net/woodyfolsom/msproj/policy/RandomMovePolicy.java @@ -9,21 +9,42 @@ import net.woodyfolsom.msproj.GameConfig; import net.woodyfolsom.msproj.GameState; import net.woodyfolsom.msproj.Player; - public class RandomMovePolicy implements Policy, ActionGenerator { - + private final boolean passWhenLosing = false; + /** * Does NOT modify the gameState. */ public Action getAction(GameConfig gameConfig, GameState gameState, Collection prohibitedMoves, Player player) { - return getActions(gameConfig, gameState, prohibitedMoves, player, 1).get(0); + + List randomActions = getActions(gameConfig, gameState, prohibitedMoves, player, 1); + + //Never randomly generate PASS when losing, because a good opponent will immediately recognize the killer + //move of also passing, thereby causing the current player to lose. + Action firstAction = randomActions.get(0); + + //Pass when losing enabled? Just return the first random action; + if (passWhenLosing) { + return firstAction; + } + + //But if passing is the only valid move, pass even if losing. + if (firstAction.isPass() && !gameState.getResult().isWinner(player)) { + if (randomActions.size() > 1) { + return randomActions.get(1); + } else { + return firstAction; + } + } else { + return firstAction; + } } /** * Attempts to generate up to nMoves random moves on behalf of the specified * player. Will return at least one move, which may be 'NONE' if random - * search does not succeeed in discovering a valid move. Does NOT modify the + * search does not succeed in discovering a valid move. Does NOT modify the * gameState. * * @param gameConfig @@ -35,32 +56,35 @@ public class RandomMovePolicy implements Policy, ActionGenerator { public List getActions(GameConfig gameConfig, GameState gameState, Collection prohibitedMoves, Player player, int nMoves) { if (player != gameState.getPlayerToMove()) { - throw new IllegalArgumentException("It is not " + player + "'s turn to move!"); + throw new IllegalArgumentException("It is not " + player + + "'s turn to move!"); } - + GameState gameStateCopy = new GameState(gameState); ActionGenerator actionGenerator = new ValidMoveGenerator(); - - List possibleActions = actionGenerator.getActions(gameConfig, gameStateCopy, prohibitedMoves, player, ActionGenerator.ALL_ACTIONS); + + List possibleActions = actionGenerator.getActions(gameConfig, + gameStateCopy, prohibitedMoves, player, + ActionGenerator.ALL_ACTIONS); List randomActions = new ArrayList(); - + while (possibleActions.size() > 0 && randomActions.size() < nMoves) { Action randomAction = possibleActions .remove((int) (Math.random() * possibleActions.size())); - + randomActions.add(randomAction); } if (randomActions.size() == 0) { randomActions.add(Action.NONE); } - + return randomActions; } - + /** - * RandomMoveGenerator does not evaluate any states, but simply returns elements of - * a set of uniformly distributed, distinct valid moves. + * RandomMoveGenerator does not evaluate any states, but simply returns + * elements of a set of uniformly distributed, distinct valid moves. * * @return */ @@ -71,12 +95,13 @@ public class RandomMovePolicy implements Policy, ActionGenerator { @Override public List getActions(GameConfig gameConfig, GameState gameState, Player color, int numActions) { - return getActions(gameConfig, gameState, new ArrayList(), color, numActions); + return getActions(gameConfig, gameState, new ArrayList(), + color, numActions); } @Override public Action getAction(GameConfig gameConfig, GameState gameState, Player player) { - return getActions(gameConfig,gameState,player,1).get(0); + return getActions(gameConfig, gameState, player, 1).get(0); } } \ No newline at end of file diff --git a/src/net/woodyfolsom/msproj/policy/RootParallelization.java b/src/net/woodyfolsom/msproj/policy/RootParallelization.java new file mode 100644 index 0000000..d27a804 --- /dev/null +++ b/src/net/woodyfolsom/msproj/policy/RootParallelization.java @@ -0,0 +1,145 @@ +package net.woodyfolsom.msproj.policy; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.woodyfolsom.msproj.Action; +import net.woodyfolsom.msproj.GameConfig; +import net.woodyfolsom.msproj.GameState; +import net.woodyfolsom.msproj.Player; +import net.woodyfolsom.msproj.tree.MonteCarloProperties; + +public class RootParallelization implements Policy { + private int numTrees = 1; + private long timeLimit = 1000L; + + public RootParallelization(int numTrees, long timeLimit) { + this.numTrees = numTrees; + this.timeLimit = timeLimit; + } + + @Override + public Action getAction(GameConfig gameConfig, GameState gameState, + Player player) { + Action bestAction = Action.NONE; + + List policyRunners = new ArrayList(); + List simulationThreads = new ArrayList(); + + for (int i = 0; i < numTrees; i++) { + PolicyRunner policyRunner = new PolicyRunner(new MonteCarloUCT( + new RandomMovePolicy(), timeLimit), gameConfig, gameState, + player); + policyRunners.add(policyRunner); + + Thread simThread = new Thread(policyRunner); + simulationThreads.add(simThread); + } + + for (Thread simThread : simulationThreads) { + simThread.start(); + } + + for (Thread simThread : simulationThreads) { + try { + simThread.join(); + } catch (InterruptedException ie) { + System.out + .println("Interrupted while waiting for Monte Carlo simulations to finish."); + } + } + + Map totalReward = new HashMap(); + Map numSims = new HashMap(); + + for (PolicyRunner policyRunner : policyRunners) { + Map qValues = policyRunner.getQvalues(); + for (Action action : qValues.keySet()) { + if (totalReward.containsKey(action)) { + totalReward.put(action, totalReward.get(action) + qValues.get(action).getWins()); + } else { + totalReward.put(action, qValues.get(action).getWins()); + } + if (numSims.containsKey(action)) { + numSims.put(action, numSims.get(action) + qValues.get(action).getVisits()); + } else { + numSims.put(action, qValues.get(action).getVisits()); + } + } + } + + double bestValue = 0.0; + int bestWins = 0; + int totalRollouts = 0; + + for (Action action : totalReward.keySet()) + { + int totalWins = totalReward.get(action); + int totalSims = numSims.get(action); + + totalRollouts += totalSims; + + double value = ((double)totalWins) / totalSims; + + if (bestAction.isNone() || bestValue < value) { + bestAction = action; + bestValue = value; + bestWins = totalWins; + } + + } + + System.out.println("Action " + bestAction + " selected for " + + player + + " with simulated win ratio of " + + (bestValue * 100.0 + "% among " + numTrees + " parallel simulations.")); + System.out.println("It had a value of " + + bestValue + " out of " + + totalRollouts + " rollouts among " + + " valid actions from the current state."); + + return bestAction; + } + + @Override + public Action getAction(GameConfig gameConfig, GameState gameState, + Collection prohibitedActions, Player player) { + throw new UnsupportedOperationException( + "Prohibited actions not supported by this class."); + } + + @Override + public int getNumStateEvaluations() { + // TODO Auto-generated method stub + return 0; + } + + class PolicyRunner implements Runnable { + Map qValues; + + private GameConfig gameConfig; + private GameState gameState; + private Player player; + private MonteCarlo policy; + + public PolicyRunner(MonteCarlo policy, GameConfig gameConfig, + GameState gameState, Player player) { + this.policy = policy; + this.gameConfig = gameConfig; + this.gameState = gameState; + this.player = player; + } + + public Map getQvalues() { + return qValues; + } + + @Override + public void run() { + qValues = policy.getQvalues(gameConfig, gameState, player); + } + } +} \ No newline at end of file diff --git a/src/net/woodyfolsom/msproj/policy/ValidMoveGenerator.java b/src/net/woodyfolsom/msproj/policy/ValidMoveGenerator.java index 39b1069..526b31a 100644 --- a/src/net/woodyfolsom/msproj/policy/ValidMoveGenerator.java +++ b/src/net/woodyfolsom/msproj/policy/ValidMoveGenerator.java @@ -32,7 +32,7 @@ public class ValidMoveGenerator implements ActionGenerator { if (!prohibitedMoves.contains(nextMove) && gameStateCopy.playStone(color, nextMove)) { validMoves.add(nextMove); - gameStateCopy = new GameState(gameState); // play successful? + gameStateCopy = new GameState(gameState); // play successful? // regenerate copy // of gameState } diff --git a/src/net/woodyfolsom/msproj/sgf/SGFCoord.java b/src/net/woodyfolsom/msproj/sgf/SGFCoord.java index c3cf28a..79a3310 100644 --- a/src/net/woodyfolsom/msproj/sgf/SGFCoord.java +++ b/src/net/woodyfolsom/msproj/sgf/SGFCoord.java @@ -3,7 +3,7 @@ package net.woodyfolsom.msproj.sgf; public class SGFCoord { private char column; private char row; - + public SGFCoord(String coords) { if (coords == null || coords.length() != 2) { throw new IllegalArgumentException(coords); @@ -11,22 +11,22 @@ public class SGFCoord { column = coords.charAt(0); row = coords.charAt(1); } - + public SGFCoord(char column, char row) { this.column = column; this.row = row; } - + public char getColumn() { return column; } - + public char getRow() { return row; } - + @Override public String toString() { - return new String(new char[]{column,row}); + 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 b2b2780..11659d6 100644 --- a/src/net/woodyfolsom/msproj/sgf/SGFGameTree.java +++ b/src/net/woodyfolsom/msproj/sgf/SGFGameTree.java @@ -9,32 +9,31 @@ import net.woodyfolsom.msproj.Player; public class SGFGameTree { 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(SGFNode node : nodeSequence) { + + for (SGFNode node : nodeSequence) { this.nodeSequence.add(node); } } - + public void addSubTree(SGFGameTree subTree) { subTrees.add(subTree); } - + public int getSubTreeCount() { return subTrees.size(); } - + public String toLateXmoves(Player player) { StringBuilder latexSB = new StringBuilder(); SGFNode.TYPE nodeType; @@ -50,7 +49,7 @@ public class SGFGameTree { } else { throw new RuntimeException("Invalid player: " + player); } - + boolean firstMove = true; int nMoves = 0; for (SGFNode node : nodeSequence) { @@ -59,7 +58,7 @@ public class SGFGameTree { } SGFValue sgfValue = node.getFirstValue(sgfIdent); if (sgfValue.isEmpty()) { - //TODO later this will be the LaTeX igo code for 'Pass'? + // TODO later this will be the LaTeX igo code for 'Pass'? continue; } if (firstMove) { @@ -83,33 +82,36 @@ public class SGFGameTree { 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. + + // 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"); + 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 + default: + // ignore } } return latexSB.toString(); } - + public String toSGF() { StringBuilder sgfFormatString = new StringBuilder("("); for (SGFNode node : nodeSequence) { diff --git a/src/net/woodyfolsom/msproj/sgf/SGFIdentifier.java b/src/net/woodyfolsom/msproj/sgf/SGFIdentifier.java index 42ef67d..788c548 100644 --- a/src/net/woodyfolsom/msproj/sgf/SGFIdentifier.java +++ b/src/net/woodyfolsom/msproj/sgf/SGFIdentifier.java @@ -12,13 +12,13 @@ public class SGFIdentifier { public static final SGFIdentifier RESULT = new SGFIdentifier("RE"); public static final SGFIdentifier SIZE = new SGFIdentifier("SZ"); public static final SGFIdentifier TIME = new SGFIdentifier("TM"); - + private String text; - + private SGFIdentifier(String value) { this.text = value.toString(); } - + @Override public String toString() { return text; diff --git a/src/net/woodyfolsom/msproj/sgf/SGFLexer.java b/src/net/woodyfolsom/msproj/sgf/SGFLexer.java index a9eeced..0aadf6e 100644 --- a/src/net/woodyfolsom/msproj/sgf/SGFLexer.java +++ b/src/net/woodyfolsom/msproj/sgf/SGFLexer.java @@ -1,1770 +1,1635 @@ // $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.*; -import java.util.Stack; -import java.util.List; -import java.util.ArrayList; +import org.antlr.runtime.CharStream; +import org.antlr.runtime.Lexer; +import org.antlr.runtime.MismatchedSetException; +import org.antlr.runtime.NoViableAltException; +import org.antlr.runtime.RecognitionException; +import org.antlr.runtime.RecognizerSharedState; -@SuppressWarnings({"all", "warnings", "unchecked"}) +@SuppressWarnings({ "all", "warnings", "unchecked" }) public class SGFLexer extends Lexer { - public static final int EOF=-1; - public static final int T__21=21; - public static final int T__22=22; - public static final int T__23=23; - public static final int T__24=24; - public static final int T__25=25; - public static final int T__26=26; - public static final int T__27=27; - public static final int T__28=28; - public static final int T__29=29; - public static final int T__30=30; - public static final int T__31=31; - public static final int T__32=32; - public static final int T__33=33; - public static final int T__34=34; - public static final int T__35=35; - public static final int T__36=36; - public static final int T__37=37; - public static final int T__38=38; - public static final int T__39=39; - public static final int T__40=40; - public static final int T__41=41; - public static final int T__42=42; - public static final int T__43=43; - public static final int T__44=44; - public static final int T__45=45; - public static final int T__46=46; - public static final int COLON=4; - public static final int COMMA=5; - public static final int CR=6; - public static final int DIGIT=7; - public static final int LBRACKET=8; - public static final int LCLETTER=9; - public static final int LPAREN=10; - public static final int MINUS=11; - public static final int NEWLINE=12; - public static final int PERIOD=13; - public static final int PLUS=14; - public static final int RBRACKET=15; - public static final int RPAREN=16; - public static final int SEMICOLON=17; - public static final int SLASH=18; - public static final int SPACE=19; - public static final int UCLETTER=20; - - // delegates - // delegators - public Lexer[] getDelegates() { - return new Lexer[] {}; - } - - public SGFLexer() {} - public SGFLexer(CharStream input) { - this(input, new RecognizerSharedState()); - } - public SGFLexer(CharStream input, RecognizerSharedState state) { - super(input,state); - } - public String getGrammarFileName() { return "C:\\Users\\Woody\\Documents\\antlr\\SGF.g"; } - - // $ANTLR start "T__21" - public final void mT__21() throws RecognitionException { - try { - int _type = T__21; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:4:7: ( 'AB' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:4:9: 'AB' - { - match("AB"); - - - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "T__21" - - // $ANTLR start "T__22" - public final void mT__22() throws RecognitionException { - try { - int _type = T__22; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:5:7: ( 'AP' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:5:9: 'AP' - { - match("AP"); - - - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "T__22" - - // $ANTLR start "T__23" - public final void mT__23() throws RecognitionException { - try { - int _type = T__23; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:6:7: ( 'AW' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:6:9: 'AW' - { - match("AW"); - - - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "T__23" - - // $ANTLR start "T__24" - public final void mT__24() throws RecognitionException { - try { - int _type = T__24; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:7:7: ( 'B' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:7:9: 'B' - { - match('B'); - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "T__24" - - // $ANTLR start "T__25" - public final void mT__25() throws RecognitionException { - try { - int _type = T__25; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:8:7: ( 'BC' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:8:9: 'BC' - { - match("BC"); - - - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "T__25" - - // $ANTLR start "T__26" - public final void mT__26() throws RecognitionException { - try { - int _type = T__26; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:9:7: ( 'BR' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:9:9: 'BR' - { - match("BR"); - - - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "T__26" - - // $ANTLR start "T__27" - public final void mT__27() throws RecognitionException { - try { - int _type = T__27; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:10:7: ( 'CA' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:10:9: 'CA' - { - match("CA"); - - - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "T__27" - - // $ANTLR start "T__28" - public final void mT__28() throws RecognitionException { - try { - int _type = T__28; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:11:7: ( 'CP' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:11:9: 'CP' - { - match("CP"); - - - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "T__28" - - // $ANTLR start "T__29" - public final void mT__29() throws RecognitionException { - try { - int _type = T__29; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:12:7: ( 'DT' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:12:9: 'DT' - { - match("DT"); - - - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "T__29" - - // $ANTLR start "T__30" - public final void mT__30() throws RecognitionException { - try { - int _type = T__30; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:13:7: ( 'EV' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:13:9: 'EV' - { - match("EV"); - - - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "T__30" - - // $ANTLR start "T__31" - public final void mT__31() throws RecognitionException { - try { - int _type = T__31; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:14:7: ( 'FF' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:14:9: 'FF' - { - match("FF"); - - - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "T__31" - - // $ANTLR start "T__32" - public final void mT__32() throws RecognitionException { - try { - int _type = T__32; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:15:7: ( 'GM' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:15:9: 'GM' - { - match("GM"); - - - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "T__32" - - // $ANTLR start "T__33" - public final void mT__33() throws RecognitionException { - try { - int _type = T__33; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:16:7: ( 'KM' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:16:9: 'KM' - { - match("KM"); - - - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "T__33" - - // $ANTLR start "T__34" - public final void mT__34() throws RecognitionException { - try { - int _type = T__34; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:17:7: ( 'PB' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:17:9: 'PB' - { - match("PB"); - - - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "T__34" - - // $ANTLR start "T__35" - public final void mT__35() throws RecognitionException { - try { - int _type = T__35; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:18:7: ( 'PC' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:18:9: 'PC' - { - match("PC"); - - - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "T__35" - - // $ANTLR start "T__36" - public final void mT__36() throws RecognitionException { - try { - int _type = T__36; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:19:7: ( 'PW' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:19:9: 'PW' - { - match("PW"); - - - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "T__36" - - // $ANTLR start "T__37" - public final void mT__37() throws RecognitionException { - try { - int _type = T__37; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:20:7: ( 'R' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:20:9: 'R' - { - match('R'); - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "T__37" - - // $ANTLR start "T__38" - public final void mT__38() throws RecognitionException { - try { - int _type = T__38; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:21:7: ( 'RE' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:21:9: 'RE' - { - match("RE"); - - - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "T__38" - - // $ANTLR start "T__39" - public final void mT__39() throws RecognitionException { - try { - int _type = T__39; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:22:7: ( 'RU' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:22:9: 'RU' - { - match("RU"); - - - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "T__39" - - // $ANTLR start "T__40" - public final void mT__40() throws RecognitionException { - try { - int _type = T__40; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:23:7: ( 'SO' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:23:9: 'SO' - { - match("SO"); - - - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "T__40" - - // $ANTLR start "T__41" - public final void mT__41() throws RecognitionException { - try { - int _type = T__41; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:24:7: ( 'SZ' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:24:9: 'SZ' - { - match("SZ"); - - - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "T__41" - - // $ANTLR start "T__42" - public final void mT__42() throws RecognitionException { - try { - int _type = T__42; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:25:7: ( 'TM' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:25:9: 'TM' - { - match("TM"); - - - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "T__42" - - // $ANTLR start "T__43" - public final void mT__43() throws RecognitionException { - try { - int _type = T__43; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:26:7: ( 'US' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:26:9: 'US' - { - match("US"); - - - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "T__43" - - // $ANTLR start "T__44" - public final void mT__44() throws RecognitionException { - try { - int _type = T__44; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:27:7: ( 'W' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:27:9: 'W' - { - match('W'); - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "T__44" - - // $ANTLR start "T__45" - public final void mT__45() throws RecognitionException { - try { - int _type = T__45; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:28:7: ( 'WC' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:28:9: 'WC' - { - match("WC"); - - - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "T__45" - - // $ANTLR start "T__46" - public final void mT__46() throws RecognitionException { - try { - int _type = T__46; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:29:7: ( 'WR' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:29:9: 'WR' - { - match("WR"); - - - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "T__46" - - // $ANTLR start "LPAREN" - public final void mLPAREN() throws RecognitionException { - try { - int _type = LPAREN; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:150:9: ( '(' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:150:11: '(' - { - match('('); - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "LPAREN" - - // $ANTLR start "SEMICOLON" - public final void mSEMICOLON() throws RecognitionException { - try { - int _type = SEMICOLON; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:152:11: ( ';' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:152:14: ';' - { - match(';'); - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "SEMICOLON" - - // $ANTLR start "UCLETTER" - public final void mUCLETTER() throws RecognitionException { - try { - int _type = UCLETTER; - int _channel = DEFAULT_TOKEN_CHANNEL; - // 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') ) { - input.consume(); - } - else { - MismatchedSetException mse = new MismatchedSetException(null,input); - recover(mse); - throw mse; - } - - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "UCLETTER" - - // $ANTLR start "LCLETTER" - public final void mLCLETTER() throws RecognitionException { - try { - int _type = LCLETTER; - int _channel = DEFAULT_TOKEN_CHANNEL; - // 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') ) { - input.consume(); - } - else { - MismatchedSetException mse = new MismatchedSetException(null,input); - recover(mse); - throw mse; - } - - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "LCLETTER" - - // $ANTLR start "DIGIT" - public final void mDIGIT() throws RecognitionException { - try { - int _type = DIGIT; - int _channel = DEFAULT_TOKEN_CHANNEL; - // 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') ) { - input.consume(); - } - else { - MismatchedSetException mse = new MismatchedSetException(null,input); - recover(mse); - throw mse; - } - - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "DIGIT" - - // $ANTLR start "LBRACKET" - public final void mLBRACKET() throws RecognitionException { - try { - int _type = LBRACKET; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:161:2: ( '[' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:161:4: '[' - { - match('['); - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "LBRACKET" - - // $ANTLR start "RBRACKET" - public final void mRBRACKET() throws RecognitionException { - try { - int _type = RBRACKET; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:164:2: ( ']' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:164:4: ']' - { - match(']'); - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "RBRACKET" - - // $ANTLR start "RPAREN" - public final void mRPAREN() throws RecognitionException { - try { - int _type = RPAREN; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:166:9: ( ')' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:166:11: ')' - { - match(')'); - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "RPAREN" - - // $ANTLR start "COLON" - public final void mCOLON() throws RecognitionException { - try { - int _type = COLON; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:168:8: ( ':' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:168:10: ':' - { - match(':'); - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "COLON" - - // $ANTLR start "MINUS" - public final void mMINUS() throws RecognitionException { - try { - int _type = MINUS; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:170:8: ( '-' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:170:10: '-' - { - match('-'); - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "MINUS" - - // $ANTLR start "SPACE" - public final void mSPACE() throws RecognitionException { - try { - int _type = SPACE; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:172:8: ( ' ' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:172:10: ' ' - { - match(' '); - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "SPACE" - - // $ANTLR start "PERIOD" - public final void mPERIOD() throws RecognitionException { - try { - int _type = PERIOD; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:174:9: ( '.' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:174:11: '.' - { - match('.'); - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "PERIOD" - - // $ANTLR start "COMMA" - public final void mCOMMA() throws RecognitionException { - try { - int _type = COMMA; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:176:8: ( ',' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:176:10: ',' - { - match(','); - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "COMMA" - - // $ANTLR start "PLUS" - public final void mPLUS() throws RecognitionException { - try { - int _type = PLUS; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:178:7: ( '+' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:178:9: '+' - { - match('+'); - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "PLUS" - - // $ANTLR start "SLASH" - public final void mSLASH() throws RecognitionException { - try { - int _type = SLASH; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:180:8: ( '/' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:180:10: '/' - { - match('/'); - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "SLASH" - - // $ANTLR start "CR" - public final void mCR() throws RecognitionException { - try { - int _type = CR; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:182:5: ( '\\r' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:182:7: '\\r' - { - match('\r'); - - _channel=HIDDEN; - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "CR" - - // $ANTLR start "NEWLINE" - public final void mNEWLINE() throws RecognitionException { - try { - int _type = NEWLINE; - int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:184:9: ( '\\n' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:184:11: '\\n' - { - match('\n'); - - _channel=HIDDEN; - - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "NEWLINE" - - public void mTokens() throws RecognitionException { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:8: ( T__21 | T__22 | T__23 | T__24 | T__25 | T__26 | T__27 | T__28 | T__29 | T__30 | T__31 | T__32 | T__33 | T__34 | T__35 | T__36 | T__37 | T__38 | T__39 | T__40 | T__41 | T__42 | T__43 | T__44 | T__45 | T__46 | LPAREN | SEMICOLON | UCLETTER | LCLETTER | DIGIT | LBRACKET | RBRACKET | RPAREN | COLON | MINUS | SPACE | PERIOD | COMMA | PLUS | SLASH | CR | NEWLINE ) - int alt1=43; - switch ( input.LA(1) ) { - case 'A': - { - switch ( input.LA(2) ) { - case 'B': - { - alt1=1; - } - break; - case 'P': - { - alt1=2; - } - break; - case 'W': - { - alt1=3; - } - break; - default: - alt1=29; - } - - } - break; - case 'B': - { - switch ( input.LA(2) ) { - case 'C': - { - alt1=5; - } - break; - case 'R': - { - alt1=6; - } - break; - default: - alt1=4; - } - - } - break; - case 'C': - { - switch ( input.LA(2) ) { - case 'A': - { - alt1=7; - } - break; - case 'P': - { - alt1=8; - } - break; - default: - alt1=29; - } - - } - break; - case 'D': - { - int LA1_4 = input.LA(2); - - if ( (LA1_4=='T') ) { - alt1=9; - } - else { - alt1=29; - } - } - break; - case 'E': - { - int LA1_5 = input.LA(2); - - if ( (LA1_5=='V') ) { - alt1=10; - } - else { - alt1=29; - } - } - break; - case 'F': - { - int LA1_6 = input.LA(2); - - if ( (LA1_6=='F') ) { - alt1=11; - } - else { - alt1=29; - } - } - break; - case 'G': - { - int LA1_7 = input.LA(2); - - if ( (LA1_7=='M') ) { - alt1=12; - } - else { - alt1=29; - } - } - break; - case 'K': - { - int LA1_8 = input.LA(2); - - if ( (LA1_8=='M') ) { - alt1=13; - } - else { - alt1=29; - } - } - break; - case 'P': - { - switch ( input.LA(2) ) { - case 'B': - { - alt1=14; - } - break; - case 'C': - { - alt1=15; - } - break; - case 'W': - { - alt1=16; - } - break; - default: - alt1=29; - } - - } - break; - case 'R': - { - switch ( input.LA(2) ) { - case 'E': - { - alt1=18; - } - break; - case 'U': - { - alt1=19; - } - break; - default: - alt1=17; - } - - } - break; - case 'S': - { - switch ( input.LA(2) ) { - case 'O': - { - alt1=20; - } - break; - case 'Z': - { - alt1=21; - } - break; - default: - alt1=29; - } - - } - break; - case 'T': - { - int LA1_12 = input.LA(2); - - if ( (LA1_12=='M') ) { - alt1=22; - } - else { - alt1=29; - } - } - break; - case 'U': - { - int LA1_13 = input.LA(2); - - if ( (LA1_13=='S') ) { - alt1=23; - } - else { - alt1=29; - } - } - break; - case 'W': - { - switch ( input.LA(2) ) { - case 'C': - { - alt1=25; - } - break; - case 'R': - { - alt1=26; - } - break; - default: - alt1=24; - } - - } - break; - case '(': - { - alt1=27; - } - break; - case ';': - { - alt1=28; - } - break; - case 'H': - case 'I': - case 'J': - case 'L': - case 'M': - case 'N': - case 'O': - case 'Q': - case 'V': - case 'X': - case 'Y': - case 'Z': - { - alt1=29; - } - break; - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': - { - alt1=30; - } - break; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - { - alt1=31; - } - break; - case '[': - { - alt1=32; - } - break; - case ']': - { - alt1=33; - } - break; - case ')': - { - alt1=34; - } - break; - case ':': - { - alt1=35; - } - break; - case '-': - { - alt1=36; - } - break; - case ' ': - { - alt1=37; - } - break; - case '.': - { - alt1=38; - } - break; - case ',': - { - alt1=39; - } - break; - case '+': - { - alt1=40; - } - break; - case '/': - { - alt1=41; - } - break; - case '\r': - { - alt1=42; - } - break; - case '\n': - { - alt1=43; - } - break; - default: - NoViableAltException nvae = - new NoViableAltException("", 1, 0, input); - - throw nvae; - - } - - switch (alt1) { - case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:10: T__21 - { - mT__21(); - - - } - break; - case 2 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:16: T__22 - { - mT__22(); - - - } - break; - case 3 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:22: T__23 - { - mT__23(); - - - } - break; - case 4 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:28: T__24 - { - mT__24(); - - - } - break; - case 5 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:34: T__25 - { - mT__25(); - - - } - break; - case 6 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:40: T__26 - { - mT__26(); - - - } - break; - case 7 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:46: T__27 - { - mT__27(); - - - } - break; - case 8 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:52: T__28 - { - mT__28(); - - - } - break; - case 9 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:58: T__29 - { - mT__29(); - - - } - break; - case 10 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:64: T__30 - { - mT__30(); - - - } - break; - case 11 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:70: T__31 - { - mT__31(); - - - } - break; - case 12 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:76: T__32 - { - mT__32(); - - - } - break; - case 13 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:82: T__33 - { - mT__33(); - - - } - break; - case 14 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:88: T__34 - { - mT__34(); - - - } - break; - case 15 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:94: T__35 - { - mT__35(); - - - } - break; - case 16 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:100: T__36 - { - mT__36(); - - - } - break; - case 17 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:106: T__37 - { - mT__37(); - - - } - break; - case 18 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:112: T__38 - { - mT__38(); - - - } - break; - case 19 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:118: T__39 - { - mT__39(); - - - } - break; - case 20 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:124: T__40 - { - mT__40(); - - - } - break; - case 21 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:130: T__41 - { - mT__41(); - - - } - break; - case 22 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:136: T__42 - { - mT__42(); - - - } - break; - case 23 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:142: T__43 - { - mT__43(); - - - } - break; - case 24 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:148: T__44 - { - mT__44(); - - - } - break; - case 25 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:154: T__45 - { - mT__45(); - - - } - break; - case 26 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:160: T__46 - { - mT__46(); - - - } - break; - case 27 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:166: LPAREN - { - mLPAREN(); - - - } - break; - case 28 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:173: SEMICOLON - { - mSEMICOLON(); - - - } - break; - case 29 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:183: UCLETTER - { - mUCLETTER(); - - - } - break; - case 30 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:192: LCLETTER - { - mLCLETTER(); - - - } - break; - case 31 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:201: DIGIT - { - mDIGIT(); - - - } - break; - case 32 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:207: LBRACKET - { - mLBRACKET(); - - - } - break; - case 33 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:216: RBRACKET - { - mRBRACKET(); - - - } - break; - case 34 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:225: RPAREN - { - mRPAREN(); - - - } - break; - case 35 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:232: COLON - { - mCOLON(); - - - } - break; - case 36 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:238: MINUS - { - mMINUS(); - - - } - break; - case 37 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:244: SPACE - { - mSPACE(); - - - } - break; - case 38 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:250: PERIOD - { - mPERIOD(); - - - } - break; - case 39 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:257: COMMA - { - mCOMMA(); - - - } - break; - case 40 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:263: PLUS - { - mPLUS(); - - - } - break; - case 41 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:268: SLASH - { - mSLASH(); - - - } - break; - case 42 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:274: CR - { - mCR(); - - - } - break; - case 43 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:277: NEWLINE - { - mNEWLINE(); - - - } - break; - - } - - } - - - + public static final int EOF = -1; + public static final int T__21 = 21; + public static final int T__22 = 22; + public static final int T__23 = 23; + public static final int T__24 = 24; + public static final int T__25 = 25; + public static final int T__26 = 26; + public static final int T__27 = 27; + public static final int T__28 = 28; + public static final int T__29 = 29; + public static final int T__30 = 30; + public static final int T__31 = 31; + public static final int T__32 = 32; + public static final int T__33 = 33; + public static final int T__34 = 34; + public static final int T__35 = 35; + public static final int T__36 = 36; + public static final int T__37 = 37; + public static final int T__38 = 38; + public static final int T__39 = 39; + public static final int T__40 = 40; + public static final int T__41 = 41; + public static final int T__42 = 42; + public static final int T__43 = 43; + public static final int T__44 = 44; + public static final int T__45 = 45; + public static final int T__46 = 46; + public static final int COLON = 4; + public static final int COMMA = 5; + public static final int CR = 6; + public static final int DIGIT = 7; + public static final int LBRACKET = 8; + public static final int LCLETTER = 9; + public static final int LPAREN = 10; + public static final int MINUS = 11; + public static final int NEWLINE = 12; + public static final int PERIOD = 13; + public static final int PLUS = 14; + public static final int RBRACKET = 15; + public static final int RPAREN = 16; + public static final int SEMICOLON = 17; + public static final int SLASH = 18; + public static final int SPACE = 19; + public static final int UCLETTER = 20; + + // delegates + // delegators + public Lexer[] getDelegates() { + return new Lexer[] {}; + } + + public SGFLexer() { + } + + public SGFLexer(CharStream input) { + this(input, new RecognizerSharedState()); + } + + public SGFLexer(CharStream input, RecognizerSharedState state) { + super(input, state); + } + + public String getGrammarFileName() { + return "C:\\Users\\Woody\\Documents\\antlr\\SGF.g"; + } + + // $ANTLR start "T__21" + public final void mT__21() throws RecognitionException { + try { + int _type = T__21; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:4:7: ( 'AB' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:4:9: 'AB' + { + match("AB"); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__21" + + // $ANTLR start "T__22" + public final void mT__22() throws RecognitionException { + try { + int _type = T__22; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:5:7: ( 'AP' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:5:9: 'AP' + { + match("AP"); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__22" + + // $ANTLR start "T__23" + public final void mT__23() throws RecognitionException { + try { + int _type = T__23; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:6:7: ( 'AW' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:6:9: 'AW' + { + match("AW"); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__23" + + // $ANTLR start "T__24" + public final void mT__24() throws RecognitionException { + try { + int _type = T__24; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:7:7: ( 'B' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:7:9: 'B' + { + match('B'); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__24" + + // $ANTLR start "T__25" + public final void mT__25() throws RecognitionException { + try { + int _type = T__25; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:8:7: ( 'BC' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:8:9: 'BC' + { + match("BC"); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__25" + + // $ANTLR start "T__26" + public final void mT__26() throws RecognitionException { + try { + int _type = T__26; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:9:7: ( 'BR' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:9:9: 'BR' + { + match("BR"); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__26" + + // $ANTLR start "T__27" + public final void mT__27() throws RecognitionException { + try { + int _type = T__27; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:10:7: ( 'CA' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:10:9: 'CA' + { + match("CA"); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__27" + + // $ANTLR start "T__28" + public final void mT__28() throws RecognitionException { + try { + int _type = T__28; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:11:7: ( 'CP' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:11:9: 'CP' + { + match("CP"); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__28" + + // $ANTLR start "T__29" + public final void mT__29() throws RecognitionException { + try { + int _type = T__29; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:12:7: ( 'DT' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:12:9: 'DT' + { + match("DT"); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__29" + + // $ANTLR start "T__30" + public final void mT__30() throws RecognitionException { + try { + int _type = T__30; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:13:7: ( 'EV' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:13:9: 'EV' + { + match("EV"); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__30" + + // $ANTLR start "T__31" + public final void mT__31() throws RecognitionException { + try { + int _type = T__31; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:14:7: ( 'FF' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:14:9: 'FF' + { + match("FF"); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__31" + + // $ANTLR start "T__32" + public final void mT__32() throws RecognitionException { + try { + int _type = T__32; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:15:7: ( 'GM' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:15:9: 'GM' + { + match("GM"); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__32" + + // $ANTLR start "T__33" + public final void mT__33() throws RecognitionException { + try { + int _type = T__33; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:16:7: ( 'KM' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:16:9: 'KM' + { + match("KM"); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__33" + + // $ANTLR start "T__34" + public final void mT__34() throws RecognitionException { + try { + int _type = T__34; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:17:7: ( 'PB' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:17:9: 'PB' + { + match("PB"); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__34" + + // $ANTLR start "T__35" + public final void mT__35() throws RecognitionException { + try { + int _type = T__35; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:18:7: ( 'PC' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:18:9: 'PC' + { + match("PC"); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__35" + + // $ANTLR start "T__36" + public final void mT__36() throws RecognitionException { + try { + int _type = T__36; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:19:7: ( 'PW' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:19:9: 'PW' + { + match("PW"); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__36" + + // $ANTLR start "T__37" + public final void mT__37() throws RecognitionException { + try { + int _type = T__37; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:20:7: ( 'R' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:20:9: 'R' + { + match('R'); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__37" + + // $ANTLR start "T__38" + public final void mT__38() throws RecognitionException { + try { + int _type = T__38; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:21:7: ( 'RE' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:21:9: 'RE' + { + match("RE"); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__38" + + // $ANTLR start "T__39" + public final void mT__39() throws RecognitionException { + try { + int _type = T__39; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:22:7: ( 'RU' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:22:9: 'RU' + { + match("RU"); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__39" + + // $ANTLR start "T__40" + public final void mT__40() throws RecognitionException { + try { + int _type = T__40; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:23:7: ( 'SO' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:23:9: 'SO' + { + match("SO"); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__40" + + // $ANTLR start "T__41" + public final void mT__41() throws RecognitionException { + try { + int _type = T__41; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:24:7: ( 'SZ' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:24:9: 'SZ' + { + match("SZ"); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__41" + + // $ANTLR start "T__42" + public final void mT__42() throws RecognitionException { + try { + int _type = T__42; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:25:7: ( 'TM' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:25:9: 'TM' + { + match("TM"); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__42" + + // $ANTLR start "T__43" + public final void mT__43() throws RecognitionException { + try { + int _type = T__43; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:26:7: ( 'US' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:26:9: 'US' + { + match("US"); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__43" + + // $ANTLR start "T__44" + public final void mT__44() throws RecognitionException { + try { + int _type = T__44; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:27:7: ( 'W' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:27:9: 'W' + { + match('W'); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__44" + + // $ANTLR start "T__45" + public final void mT__45() throws RecognitionException { + try { + int _type = T__45; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:28:7: ( 'WC' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:28:9: 'WC' + { + match("WC"); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__45" + + // $ANTLR start "T__46" + public final void mT__46() throws RecognitionException { + try { + int _type = T__46; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:29:7: ( 'WR' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:29:9: 'WR' + { + match("WR"); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__46" + + // $ANTLR start "LPAREN" + public final void mLPAREN() throws RecognitionException { + try { + int _type = LPAREN; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:150:9: ( '(' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:150:11: '(' + { + match('('); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "LPAREN" + + // $ANTLR start "SEMICOLON" + public final void mSEMICOLON() throws RecognitionException { + try { + int _type = SEMICOLON; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:152:11: ( ';' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:152:14: ';' + { + match(';'); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "SEMICOLON" + + // $ANTLR start "UCLETTER" + public final void mUCLETTER() throws RecognitionException { + try { + int _type = UCLETTER; + int _channel = DEFAULT_TOKEN_CHANNEL; + // 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')) { + input.consume(); + } else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + recover(mse); + throw mse; + } + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "UCLETTER" + + // $ANTLR start "LCLETTER" + public final void mLCLETTER() throws RecognitionException { + try { + int _type = LCLETTER; + int _channel = DEFAULT_TOKEN_CHANNEL; + // 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')) { + input.consume(); + } else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + recover(mse); + throw mse; + } + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "LCLETTER" + + // $ANTLR start "DIGIT" + public final void mDIGIT() throws RecognitionException { + try { + int _type = DIGIT; + int _channel = DEFAULT_TOKEN_CHANNEL; + // 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')) { + input.consume(); + } else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + recover(mse); + throw mse; + } + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "DIGIT" + + // $ANTLR start "LBRACKET" + public final void mLBRACKET() throws RecognitionException { + try { + int _type = LBRACKET; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:161:2: ( '[' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:161:4: '[' + { + match('['); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "LBRACKET" + + // $ANTLR start "RBRACKET" + public final void mRBRACKET() throws RecognitionException { + try { + int _type = RBRACKET; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:164:2: ( ']' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:164:4: ']' + { + match(']'); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "RBRACKET" + + // $ANTLR start "RPAREN" + public final void mRPAREN() throws RecognitionException { + try { + int _type = RPAREN; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:166:9: ( ')' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:166:11: ')' + { + match(')'); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "RPAREN" + + // $ANTLR start "COLON" + public final void mCOLON() throws RecognitionException { + try { + int _type = COLON; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:168:8: ( ':' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:168:10: ':' + { + match(':'); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "COLON" + + // $ANTLR start "MINUS" + public final void mMINUS() throws RecognitionException { + try { + int _type = MINUS; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:170:8: ( '-' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:170:10: '-' + { + match('-'); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "MINUS" + + // $ANTLR start "SPACE" + public final void mSPACE() throws RecognitionException { + try { + int _type = SPACE; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:172:8: ( ' ' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:172:10: ' ' + { + match(' '); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "SPACE" + + // $ANTLR start "PERIOD" + public final void mPERIOD() throws RecognitionException { + try { + int _type = PERIOD; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:174:9: ( '.' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:174:11: '.' + { + match('.'); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "PERIOD" + + // $ANTLR start "COMMA" + public final void mCOMMA() throws RecognitionException { + try { + int _type = COMMA; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:176:8: ( ',' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:176:10: ',' + { + match(','); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "COMMA" + + // $ANTLR start "PLUS" + public final void mPLUS() throws RecognitionException { + try { + int _type = PLUS; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:178:7: ( '+' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:178:9: '+' + { + match('+'); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "PLUS" + + // $ANTLR start "SLASH" + public final void mSLASH() throws RecognitionException { + try { + int _type = SLASH; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:180:8: ( '/' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:180:10: '/' + { + match('/'); + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "SLASH" + + // $ANTLR start "CR" + public final void mCR() throws RecognitionException { + try { + int _type = CR; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:182:5: ( '\\r' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:182:7: '\\r' + { + match('\r'); + + _channel = HIDDEN; + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "CR" + + // $ANTLR start "NEWLINE" + public final void mNEWLINE() throws RecognitionException { + try { + int _type = NEWLINE; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:184:9: ( '\\n' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:184:11: '\\n' + { + match('\n'); + + _channel = HIDDEN; + + } + + state.type = _type; + state.channel = _channel; + } finally { + // do for sure before leaving + } + } + + // $ANTLR end "NEWLINE" + + public void mTokens() throws RecognitionException { + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:8: ( T__21 | T__22 | + // T__23 | T__24 | T__25 | T__26 | T__27 | T__28 | T__29 | T__30 | T__31 + // | T__32 | T__33 | T__34 | T__35 | T__36 | T__37 | T__38 | T__39 | + // T__40 | T__41 | T__42 | T__43 | T__44 | T__45 | T__46 | LPAREN | + // SEMICOLON | UCLETTER | LCLETTER | DIGIT | LBRACKET | RBRACKET | + // RPAREN | COLON | MINUS | SPACE | PERIOD | COMMA | PLUS | SLASH | CR | + // NEWLINE ) + int alt1 = 43; + switch (input.LA(1)) { + case 'A': { + switch (input.LA(2)) { + case 'B': { + alt1 = 1; + } + break; + case 'P': { + alt1 = 2; + } + break; + case 'W': { + alt1 = 3; + } + break; + default: + alt1 = 29; + } + + } + break; + case 'B': { + switch (input.LA(2)) { + case 'C': { + alt1 = 5; + } + break; + case 'R': { + alt1 = 6; + } + break; + default: + alt1 = 4; + } + + } + break; + case 'C': { + switch (input.LA(2)) { + case 'A': { + alt1 = 7; + } + break; + case 'P': { + alt1 = 8; + } + break; + default: + alt1 = 29; + } + + } + break; + case 'D': { + int LA1_4 = input.LA(2); + + if ((LA1_4 == 'T')) { + alt1 = 9; + } else { + alt1 = 29; + } + } + break; + case 'E': { + int LA1_5 = input.LA(2); + + if ((LA1_5 == 'V')) { + alt1 = 10; + } else { + alt1 = 29; + } + } + break; + case 'F': { + int LA1_6 = input.LA(2); + + if ((LA1_6 == 'F')) { + alt1 = 11; + } else { + alt1 = 29; + } + } + break; + case 'G': { + int LA1_7 = input.LA(2); + + if ((LA1_7 == 'M')) { + alt1 = 12; + } else { + alt1 = 29; + } + } + break; + case 'K': { + int LA1_8 = input.LA(2); + + if ((LA1_8 == 'M')) { + alt1 = 13; + } else { + alt1 = 29; + } + } + break; + case 'P': { + switch (input.LA(2)) { + case 'B': { + alt1 = 14; + } + break; + case 'C': { + alt1 = 15; + } + break; + case 'W': { + alt1 = 16; + } + break; + default: + alt1 = 29; + } + + } + break; + case 'R': { + switch (input.LA(2)) { + case 'E': { + alt1 = 18; + } + break; + case 'U': { + alt1 = 19; + } + break; + default: + alt1 = 17; + } + + } + break; + case 'S': { + switch (input.LA(2)) { + case 'O': { + alt1 = 20; + } + break; + case 'Z': { + alt1 = 21; + } + break; + default: + alt1 = 29; + } + + } + break; + case 'T': { + int LA1_12 = input.LA(2); + + if ((LA1_12 == 'M')) { + alt1 = 22; + } else { + alt1 = 29; + } + } + break; + case 'U': { + int LA1_13 = input.LA(2); + + if ((LA1_13 == 'S')) { + alt1 = 23; + } else { + alt1 = 29; + } + } + break; + case 'W': { + switch (input.LA(2)) { + case 'C': { + alt1 = 25; + } + break; + case 'R': { + alt1 = 26; + } + break; + default: + alt1 = 24; + } + + } + break; + case '(': { + alt1 = 27; + } + break; + case ';': { + alt1 = 28; + } + break; + case 'H': + case 'I': + case 'J': + case 'L': + case 'M': + case 'N': + case 'O': + case 'Q': + case 'V': + case 'X': + case 'Y': + case 'Z': { + alt1 = 29; + } + break; + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': { + alt1 = 30; + } + break; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': { + alt1 = 31; + } + break; + case '[': { + alt1 = 32; + } + break; + case ']': { + alt1 = 33; + } + break; + case ')': { + alt1 = 34; + } + break; + case ':': { + alt1 = 35; + } + break; + case '-': { + alt1 = 36; + } + break; + case ' ': { + alt1 = 37; + } + break; + case '.': { + alt1 = 38; + } + break; + case ',': { + alt1 = 39; + } + break; + case '+': { + alt1 = 40; + } + break; + case '/': { + alt1 = 41; + } + break; + case '\r': { + alt1 = 42; + } + break; + case '\n': { + alt1 = 43; + } + break; + default: + NoViableAltException nvae = new NoViableAltException("", 1, 0, + input); + + throw nvae; + + } + + switch (alt1) { + case 1: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:10: T__21 + { + mT__21(); + + } + break; + case 2: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:16: T__22 + { + mT__22(); + + } + break; + case 3: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:22: T__23 + { + mT__23(); + + } + break; + case 4: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:28: T__24 + { + mT__24(); + + } + break; + case 5: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:34: T__25 + { + mT__25(); + + } + break; + case 6: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:40: T__26 + { + mT__26(); + + } + break; + case 7: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:46: T__27 + { + mT__27(); + + } + break; + case 8: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:52: T__28 + { + mT__28(); + + } + break; + case 9: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:58: T__29 + { + mT__29(); + + } + break; + case 10: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:64: T__30 + { + mT__30(); + + } + break; + case 11: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:70: T__31 + { + mT__31(); + + } + break; + case 12: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:76: T__32 + { + mT__32(); + + } + break; + case 13: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:82: T__33 + { + mT__33(); + + } + break; + case 14: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:88: T__34 + { + mT__34(); + + } + break; + case 15: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:94: T__35 + { + mT__35(); + + } + break; + case 16: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:100: T__36 + { + mT__36(); + + } + break; + case 17: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:106: T__37 + { + mT__37(); + + } + break; + case 18: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:112: T__38 + { + mT__38(); + + } + break; + case 19: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:118: T__39 + { + mT__39(); + + } + break; + case 20: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:124: T__40 + { + mT__40(); + + } + break; + case 21: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:130: T__41 + { + mT__41(); + + } + break; + case 22: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:136: T__42 + { + mT__42(); + + } + break; + case 23: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:142: T__43 + { + mT__43(); + + } + break; + case 24: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:148: T__44 + { + mT__44(); + + } + break; + case 25: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:154: T__45 + { + mT__45(); + + } + break; + case 26: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:160: T__46 + { + mT__46(); + + } + break; + case 27: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:166: LPAREN + { + mLPAREN(); + + } + break; + case 28: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:173: SEMICOLON + { + mSEMICOLON(); + + } + break; + case 29: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:183: UCLETTER + { + mUCLETTER(); + + } + break; + case 30: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:192: LCLETTER + { + mLCLETTER(); + + } + break; + case 31: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:201: DIGIT + { + mDIGIT(); + + } + break; + case 32: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:207: LBRACKET + { + mLBRACKET(); + + } + break; + case 33: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:216: RBRACKET + { + mRBRACKET(); + + } + break; + case 34: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:225: RPAREN + { + mRPAREN(); + + } + break; + case 35: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:232: COLON + { + mCOLON(); + + } + break; + case 36: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:238: MINUS + { + mMINUS(); + + } + break; + case 37: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:244: SPACE + { + mSPACE(); + + } + break; + case 38: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:250: PERIOD + { + mPERIOD(); + + } + break; + case 39: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:257: COMMA + { + mCOMMA(); + + } + break; + case 40: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:263: PLUS + { + mPLUS(); + + } + break; + case 41: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:268: SLASH + { + mSLASH(); + + } + break; + case 42: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:274: CR + { + mCR(); + + } + break; + case 43: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:277: NEWLINE + { + mNEWLINE(); + + } + break; + + } + + } } \ No newline at end of file diff --git a/src/net/woodyfolsom/msproj/sgf/SGFNode.java b/src/net/woodyfolsom/msproj/sgf/SGFNode.java index bf36021..f952469 100644 --- a/src/net/woodyfolsom/msproj/sgf/SGFNode.java +++ b/src/net/woodyfolsom/msproj/sgf/SGFNode.java @@ -4,11 +4,13 @@ import java.util.ArrayList; import java.util.List; public class SGFNode { - public enum TYPE { ROOT, MOVE_BLACK, MOVE_WHITE, EMPTY } - + 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(); @@ -22,37 +24,39 @@ public class SGFNode { } 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 +"'"); + 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 3d4be22..ff09c82 100644 --- a/src/net/woodyfolsom/msproj/sgf/SGFNodeCollection.java +++ b/src/net/woodyfolsom/msproj/sgf/SGFNodeCollection.java @@ -7,32 +7,32 @@ import net.woodyfolsom.msproj.Player; public class SGFNodeCollection { private List gameTrees = new ArrayList(); - + public void add(SGFGameTree gameTree) { gameTrees.add(gameTree); } - + public SGFGameTree getGameTree(int index) { return gameTrees.get(index); } - + public int getGameTreeCount() { 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) { @@ -40,7 +40,7 @@ public class SGFNodeCollection { } return sgfFormatString; } - + @Override public String toString() { return toSGF(); diff --git a/src/net/woodyfolsom/msproj/sgf/SGFParser.java b/src/net/woodyfolsom/msproj/sgf/SGFParser.java index d674482..5739ee2 100644 --- a/src/net/woodyfolsom/msproj/sgf/SGFParser.java +++ b/src/net/woodyfolsom/msproj/sgf/SGFParser.java @@ -6,4839 +6,4694 @@ import java.util.Stack; import java.util.List; import java.util.ArrayList; -@SuppressWarnings({"all", "warnings", "unchecked"}) +@SuppressWarnings({ "all", "warnings", "unchecked" }) public class SGFParser extends Parser { - public static final String[] tokenNames = new String[] { - "", "", "", "", "COLON", "COMMA", "CR", "DIGIT", "LBRACKET", "LCLETTER", "LPAREN", "MINUS", "NEWLINE", "PERIOD", "PLUS", "RBRACKET", "RPAREN", "SEMICOLON", "SLASH", "SPACE", "UCLETTER", "'AB'", "'AP'", "'AW'", "'B'", "'BC'", "'BR'", "'CA'", "'CP'", "'DT'", "'EV'", "'FF'", "'GM'", "'KM'", "'PB'", "'PC'", "'PW'", "'R'", "'RE'", "'RU'", "'SO'", "'SZ'", "'TM'", "'US'", "'W'", "'WC'", "'WR'" - }; - - public static final int EOF=-1; - public static final int T__21=21; - public static final int T__22=22; - public static final int T__23=23; - public static final int T__24=24; - public static final int T__25=25; - public static final int T__26=26; - public static final int T__27=27; - public static final int T__28=28; - public static final int T__29=29; - public static final int T__30=30; - public static final int T__31=31; - public static final int T__32=32; - public static final int T__33=33; - public static final int T__34=34; - public static final int T__35=35; - public static final int T__36=36; - public static final int T__37=37; - public static final int T__38=38; - public static final int T__39=39; - public static final int T__40=40; - public static final int T__41=41; - public static final int T__42=42; - public static final int T__43=43; - public static final int T__44=44; - public static final int T__45=45; - public static final int T__46=46; - public static final int COLON=4; - public static final int COMMA=5; - public static final int CR=6; - public static final int DIGIT=7; - public static final int LBRACKET=8; - public static final int LCLETTER=9; - public static final int LPAREN=10; - public static final int MINUS=11; - public static final int NEWLINE=12; - public static final int PERIOD=13; - public static final int PLUS=14; - public static final int RBRACKET=15; - public static final int RPAREN=16; - public static final int SEMICOLON=17; - public static final int SLASH=18; - public static final int SPACE=19; - public static final int UCLETTER=20; - - // delegates - public Parser[] getDelegates() { - return new Parser[] {}; - } - - // delegators - - - public SGFParser(TokenStream input) { - this(input, new RecognizerSharedState()); - } - public SGFParser(TokenStream input, RecognizerSharedState state) { - super(input, state); - } - - public String[] getTokenNames() { return SGFParser.tokenNames; } - public String getGrammarFileName() { return "C:\\Users\\Woody\\Documents\\antlr\\SGF.g"; } - - - - // $ANTLR start "collection" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:7:1: collection returns [SGFNodeCollection sgfNodeCollection] : ( gameTree )+ ; - public final SGFNodeCollection collection() throws RecognitionException { - SGFNodeCollection sgfNodeCollection = null; + public static final String[] tokenNames = new String[] { "", + "", "", "", "COLON", "COMMA", "CR", "DIGIT", + "LBRACKET", "LCLETTER", "LPAREN", "MINUS", "NEWLINE", "PERIOD", + "PLUS", "RBRACKET", "RPAREN", "SEMICOLON", "SLASH", "SPACE", + "UCLETTER", "'AB'", "'AP'", "'AW'", "'B'", "'BC'", "'BR'", "'CA'", + "'CP'", "'DT'", "'EV'", "'FF'", "'GM'", "'KM'", "'PB'", "'PC'", + "'PW'", "'R'", "'RE'", "'RU'", "'SO'", "'SZ'", "'TM'", "'US'", + "'W'", "'WC'", "'WR'" }; + + public static final int EOF = -1; + public static final int T__21 = 21; + public static final int T__22 = 22; + public static final int T__23 = 23; + public static final int T__24 = 24; + public static final int T__25 = 25; + public static final int T__26 = 26; + public static final int T__27 = 27; + public static final int T__28 = 28; + public static final int T__29 = 29; + public static final int T__30 = 30; + public static final int T__31 = 31; + public static final int T__32 = 32; + public static final int T__33 = 33; + public static final int T__34 = 34; + public static final int T__35 = 35; + public static final int T__36 = 36; + public static final int T__37 = 37; + public static final int T__38 = 38; + public static final int T__39 = 39; + public static final int T__40 = 40; + public static final int T__41 = 41; + public static final int T__42 = 42; + public static final int T__43 = 43; + public static final int T__44 = 44; + public static final int T__45 = 45; + public static final int T__46 = 46; + public static final int COLON = 4; + public static final int COMMA = 5; + public static final int CR = 6; + public static final int DIGIT = 7; + public static final int LBRACKET = 8; + public static final int LCLETTER = 9; + public static final int LPAREN = 10; + public static final int MINUS = 11; + public static final int NEWLINE = 12; + public static final int PERIOD = 13; + public static final int PLUS = 14; + public static final int RBRACKET = 15; + public static final int RPAREN = 16; + public static final int SEMICOLON = 17; + public static final int SLASH = 18; + public static final int SPACE = 19; + public static final int UCLETTER = 20; + + // delegates + public Parser[] getDelegates() { + return new Parser[] {}; + } + + // delegators + + public SGFParser(TokenStream input) { + this(input, new RecognizerSharedState()); + } + + public SGFParser(TokenStream input, RecognizerSharedState state) { + super(input, state); + } + + public String[] getTokenNames() { + return SGFParser.tokenNames; + } + + public String getGrammarFileName() { + return "C:\\Users\\Woody\\Documents\\antlr\\SGF.g"; + } + + // $ANTLR start "collection" + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:7:1: collection returns + // [SGFNodeCollection sgfNodeCollection] : ( gameTree )+ ; + public final SGFNodeCollection collection() throws RecognitionException { + SGFNodeCollection sgfNodeCollection = null; + + SGFGameTree gameTree1 = null; + + sgfNodeCollection = new SGFNodeCollection(); + + try { + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:11:2: ( ( gameTree )+ ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:11:4: ( gameTree )+ + { + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:11:4: ( gameTree )+ + int cnt1 = 0; + loop1: do { + int alt1 = 2; + int LA1_0 = input.LA(1); + + if ((LA1_0 == LPAREN)) { + alt1 = 1; + } + + switch (alt1) { + case 1: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:11:5: gameTree + { + pushFollow(FOLLOW_gameTree_in_collection36); + gameTree1 = gameTree(); + + state._fsp--; + + sgfNodeCollection.add(gameTree1); + + } + break; + + default: + if (cnt1 >= 1) + break loop1; + EarlyExitException eee = new EarlyExitException(1, + input); + throw eee; + } + cnt1++; + } while (true); + + } + + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return sgfNodeCollection; + } + + // $ANTLR end "collection" + + // $ANTLR start "gameTree" + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:14:1: gameTree returns + // [SGFGameTree sgfGameTree] : LPAREN sequence ( gameTree )* RPAREN ; + public final SGFGameTree gameTree() throws RecognitionException { + SGFGameTree sgfGameTree = null; + + List sequence2 = null; + + sgfGameTree = new SGFGameTree(); + + try { + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:18:2: ( LPAREN sequence + // ( gameTree )* RPAREN ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:18:5: LPAREN sequence ( + // gameTree )* RPAREN + { + match(input, LPAREN, FOLLOW_LPAREN_in_gameTree61); + + pushFollow(FOLLOW_sequence_in_gameTree63); + sequence2 = sequence(); + + state._fsp--; + + sgfGameTree.setNodeSequence(sequence2); + + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:18:76: ( gameTree + // )* + loop2: do { + int alt2 = 2; + int LA2_0 = input.LA(1); + + if ((LA2_0 == LPAREN)) { + alt2 = 1; + } + + switch (alt2) { + case 1: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:18:77: gameTree + { + pushFollow(FOLLOW_gameTree_in_gameTree67); + gameTree(); + + state._fsp--; + + sgfGameTree.addSubTree(sgfGameTree); + + } + break; + + default: + break loop2; + } + } while (true); + + match(input, RPAREN, FOLLOW_RPAREN_in_gameTree72); + + } + + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return sgfGameTree; + } + + // $ANTLR end "gameTree" + + // $ANTLR start "sequence" + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:21:1: sequence returns + // [List nodeSequence] : ( node )+ ; + public final List sequence() throws RecognitionException { + List nodeSequence = null; + + SGFNode node3 = null; + + nodeSequence = new ArrayList(); + + try { + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:25:2: ( ( node )+ ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:25:4: ( node )+ + { + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:25:4: ( node )+ + int cnt3 = 0; + loop3: do { + int alt3 = 2; + int LA3_0 = input.LA(1); + + if ((LA3_0 == SEMICOLON)) { + alt3 = 1; + } + + switch (alt3) { + case 1: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:25:5: node + { + pushFollow(FOLLOW_node_in_sequence94); + node3 = node(); + + state._fsp--; + + nodeSequence.add(node3); + + } + break; + + default: + if (cnt3 >= 1) + break loop3; + EarlyExitException eee = new EarlyExitException(3, + input); + throw eee; + } + cnt3++; + } while (true); + } - SGFGameTree gameTree1 =null; + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + finally { + // do for sure before leaving + } + return nodeSequence; + } + // $ANTLR end "sequence" - sgfNodeCollection = new SGFNodeCollection(); - - try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:11:2: ( ( gameTree )+ ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:11:4: ( gameTree )+ - { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:11:4: ( gameTree )+ - int cnt1=0; - loop1: - do { - int alt1=2; - int LA1_0 = input.LA(1); + // $ANTLR start "node" + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:27:1: node returns [SGFNode + // sgfNode] : SEMICOLON ( property )* ; + public final SGFNode node() throws RecognitionException { + SGFNode sgfNode = null; - if ( (LA1_0==LPAREN) ) { - alt1=1; - } + SGFProperty property4 = null; + sgfNode = new SGFNode(); - switch (alt1) { - case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:11:5: gameTree - { - pushFollow(FOLLOW_gameTree_in_collection36); - gameTree1=gameTree(); - - state._fsp--; - - - sgfNodeCollection.add(gameTree1); - - } - break; - - default : - if ( cnt1 >= 1 ) break loop1; - EarlyExitException eee = - new EarlyExitException(1, input); - throw eee; - } - cnt1++; - } while (true); - - - } - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return sgfNodeCollection; - } - // $ANTLR end "collection" - - - - // $ANTLR start "gameTree" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:14:1: gameTree returns [SGFGameTree sgfGameTree] : LPAREN sequence ( gameTree )* RPAREN ; - public final SGFGameTree gameTree() throws RecognitionException { - SGFGameTree sgfGameTree = null; - - - List sequence2 =null; - - - - sgfGameTree = new SGFGameTree(); - - try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:18:2: ( LPAREN sequence ( gameTree )* RPAREN ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:18:5: LPAREN sequence ( gameTree )* RPAREN - { - match(input,LPAREN,FOLLOW_LPAREN_in_gameTree61); - - pushFollow(FOLLOW_sequence_in_gameTree63); - sequence2=sequence(); - - state._fsp--; - - - sgfGameTree.setNodeSequence(sequence2); - - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:18:76: ( gameTree )* - loop2: - do { - int alt2=2; - int LA2_0 = input.LA(1); - - if ( (LA2_0==LPAREN) ) { - alt2=1; - } - - - switch (alt2) { - case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:18:77: gameTree - { - pushFollow(FOLLOW_gameTree_in_gameTree67); - gameTree(); - - state._fsp--; - - - sgfGameTree.addSubTree(sgfGameTree); - - } - break; - - default : - break loop2; - } - } while (true); - - - match(input,RPAREN,FOLLOW_RPAREN_in_gameTree72); - - } - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return sgfGameTree; - } - // $ANTLR end "gameTree" - - - - // $ANTLR start "sequence" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:21:1: sequence returns [List nodeSequence] : ( node )+ ; - public final List sequence() throws RecognitionException { - List nodeSequence = null; - - - SGFNode node3 =null; - - - - nodeSequence = new ArrayList(); - - try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:25:2: ( ( node )+ ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:25:4: ( node )+ - { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:25:4: ( node )+ - int cnt3=0; - loop3: - do { - int alt3=2; - int LA3_0 = input.LA(1); - - if ( (LA3_0==SEMICOLON) ) { - alt3=1; - } - - - switch (alt3) { - case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:25:5: node - { - pushFollow(FOLLOW_node_in_sequence94); - node3=node(); - - state._fsp--; - - - nodeSequence.add(node3); - - } - break; - - default : - if ( cnt3 >= 1 ) break loop3; - EarlyExitException eee = - new EarlyExitException(3, input); - throw eee; - } - cnt3++; - } while (true); - - - } - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return nodeSequence; - } - // $ANTLR end "sequence" - - - - // $ANTLR start "node" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:27:1: node returns [SGFNode sgfNode] : SEMICOLON ( property )* ; - public final SGFNode node() throws RecognitionException { - SGFNode sgfNode = null; - - - SGFProperty property4 =null; - - - - sgfNode = new SGFNode(); - - try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:31:2: ( SEMICOLON ( property )* ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:31:4: SEMICOLON ( property )* - { - match(input,SEMICOLON,FOLLOW_SEMICOLON_in_node115); - - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:31:14: ( property )* - loop4: - do { - int alt4=2; - int LA4_0 = input.LA(1); - - if ( ((LA4_0 >= 21 && LA4_0 <= 36)||(LA4_0 >= 38 && LA4_0 <= 46)) ) { - alt4=1; - } - - - switch (alt4) { - case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:31:15: property - { - pushFollow(FOLLOW_property_in_node118); - property4=property(); - - state._fsp--; - - - sgfNode.addProperty(property4); - - } - break; - - default : - break loop4; - } - } while (true); - - - } - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return sgfNode; - } - // $ANTLR end "node" - - - - // $ANTLR start "property" - // 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; - - - SGFIdentifier numIdent5 =null; - - SGFParser.numValue_return numValue6 =null; - - SGFIdentifier playerIdent7 =null; - - SGFIdentifier playerIdent8 =null; - - SGFParser.coordValue_return coordValue9 =null; - - SGFIdentifier strIdent10 =null; - - SGFIdentifier strIdent11 =null; - - SGFParser.strValue_return strValue12 =null; - - SGFParser.resValue_return resValue13 =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 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: - case 41: - case 42: - { - alt12=1; - } - break; - case 27: - { - int LA12_2 = input.LA(2); - - if ( (LA12_2==LBRACKET) ) { - switch ( input.LA(3) ) { - case RBRACKET: - { - int LA12_24 = input.LA(4); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; - } - else if ( (true) ) { - alt12=4; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 24, input); - - throw nvae; - - } - } - break; - case LCLETTER: - { - int LA12_25 = input.LA(4); - - if ( (LA12_25==LCLETTER) ) { - int LA12_31 = input.LA(5); - - if ( (LA12_31==RBRACKET) ) { - int LA12_32 = input.LA(6); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=3; - } - else if ( (true) ) { - alt12=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 32, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 31, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 25, input); - - throw nvae; - - } - } - break; - case COLON: - case COMMA: - case DIGIT: - case MINUS: - case PERIOD: - case PLUS: - case SLASH: - case SPACE: - case UCLETTER: - { - alt12=5; - } - break; - default: - NoViableAltException nvae = - new NoViableAltException("", 12, 22, input); - - throw nvae; - - } - - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 2, input); - - throw nvae; - - } - } - break; - case 40: - { - int LA12_3 = input.LA(2); - - if ( (LA12_3==LBRACKET) ) { - switch ( input.LA(3) ) { - case RBRACKET: - { - int LA12_24 = input.LA(4); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; - } - else if ( (true) ) { - alt12=4; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 24, input); - - throw nvae; - - } - } - break; - case LCLETTER: - { - int LA12_25 = input.LA(4); - - if ( (LA12_25==LCLETTER) ) { - int LA12_31 = input.LA(5); - - if ( (LA12_31==RBRACKET) ) { - int LA12_32 = input.LA(6); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=3; - } - else if ( (true) ) { - alt12=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 32, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 31, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 25, input); - - throw nvae; - - } - } - break; - case COLON: - case COMMA: - case DIGIT: - case MINUS: - case PERIOD: - case PLUS: - case SLASH: - case SPACE: - case UCLETTER: - { - alt12=5; - } - break; - default: - NoViableAltException nvae = - new NoViableAltException("", 12, 22, input); - - throw nvae; - - } - - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 3, input); - - throw nvae; - - } - } - break; - case 25: - { - int LA12_4 = input.LA(2); - - if ( (LA12_4==LBRACKET) ) { - switch ( input.LA(3) ) { - case RBRACKET: - { - int LA12_24 = input.LA(4); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; - } - else if ( (true) ) { - alt12=4; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 24, input); - - throw nvae; - - } - } - break; - case LCLETTER: - { - int LA12_25 = input.LA(4); - - if ( (LA12_25==LCLETTER) ) { - int LA12_31 = input.LA(5); - - if ( (LA12_31==RBRACKET) ) { - int LA12_32 = input.LA(6); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=3; - } - else if ( (true) ) { - alt12=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 32, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 31, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 25, input); - - throw nvae; - - } - } - break; - case COLON: - case COMMA: - case DIGIT: - case MINUS: - case PERIOD: - case PLUS: - case SLASH: - case SPACE: - case UCLETTER: - { - alt12=5; - } - break; - default: - NoViableAltException nvae = - new NoViableAltException("", 12, 22, input); - - throw nvae; - - } - - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 4, input); - - throw nvae; - - } - } - break; - case 45: - { - int LA12_5 = input.LA(2); - - if ( (LA12_5==LBRACKET) ) { - switch ( input.LA(3) ) { - case RBRACKET: - { - int LA12_24 = input.LA(4); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; - } - else if ( (true) ) { - alt12=4; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 24, input); - - throw nvae; - - } - } - break; - case LCLETTER: - { - int LA12_25 = input.LA(4); - - if ( (LA12_25==LCLETTER) ) { - int LA12_31 = input.LA(5); - - if ( (LA12_31==RBRACKET) ) { - int LA12_32 = input.LA(6); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=3; - } - else if ( (true) ) { - alt12=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 32, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 31, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 25, input); - - throw nvae; - - } - } - break; - case COLON: - case COMMA: - case DIGIT: - case MINUS: - case PERIOD: - case PLUS: - case SLASH: - case SPACE: - case UCLETTER: - { - alt12=5; - } - break; - default: - NoViableAltException nvae = - new NoViableAltException("", 12, 22, input); - - throw nvae; - - } - - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 5, input); - - throw nvae; - - } - } - break; - case 30: - { - int LA12_6 = input.LA(2); - - if ( (LA12_6==LBRACKET) ) { - switch ( input.LA(3) ) { - case RBRACKET: - { - int LA12_24 = input.LA(4); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; - } - else if ( (true) ) { - alt12=4; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 24, input); - - throw nvae; - - } - } - break; - case LCLETTER: - { - int LA12_25 = input.LA(4); - - if ( (LA12_25==LCLETTER) ) { - int LA12_31 = input.LA(5); - - if ( (LA12_31==RBRACKET) ) { - int LA12_32 = input.LA(6); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=3; - } - else if ( (true) ) { - alt12=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 32, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 31, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 25, input); - - throw nvae; - - } - } - break; - case COLON: - case COMMA: - case DIGIT: - case MINUS: - case PERIOD: - case PLUS: - case SLASH: - case SPACE: - case UCLETTER: - { - alt12=5; - } - break; - default: - NoViableAltException nvae = - new NoViableAltException("", 12, 22, input); - - throw nvae; - - } - - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 6, input); - - throw nvae; - - } - } - break; - case 34: - { - int LA12_7 = input.LA(2); - - if ( (LA12_7==LBRACKET) ) { - switch ( input.LA(3) ) { - case RBRACKET: - { - int LA12_24 = input.LA(4); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; - } - else if ( (true) ) { - alt12=4; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 24, input); - - throw nvae; - - } - } - break; - case LCLETTER: - { - int LA12_25 = input.LA(4); - - if ( (LA12_25==LCLETTER) ) { - int LA12_31 = input.LA(5); - - if ( (LA12_31==RBRACKET) ) { - int LA12_32 = input.LA(6); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=3; - } - else if ( (true) ) { - alt12=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 32, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 31, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 25, input); - - throw nvae; - - } - } - break; - case COLON: - case COMMA: - case DIGIT: - case MINUS: - case PERIOD: - case PLUS: - case SLASH: - case SPACE: - case UCLETTER: - { - alt12=5; - } - break; - default: - NoViableAltException nvae = - new NoViableAltException("", 12, 22, input); - - throw nvae; - - } - - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 7, input); - - throw nvae; - - } - } - break; - case 36: - { - int LA12_8 = input.LA(2); - - if ( (LA12_8==LBRACKET) ) { - switch ( input.LA(3) ) { - case RBRACKET: - { - int LA12_24 = input.LA(4); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; - } - else if ( (true) ) { - alt12=4; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 24, input); - - throw nvae; - - } - } - break; - case LCLETTER: - { - int LA12_25 = input.LA(4); - - if ( (LA12_25==LCLETTER) ) { - int LA12_31 = input.LA(5); - - if ( (LA12_31==RBRACKET) ) { - int LA12_32 = input.LA(6); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=3; - } - else if ( (true) ) { - alt12=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 32, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 31, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 25, input); - - throw nvae; - - } - } - break; - case COLON: - case COMMA: - case DIGIT: - case MINUS: - case PERIOD: - case PLUS: - case SLASH: - case SPACE: - case UCLETTER: - { - alt12=5; - } - break; - default: - NoViableAltException nvae = - new NoViableAltException("", 12, 22, input); - - throw nvae; - - } - - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 8, input); - - throw nvae; - - } - } - break; - case 26: - { - int LA12_9 = input.LA(2); - - if ( (LA12_9==LBRACKET) ) { - switch ( input.LA(3) ) { - case RBRACKET: - { - int LA12_24 = input.LA(4); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; - } - else if ( (true) ) { - alt12=4; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 24, input); - - throw nvae; - - } - } - break; - case LCLETTER: - { - int LA12_25 = input.LA(4); - - if ( (LA12_25==LCLETTER) ) { - int LA12_31 = input.LA(5); - - if ( (LA12_31==RBRACKET) ) { - int LA12_32 = input.LA(6); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=3; - } - else if ( (true) ) { - alt12=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 32, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 31, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 25, input); - - throw nvae; - - } - } - break; - case COLON: - case COMMA: - case DIGIT: - case MINUS: - case PERIOD: - case PLUS: - case SLASH: - case SPACE: - case UCLETTER: - { - alt12=5; - } - break; - default: - NoViableAltException nvae = - new NoViableAltException("", 12, 22, input); - - throw nvae; - - } - - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 9, input); - - throw nvae; - - } - } - break; - case 46: - { - int LA12_10 = input.LA(2); - - if ( (LA12_10==LBRACKET) ) { - switch ( input.LA(3) ) { - case RBRACKET: - { - int LA12_24 = input.LA(4); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; - } - else if ( (true) ) { - alt12=4; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 24, input); - - throw nvae; - - } - } - break; - case LCLETTER: - { - int LA12_25 = input.LA(4); - - if ( (LA12_25==LCLETTER) ) { - int LA12_31 = input.LA(5); - - if ( (LA12_31==RBRACKET) ) { - int LA12_32 = input.LA(6); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=3; - } - else if ( (true) ) { - alt12=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 32, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 31, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 25, input); - - throw nvae; - - } - } - break; - case COLON: - case COMMA: - case DIGIT: - case MINUS: - case PERIOD: - case PLUS: - case SLASH: - case SPACE: - case UCLETTER: - { - alt12=5; - } - break; - default: - NoViableAltException nvae = - new NoViableAltException("", 12, 22, input); - - throw nvae; - - } - - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 10, input); - - throw nvae; - - } - } - break; - case 38: - { - int LA12_11 = input.LA(2); - - if ( (LA12_11==LBRACKET) ) { - switch ( input.LA(3) ) { - case RBRACKET: - { - int LA12_27 = input.LA(4); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; - } - else if ( (true) ) { - alt12=4; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 27, input); - - throw nvae; - - } - } - break; - case LCLETTER: - { - int LA12_25 = input.LA(4); - - if ( (LA12_25==LCLETTER) ) { - int LA12_31 = input.LA(5); - - if ( (LA12_31==RBRACKET) ) { - int LA12_32 = input.LA(6); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=3; - } - else if ( (true) ) { - alt12=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 32, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 31, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 25, input); - - throw nvae; - - } - } - break; - case COLON: - case COMMA: - case DIGIT: - case MINUS: - case PERIOD: - case PLUS: - case SLASH: - case SPACE: - case UCLETTER: - { - alt12=5; - } - break; - case 22: - case 24: - case 25: - case 26: - case 27: - case 28: - case 29: - case 30: - case 34: - case 35: - case 36: - case 38: - case 39: - case 40: - case 43: - case 44: - case 45: - case 46: - { - alt12=6; - } - break; - default: - NoViableAltException nvae = - new NoViableAltException("", 12, 23, input); - - throw nvae; - - } - - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 11, input); - - throw nvae; - - } - } - break; - case 39: - { - int LA12_12 = input.LA(2); - - if ( (LA12_12==LBRACKET) ) { - switch ( input.LA(3) ) { - case RBRACKET: - { - int LA12_24 = input.LA(4); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; - } - else if ( (true) ) { - alt12=4; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 24, input); - - throw nvae; - - } - } - break; - case LCLETTER: - { - int LA12_25 = input.LA(4); - - if ( (LA12_25==LCLETTER) ) { - int LA12_31 = input.LA(5); - - if ( (LA12_31==RBRACKET) ) { - int LA12_32 = input.LA(6); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=3; - } - else if ( (true) ) { - alt12=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 32, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 31, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 25, input); - - throw nvae; - - } - } - break; - case COLON: - case COMMA: - case DIGIT: - case MINUS: - case PERIOD: - case PLUS: - case SLASH: - case SPACE: - case UCLETTER: - { - alt12=5; - } - break; - default: - NoViableAltException nvae = - new NoViableAltException("", 12, 22, input); - - throw nvae; - - } - - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 12, input); - - throw nvae; - - } - } - break; - case 35: - { - int LA12_13 = input.LA(2); - - if ( (LA12_13==LBRACKET) ) { - switch ( input.LA(3) ) { - case RBRACKET: - { - int LA12_24 = input.LA(4); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; - } - else if ( (true) ) { - alt12=4; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 24, input); - - throw nvae; - - } - } - break; - case LCLETTER: - { - int LA12_25 = input.LA(4); - - if ( (LA12_25==LCLETTER) ) { - int LA12_31 = input.LA(5); - - if ( (LA12_31==RBRACKET) ) { - int LA12_32 = input.LA(6); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=3; - } - else if ( (true) ) { - alt12=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 32, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 31, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 25, input); - - throw nvae; - - } - } - break; - case COLON: - case COMMA: - case DIGIT: - case MINUS: - case PERIOD: - case PLUS: - case SLASH: - case SPACE: - case UCLETTER: - { - alt12=5; - } - break; - default: - NoViableAltException nvae = - new NoViableAltException("", 12, 22, input); - - throw nvae; - - } - - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 13, input); - - throw nvae; - - } - } - break; - case 22: - { - int LA12_14 = input.LA(2); - - if ( (LA12_14==LBRACKET) ) { - switch ( input.LA(3) ) { - case RBRACKET: - { - int LA12_24 = input.LA(4); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; - } - else if ( (true) ) { - alt12=4; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 24, input); - - throw nvae; - - } - } - break; - case LCLETTER: - { - int LA12_25 = input.LA(4); - - if ( (LA12_25==LCLETTER) ) { - int LA12_31 = input.LA(5); - - if ( (LA12_31==RBRACKET) ) { - int LA12_32 = input.LA(6); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=3; - } - else if ( (true) ) { - alt12=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 32, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 31, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 25, input); - - throw nvae; - - } - } - break; - case COLON: - case COMMA: - case DIGIT: - case MINUS: - case PERIOD: - case PLUS: - case SLASH: - case SPACE: - case UCLETTER: - { - alt12=5; - } - break; - default: - NoViableAltException nvae = - new NoViableAltException("", 12, 22, input); - - throw nvae; - - } - - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 14, input); - - throw nvae; - - } - } - break; - case 28: - { - int LA12_15 = input.LA(2); - - if ( (LA12_15==LBRACKET) ) { - switch ( input.LA(3) ) { - case RBRACKET: - { - int LA12_24 = input.LA(4); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; - } - else if ( (true) ) { - alt12=4; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 24, input); - - throw nvae; - - } - } - break; - case LCLETTER: - { - int LA12_25 = input.LA(4); - - if ( (LA12_25==LCLETTER) ) { - int LA12_31 = input.LA(5); - - if ( (LA12_31==RBRACKET) ) { - int LA12_32 = input.LA(6); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=3; - } - else if ( (true) ) { - alt12=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 32, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 31, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 25, input); - - throw nvae; - - } - } - break; - case COLON: - case COMMA: - case DIGIT: - case MINUS: - case PERIOD: - case PLUS: - case SLASH: - case SPACE: - case UCLETTER: - { - alt12=5; - } - break; - default: - NoViableAltException nvae = - new NoViableAltException("", 12, 22, input); - - throw nvae; - - } - - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 15, input); - - throw nvae; - - } - } - break; - case 43: - { - int LA12_16 = input.LA(2); - - if ( (LA12_16==LBRACKET) ) { - switch ( input.LA(3) ) { - case RBRACKET: - { - int LA12_24 = input.LA(4); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; - } - else if ( (true) ) { - alt12=4; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 24, input); - - throw nvae; - - } - } - break; - case LCLETTER: - { - int LA12_25 = input.LA(4); - - if ( (LA12_25==LCLETTER) ) { - int LA12_31 = input.LA(5); - - if ( (LA12_31==RBRACKET) ) { - int LA12_32 = input.LA(6); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=3; - } - else if ( (true) ) { - alt12=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 32, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 31, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 25, input); - - throw nvae; - - } - } - break; - case COLON: - case COMMA: - case DIGIT: - case MINUS: - case PERIOD: - case PLUS: - case SLASH: - case SPACE: - case UCLETTER: - { - alt12=5; - } - break; - default: - NoViableAltException nvae = - new NoViableAltException("", 12, 22, input); - - throw nvae; - - } - - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 16, input); - - throw nvae; - - } - } - break; - case 29: - { - int LA12_17 = input.LA(2); - - if ( (LA12_17==LBRACKET) ) { - switch ( input.LA(3) ) { - case RBRACKET: - { - int LA12_24 = input.LA(4); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; - } - else if ( (true) ) { - alt12=4; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 24, input); - - throw nvae; - - } - } - break; - case LCLETTER: - { - int LA12_25 = input.LA(4); - - if ( (LA12_25==LCLETTER) ) { - int LA12_31 = input.LA(5); - - if ( (LA12_31==RBRACKET) ) { - int LA12_32 = input.LA(6); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=3; - } - else if ( (true) ) { - alt12=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 32, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 31, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 25, input); - - throw nvae; - - } - } - break; - case COLON: - case COMMA: - case DIGIT: - case MINUS: - case PERIOD: - case PLUS: - case SLASH: - case SPACE: - case UCLETTER: - { - alt12=5; - } - break; - default: - NoViableAltException nvae = - new NoViableAltException("", 12, 22, input); - - throw nvae; - - } - - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 17, input); - - throw nvae; - - } - } - break; - case 24: - { - int LA12_18 = input.LA(2); - - if ( (LA12_18==LBRACKET) ) { - switch ( input.LA(3) ) { - case RBRACKET: - { - int LA12_24 = input.LA(4); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; - } - else if ( (true) ) { - alt12=4; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 24, input); - - throw nvae; - - } - } - break; - case LCLETTER: - { - int LA12_25 = input.LA(4); - - if ( (LA12_25==LCLETTER) ) { - int LA12_31 = input.LA(5); - - if ( (LA12_31==RBRACKET) ) { - int LA12_32 = input.LA(6); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=3; - } - else if ( (true) ) { - alt12=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 32, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 31, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 25, input); - - throw nvae; - - } - } - break; - case COLON: - case COMMA: - case DIGIT: - case MINUS: - case PERIOD: - case PLUS: - case SLASH: - case SPACE: - case UCLETTER: - { - alt12=5; - } - break; - default: - NoViableAltException nvae = - new NoViableAltException("", 12, 22, input); - - throw nvae; - - } - - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 18, input); - - throw nvae; - - } - } - break; - case 44: - { - int LA12_19 = input.LA(2); - - if ( (LA12_19==LBRACKET) ) { - switch ( input.LA(3) ) { - case RBRACKET: - { - int LA12_24 = input.LA(4); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=2; - } - else if ( (true) ) { - alt12=4; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 24, input); - - throw nvae; - - } - } - break; - case LCLETTER: - { - int LA12_25 = input.LA(4); - - if ( (LA12_25==LCLETTER) ) { - int LA12_31 = input.LA(5); - - if ( (LA12_31==RBRACKET) ) { - int LA12_32 = input.LA(6); - - if ( ((((input.LT(1).getText().equals("W")))||((input.LT(1).getText().equals("B"))))) ) { - alt12=3; - } - else if ( (true) ) { - alt12=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 32, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 31, input); - - throw nvae; - - } - } - 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=5; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 25, input); - - throw nvae; - - } - } - break; - case COLON: - case COMMA: - case DIGIT: - case MINUS: - case PERIOD: - case PLUS: - case SLASH: - case SPACE: - case UCLETTER: - { - alt12=5; - } - break; - default: - NoViableAltException nvae = - new NoViableAltException("", 12, 22, input); - - throw nvae; - - } - - } - else { - NoViableAltException nvae = - new NoViableAltException("", 12, 19, input); - - throw nvae; - - } - } - break; - case 33: - { - alt12=7; - } - break; - case 21: - case 23: - { - alt12=8; - } - break; - default: - NoViableAltException nvae = - new NoViableAltException("", 12, 0, input); - - throw nvae; - - } - - switch (alt12) { - case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:37:4: ( numIdent ) ( ( LBRACKET numValue RBRACKET ) )+ - { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:37:4: ( numIdent ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:37:5: numIdent - { - pushFollow(FOLLOW_numIdent_in_property140); - numIdent5=numIdent(); - - state._fsp--; - - - sgfProperty.setIdentifier(numIdent5); - - } - - - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:37:64: ( ( LBRACKET numValue RBRACKET ) )+ - int cnt5=0; - loop5: - do { - int alt5=2; - int LA5_0 = input.LA(1); - - if ( (LA5_0==LBRACKET) ) { - alt5=1; - } - - - switch (alt5) { - case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:37:65: ( LBRACKET numValue RBRACKET ) - { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:37:65: ( LBRACKET numValue RBRACKET ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:37:66: LBRACKET numValue RBRACKET - { - match(input,LBRACKET,FOLLOW_LBRACKET_in_property146); - - pushFollow(FOLLOW_numValue_in_property148); - numValue6=numValue(); - - state._fsp--; - - - match(input,RBRACKET,FOLLOW_RBRACKET_in_property150); - - } - - - sgfProperty.addValue((numValue6!=null?numValue6.sgfValue:null)); - - } - break; - - default : - if ( cnt5 >= 1 ) break loop5; - EarlyExitException eee = - new EarlyExitException(5, input); - throw eee; - } - cnt5++; - } while (true); - - - } - break; - case 2 : - // 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 - { - pushFollow(FOLLOW_playerIdent_in_property164); - playerIdent7=playerIdent(); - - state._fsp--; - - - sgfProperty.setIdentifier(playerIdent7); - - } - - - // 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 { - int alt7=2; - int LA7_0 = input.LA(1); - - if ( (LA7_0==LBRACKET) ) { - alt7=1; - } - - - switch (alt7) { - case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:41:72: ( LBRACKET coordValue RBRACKET ) - { - // 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); - - pushFollow(FOLLOW_coordValue_in_property190); - coordValue9=coordValue(); - - state._fsp--; - - - match(input,RBRACKET,FOLLOW_RBRACKET_in_property192); - - } - - - sgfProperty.addValue(new SGFValue((coordValue9!=null?coordValue9.sgfCoord:null))); - - } - break; - - default : - if ( cnt7 >= 1 ) break loop7; - EarlyExitException eee = - new EarlyExitException(7, input); - throw eee; - } - cnt7++; - } while (true); - - - } - break; - case 4 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:44:4: ( strIdent ) ( ( LBRACKET RBRACKET ) ) - { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:44:4: ( strIdent ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:44:5: strIdent - { - pushFollow(FOLLOW_strIdent_in_property206); - strIdent10=strIdent(); - - state._fsp--; - - - sgfProperty.setIdentifier(strIdent10); - - } - - - // 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:44:65: ( LBRACKET RBRACKET ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:44:66: LBRACKET RBRACKET - { - match(input,LBRACKET,FOLLOW_LBRACKET_in_property212); - - match(input,RBRACKET,FOLLOW_RBRACKET_in_property214); - - } - - - sgfProperty.addValue(SGFValue.EMPTY); - - } - - - } - break; - case 5 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:45:4: ( strIdent ) ( ( LBRACKET strValue RBRACKET ) )+ - { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:45:4: ( strIdent ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:45:5: strIdent - { - pushFollow(FOLLOW_strIdent_in_property223); - strIdent11=strIdent(); - - state._fsp--; - - - sgfProperty.setIdentifier(strIdent11); - - } - - - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:45:64: ( ( LBRACKET strValue RBRACKET ) )+ - int cnt8=0; - loop8: - do { - int alt8=2; - int LA8_0 = input.LA(1); - - if ( (LA8_0==LBRACKET) ) { - alt8=1; - } - - - switch (alt8) { - case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:45:65: ( 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_property229); - - pushFollow(FOLLOW_strValue_in_property231); - strValue12=strValue(); - - state._fsp--; - - - match(input,RBRACKET,FOLLOW_RBRACKET_in_property233); - - } - - - sgfProperty.addValue(new SGFValue((strValue12!=null?input.toString(strValue12.start,strValue12.stop):null))); - - } - break; - - default : - if ( cnt8 >= 1 ) break loop8; - EarlyExitException eee = - new EarlyExitException(8, input); - throw eee; - } - cnt8++; - } while (true); - - - } - break; - case 6 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:47:4: ( result ) ( ( LBRACKET resValue RBRACKET ) )+ - { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:47:4: ( result ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:47:5: result - { - pushFollow(FOLLOW_result_in_property245); - result(); - - state._fsp--; - - - sgfProperty.setIdentifier(SGFIdentifier.RESULT); - - } - - - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:47:64: ( ( LBRACKET resValue RBRACKET ) )+ - int cnt9=0; - loop9: - do { - int alt9=2; - int LA9_0 = input.LA(1); - - if ( (LA9_0==LBRACKET) ) { - alt9=1; - } - - - switch (alt9) { - case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:47:65: ( 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_property251); - - pushFollow(FOLLOW_resValue_in_property253); - resValue13=resValue(); - - state._fsp--; - - - match(input,RBRACKET,FOLLOW_RBRACKET_in_property255); - - } - - - sgfProperty.addValue(new SGFValue(new SGFResult((resValue13!=null?input.toString(resValue13.start,resValue13.stop):null)))); - - } - break; - - default : - if ( cnt9 >= 1 ) break loop9; - EarlyExitException eee = - new EarlyExitException(9, input); - throw eee; - } - cnt9++; - } while (true); - - - } - break; - case 7 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:48:4: ( komi ) ( ( LBRACKET realValue RBRACKET ) )+ - { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:48:4: ( komi ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:48:5: komi - { - pushFollow(FOLLOW_komi_in_property265); - komi(); - - state._fsp--; - - - sgfProperty.setIdentifier(SGFIdentifier.KOMI); - - } - - - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:48:60: ( ( LBRACKET realValue RBRACKET ) )+ - int cnt10=0; - loop10: - do { - int alt10=2; - int LA10_0 = input.LA(1); - - if ( (LA10_0==LBRACKET) ) { - alt10=1; - } - - - switch (alt10) { - case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:48:61: ( 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_property271); - - pushFollow(FOLLOW_realValue_in_property273); - realValue14=realValue(); - - state._fsp--; - - - match(input,RBRACKET,FOLLOW_RBRACKET_in_property275); - - } - - - sgfProperty.addValue(new SGFValue(Double.parseDouble((realValue14!=null?input.toString(realValue14.start,realValue14.stop):null)))); - - } - break; - - default : - if ( cnt10 >= 1 ) break loop10; - EarlyExitException eee = - new EarlyExitException(10, input); - throw eee; - } - cnt10++; - } while (true); - - - } - break; - case 8 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:49:4: ( coordIdent ) ( ( LBRACKET coordValue RBRACKET ) )+ - { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:49:4: ( coordIdent ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:49:5: coordIdent - { - pushFollow(FOLLOW_coordIdent_in_property285); - coordIdent15=coordIdent(); - - state._fsp--; - - - sgfProperty.setIdentifier(coordIdent15); - - } - - - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:49:67: ( ( LBRACKET coordValue RBRACKET ) )+ - int cnt11=0; - loop11: - do { - int alt11=2; - int LA11_0 = input.LA(1); - - if ( (LA11_0==LBRACKET) ) { - alt11=1; - } - - - switch (alt11) { - case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:49:68: ( 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_property290); - - pushFollow(FOLLOW_coordValue_in_property292); - coordValue16=coordValue(); - - state._fsp--; - - - match(input,RBRACKET,FOLLOW_RBRACKET_in_property294); - - } - - - sgfProperty.addValue(new SGFValue(new SGFCoord((coordValue16!=null?input.toString(coordValue16.start,coordValue16.stop):null)))); - - } - break; - - default : - if ( cnt11 >= 1 ) break loop11; - EarlyExitException eee = - new EarlyExitException(11, input); - throw eee; - } - cnt11++; - } while (true); - - - } - break; - - } - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return sgfProperty; - } - // $ANTLR end "property" - - - - // $ANTLR start "playerIdent" - // 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 strIdent17 =null; - - SGFIdentifier strIdent18 =null; - - - try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:54:2: ({...}? strIdent |{...}? strIdent ) - int alt13=2; - switch ( input.LA(1) ) { - case 27: - { - int LA13_1 = input.LA(2); - - if ( (((input.LT(1).getText().equals("W")))) ) { - alt13=1; - } - else if ( (((input.LT(1).getText().equals("B")))) ) { - alt13=2; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 13, 1, input); - - throw nvae; - - } - } - break; - case 40: - { - int LA13_2 = input.LA(2); - - if ( (((input.LT(1).getText().equals("W")))) ) { - alt13=1; - } - else if ( (((input.LT(1).getText().equals("B")))) ) { - alt13=2; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 13, 2, input); - - throw nvae; - - } - } - break; - case 25: - { - int LA13_3 = input.LA(2); - - if ( (((input.LT(1).getText().equals("W")))) ) { - alt13=1; - } - else if ( (((input.LT(1).getText().equals("B")))) ) { - alt13=2; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 13, 3, input); - - throw nvae; - - } - } - break; - case 45: - { - int LA13_4 = input.LA(2); - - if ( (((input.LT(1).getText().equals("W")))) ) { - alt13=1; - } - else if ( (((input.LT(1).getText().equals("B")))) ) { - alt13=2; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 13, 4, input); - - throw nvae; - - } - } - break; - case 30: - { - int LA13_5 = input.LA(2); - - if ( (((input.LT(1).getText().equals("W")))) ) { - alt13=1; - } - else if ( (((input.LT(1).getText().equals("B")))) ) { - alt13=2; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 13, 5, input); - - throw nvae; - - } - } - break; - case 34: - { - int LA13_6 = input.LA(2); - - if ( (((input.LT(1).getText().equals("W")))) ) { - alt13=1; - } - else if ( (((input.LT(1).getText().equals("B")))) ) { - alt13=2; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 13, 6, input); - - throw nvae; - - } - } - break; - case 36: - { - int LA13_7 = input.LA(2); - - if ( (((input.LT(1).getText().equals("W")))) ) { - alt13=1; - } - else if ( (((input.LT(1).getText().equals("B")))) ) { - alt13=2; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 13, 7, input); - - throw nvae; - - } - } - break; - case 26: - { - int LA13_8 = input.LA(2); - - if ( (((input.LT(1).getText().equals("W")))) ) { - alt13=1; - } - else if ( (((input.LT(1).getText().equals("B")))) ) { - alt13=2; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 13, 8, input); - - throw nvae; - - } - } - break; - case 46: - { - int LA13_9 = input.LA(2); - - if ( (((input.LT(1).getText().equals("W")))) ) { - alt13=1; - } - else if ( (((input.LT(1).getText().equals("B")))) ) { - alt13=2; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 13, 9, input); - - throw nvae; - - } - } - break; - case 38: - { - int LA13_10 = input.LA(2); - - if ( (((input.LT(1).getText().equals("W")))) ) { - alt13=1; - } - else if ( (((input.LT(1).getText().equals("B")))) ) { - alt13=2; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 13, 10, input); - - throw nvae; - - } - } - break; - case 39: - { - int LA13_11 = input.LA(2); - - if ( (((input.LT(1).getText().equals("W")))) ) { - alt13=1; - } - else if ( (((input.LT(1).getText().equals("B")))) ) { - alt13=2; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 13, 11, input); - - throw nvae; - - } - } - break; - case 35: - { - int LA13_12 = input.LA(2); - - if ( (((input.LT(1).getText().equals("W")))) ) { - alt13=1; - } - else if ( (((input.LT(1).getText().equals("B")))) ) { - alt13=2; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 13, 12, input); - - throw nvae; - - } - } - break; - case 22: - { - int LA13_13 = input.LA(2); - - if ( (((input.LT(1).getText().equals("W")))) ) { - alt13=1; - } - else if ( (((input.LT(1).getText().equals("B")))) ) { - alt13=2; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 13, 13, input); - - throw nvae; - - } - } - break; - case 28: - { - int LA13_14 = input.LA(2); - - if ( (((input.LT(1).getText().equals("W")))) ) { - alt13=1; - } - else if ( (((input.LT(1).getText().equals("B")))) ) { - alt13=2; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 13, 14, input); - - throw nvae; - - } - } - break; - case 43: - { - int LA13_15 = input.LA(2); - - if ( (((input.LT(1).getText().equals("W")))) ) { - alt13=1; - } - else if ( (((input.LT(1).getText().equals("B")))) ) { - alt13=2; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 13, 15, input); - - throw nvae; - - } - } - break; - case 29: - { - int LA13_16 = input.LA(2); - - if ( (((input.LT(1).getText().equals("W")))) ) { - alt13=1; - } - else if ( (((input.LT(1).getText().equals("B")))) ) { - alt13=2; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 13, 16, input); - - throw nvae; - - } - } - break; - case 24: - { - int LA13_17 = input.LA(2); - - if ( (((input.LT(1).getText().equals("W")))) ) { - alt13=1; - } - else if ( (((input.LT(1).getText().equals("B")))) ) { - alt13=2; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 13, 17, input); - - throw nvae; - - } - } - break; - case 44: - { - int LA13_18 = input.LA(2); - - if ( (((input.LT(1).getText().equals("W")))) ) { - alt13=1; - } - else if ( (((input.LT(1).getText().equals("B")))) ) { - alt13=2; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 13, 18, input); - - throw nvae; - - } - } - break; - default: - NoViableAltException nvae = - new NoViableAltException("", 13, 0, input); - - throw nvae; - - } - - switch (alt13) { - case 1 : - // 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_playerIdent317); - strIdent17=strIdent(); - - state._fsp--; - - - sgfPlayer = strIdent17; - - } - break; - case 2 : - // 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_playerIdent326); - strIdent18=strIdent(); - - state._fsp--; - - - sgfPlayer = strIdent18; - - } - break; - - } - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return sgfPlayer; - } - // $ANTLR end "playerIdent" - - - - // $ANTLR start "strIdent" - // 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: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: - { - alt14=1; - } - break; - case 40: - { - alt14=2; - } - break; - case 25: - { - alt14=3; - } - break; - case 45: - { - alt14=4; - } - break; - case 30: - { - alt14=5; - } - break; - case 34: - { - alt14=6; - } - break; - case 36: - { - alt14=7; - } - break; - case 26: - { - alt14=8; - } - break; - case 46: - { - alt14=9; - } - break; - case 38: - { - alt14=10; - } - break; - case 39: - { - alt14=11; - } - break; - case 35: - { - alt14=12; - } - break; - case 22: - { - alt14=13; - } - break; - case 28: - { - alt14=14; - } - break; - case 43: - { - alt14=15; - } - break; - case 29: - { - alt14=16; - } - break; - case 24: - { - alt14=17; - } - break; - case 44: - { - alt14=18; - } - break; - default: - NoViableAltException nvae = - new NoViableAltException("", 14, 0, input); - - throw nvae; - - } - - switch (alt14) { - case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:59:4: charEnc - { - pushFollow(FOLLOW_charEnc_in_strIdent343); - charEnc(); - - state._fsp--; - - - sgfIdent = SGFIdentifier.CHARSET; - - } - break; - case 2 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:60:10: source - { - pushFollow(FOLLOW_source_in_strIdent355); - source(); - - state._fsp--; - - - } - break; - case 3 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:61:10: blackCountry - { - pushFollow(FOLLOW_blackCountry_in_strIdent366); - blackCountry(); - - state._fsp--; - - - } - break; - case 4 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:62:10: whiteCountry - { - pushFollow(FOLLOW_whiteCountry_in_strIdent377); - whiteCountry(); - - state._fsp--; - - - } - break; - case 5 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:63:4: event - { - pushFollow(FOLLOW_event_in_strIdent382); - event(); - - state._fsp--; - - - } - break; - case 6 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:64:4: playerBlack - { - pushFollow(FOLLOW_playerBlack_in_strIdent387); - playerBlack(); - - state._fsp--; - - - } - break; - case 7 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:65:4: playerWhite - { - pushFollow(FOLLOW_playerWhite_in_strIdent392); - playerWhite(); - - state._fsp--; - - - } - break; - case 8 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:66:4: blackRank - { - pushFollow(FOLLOW_blackRank_in_strIdent397); - blackRank(); - - state._fsp--; - - - } - break; - case 9 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:67:4: whiteRank - { - pushFollow(FOLLOW_whiteRank_in_strIdent402); - whiteRank(); - - state._fsp--; - - - } - break; - case 10 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:68:4: result - { - pushFollow(FOLLOW_result_in_strIdent407); - result(); - - state._fsp--; - - - } - break; - case 11 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:69:4: rules - { - pushFollow(FOLLOW_rules_in_strIdent412); - rules(); - - state._fsp--; - - - } - break; - case 12 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:70:4: place - { - pushFollow(FOLLOW_place_in_strIdent417); - place(); - - state._fsp--; - - - } - break; - case 13 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:71:12: application - { - pushFollow(FOLLOW_application_in_strIdent430); - application(); - - state._fsp--; - - - } - break; - case 14 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:72:11: copyright - { - pushFollow(FOLLOW_copyright_in_strIdent442); - copyright(); - - state._fsp--; - - - } - break; - case 15 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:73:11: username - { - pushFollow(FOLLOW_username_in_strIdent454); - username(); - - state._fsp--; - - - } - break; - case 16 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:74:11: date - { - pushFollow(FOLLOW_date_in_strIdent466); - date(); - - state._fsp--; - - - } - break; - case 17 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:75:11: 'B' - { - match(input,24,FOLLOW_24_in_strIdent478); - - sgfIdent = SGFIdentifier.MOVE_BLACK; - - } - break; - case 18 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:76:11: 'W' - { - match(input,44,FOLLOW_44_in_strIdent491); - - sgfIdent = SGFIdentifier.MOVE_WHITE; - - } - break; - - } - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return sgfIdent; - } - // $ANTLR end "strIdent" - - - - // $ANTLR start "coordIdent" - // 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 addBlack19 =null; - - SGFIdentifier addWhite20 =null; - - - try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:82:2: ( addBlack | addWhite ) - int alt15=2; - int LA15_0 = input.LA(1); - - if ( (LA15_0==21) ) { - alt15=1; - } - else if ( (LA15_0==23) ) { - alt15=2; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 15, 0, input); - - throw nvae; - - } - switch (alt15) { - case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:82:4: addBlack - { - pushFollow(FOLLOW_addBlack_in_coordIdent537); - addBlack19=addBlack(); - - state._fsp--; - - - sgfIdent = addBlack19; - - } - break; - case 2 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:83:5: addWhite - { - pushFollow(FOLLOW_addWhite_in_coordIdent545); - addWhite20=addWhite(); - - state._fsp--; - - - sgfIdent = addWhite20; - - } - break; - - } - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return sgfIdent; - } - // $ANTLR end "coordIdent" - - - - // $ANTLR start "numIdent" - // 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:87:2: ( fileFormat | game | size | time ) - int alt16=4; - switch ( input.LA(1) ) { - case 31: - { - alt16=1; - } - break; - case 32: - { - alt16=2; - } - break; - case 41: - { - alt16=3; - } - break; - case 42: - { - alt16=4; - } - break; - default: - NoViableAltException nvae = - new NoViableAltException("", 16, 0, input); - - throw nvae; - - } - - switch (alt16) { - case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:87:4: fileFormat - { - pushFollow(FOLLOW_fileFormat_in_numIdent562); - fileFormat(); - - state._fsp--; - - - sgfIdent = SGFIdentifier.FILE_FORMAT; - - } - break; - case 2 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:88:4: game - { - pushFollow(FOLLOW_game_in_numIdent568); - game(); - - state._fsp--; - - - sgfIdent = SGFIdentifier.GAME; - - } - break; - case 3 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:89:4: size - { - pushFollow(FOLLOW_size_in_numIdent574); - size(); - - state._fsp--; - - - sgfIdent = SGFIdentifier.SIZE; - - } - break; - case 4 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:90:4: time - { - pushFollow(FOLLOW_time_in_numIdent580); - time(); - - state._fsp--; - - - sgfIdent = SGFIdentifier.TIME; - - } - break; - - } - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return sgfIdent; - } - // $ANTLR end "numIdent" - - - public static class numValue_return extends ParserRuleReturnScope { - public SGFValue sgfValue; - }; - - - // $ANTLR start "numValue" - // 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:93:2: ( ( ( DIGIT )+ ) ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:93:4: ( ( 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:93:5: ( DIGIT )+ - int cnt17=0; - loop17: - do { - int alt17=2; - int LA17_0 = input.LA(1); - - if ( (LA17_0==DIGIT) ) { - alt17=1; - } - - - switch (alt17) { - case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:93:5: DIGIT - { - match(input,DIGIT,FOLLOW_DIGIT_in_numValue595); - - } - break; - - default : - if ( cnt17 >= 1 ) break loop17; - EarlyExitException eee = - new EarlyExitException(17, input); - throw eee; - } - cnt17++; - } while (true); - - - } - - - retval.sgfValue = new SGFValue(Integer.parseInt(input.toString(retval.start,input.LT(-1)))); - - } - - retval.stop = input.LT(-1); - - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return retval; - } - // $ANTLR end "numValue" - - - - // $ANTLR start "realIdent" - // 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:96:2: ( komi ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:96:4: komi - { - pushFollow(FOLLOW_komi_in_realIdent608); - komi(); - - state._fsp--; - - - } - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return ; - } - // $ANTLR end "realIdent" - - - public static class resValue_return extends ParserRuleReturnScope { - }; - - - // $ANTLR start "resValue" - // 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:99:2: ( playerIdent PLUS ( 'R' | realValue ) ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:99:4: playerIdent PLUS ( 'R' | realValue ) - { - pushFollow(FOLLOW_playerIdent_in_resValue618); - playerIdent(); - - state._fsp--; - - - match(input,PLUS,FOLLOW_PLUS_in_resValue620); - - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:99:21: ( 'R' | realValue ) - int alt18=2; - int LA18_0 = input.LA(1); - - if ( (LA18_0==37) ) { - alt18=1; - } - else if ( (LA18_0==DIGIT) ) { - alt18=2; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 18, 0, input); - - throw nvae; - - } - switch (alt18) { - case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:99:22: 'R' - { - match(input,37,FOLLOW_37_in_resValue623); - - } - break; - case 2 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:99:28: realValue - { - pushFollow(FOLLOW_realValue_in_resValue627); - realValue(); - - state._fsp--; - - - } - break; - - } - - - } - - retval.stop = input.LT(-1); - - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return retval; - } - // $ANTLR end "resValue" - - - public static class realValue_return extends ParserRuleReturnScope { - }; - - - // $ANTLR start "realValue" - // 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:102:2: ( ( DIGIT )+ PERIOD ( DIGIT )+ ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:102:4: ( DIGIT )+ PERIOD ( DIGIT )+ - { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:102:4: ( DIGIT )+ - int cnt19=0; - loop19: - do { - int alt19=2; - int LA19_0 = input.LA(1); - - if ( (LA19_0==DIGIT) ) { - alt19=1; - } - - - switch (alt19) { - case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:102:4: DIGIT - { - match(input,DIGIT,FOLLOW_DIGIT_in_realValue638); - - } - break; - - default : - if ( cnt19 >= 1 ) break loop19; - EarlyExitException eee = - new EarlyExitException(19, input); - throw eee; - } - cnt19++; - } while (true); - - - match(input,PERIOD,FOLLOW_PERIOD_in_realValue641); - - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:102:18: ( DIGIT )+ - int cnt20=0; - loop20: - do { - int alt20=2; - int LA20_0 = input.LA(1); - - if ( (LA20_0==DIGIT) ) { - alt20=1; - } - - - switch (alt20) { - case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:102:18: DIGIT - { - match(input,DIGIT,FOLLOW_DIGIT_in_realValue643); - - } - break; - - default : - if ( cnt20 >= 1 ) break loop20; - EarlyExitException eee = - new EarlyExitException(20, input); - throw eee; - } - cnt20++; - } while (true); - - - } - - retval.stop = input.LT(-1); - - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return retval; - } - // $ANTLR end "realValue" - - - public static class coordValue_return extends ParserRuleReturnScope { - public SGFCoord sgfCoord; - }; - - - // $ANTLR start "coordValue" - // 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:105:2: ( LCLETTER LCLETTER ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:105:4: LCLETTER LCLETTER - { - match(input,LCLETTER,FOLLOW_LCLETTER_in_coordValue658); - - match(input,LCLETTER,FOLLOW_LCLETTER_in_coordValue660); - - retval.sgfCoord = new SGFCoord(input.toString(retval.start,input.LT(-1))); - - } - - retval.stop = input.LT(-1); - - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return retval; - } - // $ANTLR end "coordValue" - - - - // $ANTLR start "fileFormat" - // 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:109:2: ( 'FF' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:109:4: 'FF' - { - match(input,31,FOLLOW_31_in_fileFormat674); - - } - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return ; - } - // $ANTLR end "fileFormat" - - - - // $ANTLR start "game" - // 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:110:7: ( 'GM' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:110:9: 'GM' - { - match(input,32,FOLLOW_32_in_game682); - - } - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return ; - } - // $ANTLR end "game" - - - - // $ANTLR start "size" - // 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:111:7: ( 'SZ' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:111:9: 'SZ' - { - match(input,41,FOLLOW_41_in_size690); - - } - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return ; - } - // $ANTLR end "size" - - - - // $ANTLR start "charEnc" - // 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:112:9: ( 'CA' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:112:11: 'CA' - { - match(input,27,FOLLOW_27_in_charEnc697); - - } - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return ; - } - // $ANTLR end "charEnc" - - - - // $ANTLR start "source" - // 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:113:8: ( 'SO' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:113:10: 'SO' - { - match(input,40,FOLLOW_40_in_source704); - - } - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return ; - } - // $ANTLR end "source" - - - - // $ANTLR start "blackCountry" - // 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:115:2: ( 'BC' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:115:4: 'BC' - { - match(input,25,FOLLOW_25_in_blackCountry713); - - } - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return ; - } - // $ANTLR end "blackCountry" - - - - // $ANTLR start "whiteCountry" - // 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:117:2: ( 'WC' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:117:4: 'WC' - { - match(input,45,FOLLOW_45_in_whiteCountry722); - - } - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return ; - } - // $ANTLR end "whiteCountry" - - - - // $ANTLR start "event" - // 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:118:7: ( 'EV' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:118:9: 'EV' - { - match(input,30,FOLLOW_30_in_event729); - - } - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return ; - } - // $ANTLR end "event" - - - - // $ANTLR start "playerBlack" - // 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:120:2: ( 'PB' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:120:4: 'PB' - { - match(input,34,FOLLOW_34_in_playerBlack737); - - } - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return ; - } - // $ANTLR end "playerBlack" - - - - // $ANTLR start "playerWhite" - // 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:122:2: ( 'PW' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:122:4: 'PW' - { - match(input,36,FOLLOW_36_in_playerWhite745); - - } - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return ; - } - // $ANTLR end "playerWhite" - - - - // $ANTLR start "blackRank" - // 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:124:2: ( 'BR' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:124:4: 'BR' - { - match(input,26,FOLLOW_26_in_blackRank753); - - } - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return ; - } - // $ANTLR end "blackRank" - - - - // $ANTLR start "whiteRank" - // 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:126:2: ( 'WR' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:126:5: 'WR' - { - match(input,46,FOLLOW_46_in_whiteRank763); - - } - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return ; - } - // $ANTLR end "whiteRank" - - - - // $ANTLR start "komi" - // 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:127:7: ( 'KM' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:127:9: 'KM' - { - match(input,33,FOLLOW_33_in_komi771); - - } - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return ; - } - // $ANTLR end "komi" - - - - // $ANTLR start "result" - // 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:128:9: ( 'RE' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:128:11: 'RE' - { - match(input,38,FOLLOW_38_in_result779); - - } - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return ; - } - // $ANTLR end "result" - - - - // $ANTLR start "rules" - // 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:129:7: ( 'RU' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:129:9: 'RU' - { - match(input,39,FOLLOW_39_in_rules786); - - } - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return ; - } - // $ANTLR end "rules" - - - - // $ANTLR start "place" - // 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:130:8: ( 'PC' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:130:11: 'PC' - { - match(input,35,FOLLOW_35_in_place795); - - } - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return ; - } - // $ANTLR end "place" - - - - // $ANTLR start "application" - // 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:132:2: ( 'AP' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:132:4: 'AP' - { - match(input,22,FOLLOW_22_in_application803); - - } - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return ; - } - // $ANTLR end "application" - - - - // $ANTLR start "time" - // 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:133:6: ( 'TM' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:133:8: 'TM' - { - match(input,42,FOLLOW_42_in_time810); - - } - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return ; - } - // $ANTLR end "time" - - - - // $ANTLR start "date" - // 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:134:7: ( 'DT' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:134:9: 'DT' - { - match(input,29,FOLLOW_29_in_date818); - - } - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return ; - } - // $ANTLR end "date" - - - - // $ANTLR start "addBlack" - // 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:137:2: ( 'AB' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:137:4: 'AB' - { - match(input,21,FOLLOW_21_in_addBlack831); - - sgfIdent = SGFIdentifier.ADD_BLACK; - - } - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return sgfIdent; - } - // $ANTLR end "addBlack" - - - - // $ANTLR start "addWhite" - // 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:141:2: ( 'AW' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:141:4: 'AW' - { - match(input,23,FOLLOW_23_in_addWhite848); - - sgfIdent = SGFIdentifier.ADD_WHITE; - - } - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return sgfIdent; - } - // $ANTLR end "addWhite" - - - - // $ANTLR start "copyright" - // 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:145:2: ( 'CP' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:145:4: 'CP' - { - match(input,28,FOLLOW_28_in_copyright860); - - } - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return ; - } - // $ANTLR end "copyright" - - - - // $ANTLR start "username" - // 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:146:9: ( 'US' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:146:11: 'US' - { - match(input,43,FOLLOW_43_in_username866); - - } - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return ; - } - // $ANTLR end "username" - - - public static class strValue_return extends ParserRuleReturnScope { - }; - - - // $ANTLR start "strValue" - // 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: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:148:12: ( UCLETTER | LCLETTER | MINUS | DIGIT | SPACE | PERIOD | COMMA | PLUS | SLASH | COLON )+ - int cnt21=0; - loop21: - do { - int alt21=2; - int LA21_0 = input.LA(1); - - if ( ((LA21_0 >= COLON && LA21_0 <= COMMA)||LA21_0==DIGIT||LA21_0==LCLETTER||LA21_0==MINUS||(LA21_0 >= PERIOD && LA21_0 <= PLUS)||(LA21_0 >= SLASH && LA21_0 <= UCLETTER)) ) { - alt21=1; - } - - - switch (alt21) { - case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g: - { - if ( (input.LA(1) >= COLON && input.LA(1) <= COMMA)||input.LA(1)==DIGIT||input.LA(1)==LCLETTER||input.LA(1)==MINUS||(input.LA(1) >= PERIOD && input.LA(1) <= PLUS)||(input.LA(1) >= SLASH && input.LA(1) <= UCLETTER) ) { - input.consume(); - state.errorRecovery=false; - } - else { - MismatchedSetException mse = new MismatchedSetException(null,input); - throw mse; - } - - - } - break; - - default : - if ( cnt21 >= 1 ) break loop21; - EarlyExitException eee = - new EarlyExitException(21, input); - throw eee; - } - cnt21++; - } while (true); - - - } - - retval.stop = input.LT(-1); - - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return retval; - } - // $ANTLR end "strValue" - - // Delegated rules - - - - - public static final BitSet FOLLOW_gameTree_in_collection36 = new BitSet(new long[]{0x0000000000000402L}); - public static final BitSet FOLLOW_LPAREN_in_gameTree61 = new BitSet(new long[]{0x0000000000020000L}); - public static final BitSet FOLLOW_sequence_in_gameTree63 = new BitSet(new long[]{0x0000000000010400L}); - public static final BitSet FOLLOW_gameTree_in_gameTree67 = new BitSet(new long[]{0x0000000000010400L}); - public static final BitSet FOLLOW_RPAREN_in_gameTree72 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_node_in_sequence94 = new BitSet(new long[]{0x0000000000020002L}); - public static final BitSet FOLLOW_SEMICOLON_in_node115 = new BitSet(new long[]{0x00007FDFFFE00002L}); - public static final BitSet FOLLOW_property_in_node118 = new BitSet(new long[]{0x00007FDFFFE00002L}); - public static final BitSet FOLLOW_numIdent_in_property140 = new BitSet(new long[]{0x0000000000000100L}); - public static final BitSet FOLLOW_LBRACKET_in_property146 = new BitSet(new long[]{0x0000000000000080L}); - 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_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_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}); + try { + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:31:2: ( SEMICOLON ( + // property )* ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:31:4: SEMICOLON ( + // property )* + { + match(input, SEMICOLON, FOLLOW_SEMICOLON_in_node115); + + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:31:14: ( property + // )* + loop4: do { + int alt4 = 2; + int LA4_0 = input.LA(1); + + if (((LA4_0 >= 21 && LA4_0 <= 36) || (LA4_0 >= 38 && LA4_0 <= 46))) { + alt4 = 1; + } + + switch (alt4) { + case 1: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:31:15: property + { + pushFollow(FOLLOW_property_in_node118); + property4 = property(); + + state._fsp--; + + sgfNode.addProperty(property4); + + } + break; + + default: + break loop4; + } + } while (true); + + } + + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return sgfNode; + } + + // $ANTLR end "node" + + // $ANTLR start "property" + // 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; + + SGFIdentifier numIdent5 = null; + + SGFParser.numValue_return numValue6 = null; + + SGFIdentifier playerIdent7 = null; + + SGFIdentifier playerIdent8 = null; + + SGFParser.coordValue_return coordValue9 = null; + + SGFIdentifier strIdent10 = null; + + SGFIdentifier strIdent11 = null; + + SGFParser.strValue_return strValue12 = null; + + SGFParser.resValue_return resValue13 = 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 + // 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: + case 41: + case 42: { + alt12 = 1; + } + break; + case 27: { + int LA12_2 = input.LA(2); + + if ((LA12_2 == LBRACKET)) { + switch (input.LA(3)) { + case RBRACKET: { + int LA12_24 = input.LA(4); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 2; + } else if ((true)) { + alt12 = 4; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 24, input); + + throw nvae; + + } + } + break; + case LCLETTER: { + int LA12_25 = input.LA(4); + + if ((LA12_25 == LCLETTER)) { + int LA12_31 = input.LA(5); + + if ((LA12_31 == RBRACKET)) { + int LA12_32 = input.LA(6); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 3; + } else if ((true)) { + alt12 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 32, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 31, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 25, input); + + throw nvae; + + } + } + break; + case COLON: + case COMMA: + case DIGIT: + case MINUS: + case PERIOD: + case PLUS: + case SLASH: + case SPACE: + case UCLETTER: { + alt12 = 5; + } + break; + default: + NoViableAltException nvae = new NoViableAltException( + "", 12, 22, input); + + throw nvae; + + } + + } else { + NoViableAltException nvae = new NoViableAltException("", + 12, 2, input); + + throw nvae; + + } + } + break; + case 40: { + int LA12_3 = input.LA(2); + + if ((LA12_3 == LBRACKET)) { + switch (input.LA(3)) { + case RBRACKET: { + int LA12_24 = input.LA(4); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 2; + } else if ((true)) { + alt12 = 4; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 24, input); + + throw nvae; + + } + } + break; + case LCLETTER: { + int LA12_25 = input.LA(4); + + if ((LA12_25 == LCLETTER)) { + int LA12_31 = input.LA(5); + + if ((LA12_31 == RBRACKET)) { + int LA12_32 = input.LA(6); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 3; + } else if ((true)) { + alt12 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 32, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 31, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 25, input); + + throw nvae; + + } + } + break; + case COLON: + case COMMA: + case DIGIT: + case MINUS: + case PERIOD: + case PLUS: + case SLASH: + case SPACE: + case UCLETTER: { + alt12 = 5; + } + break; + default: + NoViableAltException nvae = new NoViableAltException( + "", 12, 22, input); + + throw nvae; + + } + + } else { + NoViableAltException nvae = new NoViableAltException("", + 12, 3, input); + + throw nvae; + + } + } + break; + case 25: { + int LA12_4 = input.LA(2); + + if ((LA12_4 == LBRACKET)) { + switch (input.LA(3)) { + case RBRACKET: { + int LA12_24 = input.LA(4); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 2; + } else if ((true)) { + alt12 = 4; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 24, input); + + throw nvae; + + } + } + break; + case LCLETTER: { + int LA12_25 = input.LA(4); + + if ((LA12_25 == LCLETTER)) { + int LA12_31 = input.LA(5); + + if ((LA12_31 == RBRACKET)) { + int LA12_32 = input.LA(6); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 3; + } else if ((true)) { + alt12 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 32, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 31, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 25, input); + + throw nvae; + + } + } + break; + case COLON: + case COMMA: + case DIGIT: + case MINUS: + case PERIOD: + case PLUS: + case SLASH: + case SPACE: + case UCLETTER: { + alt12 = 5; + } + break; + default: + NoViableAltException nvae = new NoViableAltException( + "", 12, 22, input); + + throw nvae; + + } + + } else { + NoViableAltException nvae = new NoViableAltException("", + 12, 4, input); + + throw nvae; + + } + } + break; + case 45: { + int LA12_5 = input.LA(2); + + if ((LA12_5 == LBRACKET)) { + switch (input.LA(3)) { + case RBRACKET: { + int LA12_24 = input.LA(4); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 2; + } else if ((true)) { + alt12 = 4; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 24, input); + + throw nvae; + + } + } + break; + case LCLETTER: { + int LA12_25 = input.LA(4); + + if ((LA12_25 == LCLETTER)) { + int LA12_31 = input.LA(5); + + if ((LA12_31 == RBRACKET)) { + int LA12_32 = input.LA(6); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 3; + } else if ((true)) { + alt12 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 32, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 31, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 25, input); + + throw nvae; + + } + } + break; + case COLON: + case COMMA: + case DIGIT: + case MINUS: + case PERIOD: + case PLUS: + case SLASH: + case SPACE: + case UCLETTER: { + alt12 = 5; + } + break; + default: + NoViableAltException nvae = new NoViableAltException( + "", 12, 22, input); + + throw nvae; + + } + + } else { + NoViableAltException nvae = new NoViableAltException("", + 12, 5, input); + + throw nvae; + + } + } + break; + case 30: { + int LA12_6 = input.LA(2); + + if ((LA12_6 == LBRACKET)) { + switch (input.LA(3)) { + case RBRACKET: { + int LA12_24 = input.LA(4); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 2; + } else if ((true)) { + alt12 = 4; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 24, input); + + throw nvae; + + } + } + break; + case LCLETTER: { + int LA12_25 = input.LA(4); + + if ((LA12_25 == LCLETTER)) { + int LA12_31 = input.LA(5); + + if ((LA12_31 == RBRACKET)) { + int LA12_32 = input.LA(6); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 3; + } else if ((true)) { + alt12 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 32, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 31, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 25, input); + + throw nvae; + + } + } + break; + case COLON: + case COMMA: + case DIGIT: + case MINUS: + case PERIOD: + case PLUS: + case SLASH: + case SPACE: + case UCLETTER: { + alt12 = 5; + } + break; + default: + NoViableAltException nvae = new NoViableAltException( + "", 12, 22, input); + + throw nvae; + + } + + } else { + NoViableAltException nvae = new NoViableAltException("", + 12, 6, input); + + throw nvae; + + } + } + break; + case 34: { + int LA12_7 = input.LA(2); + + if ((LA12_7 == LBRACKET)) { + switch (input.LA(3)) { + case RBRACKET: { + int LA12_24 = input.LA(4); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 2; + } else if ((true)) { + alt12 = 4; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 24, input); + + throw nvae; + + } + } + break; + case LCLETTER: { + int LA12_25 = input.LA(4); + + if ((LA12_25 == LCLETTER)) { + int LA12_31 = input.LA(5); + + if ((LA12_31 == RBRACKET)) { + int LA12_32 = input.LA(6); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 3; + } else if ((true)) { + alt12 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 32, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 31, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 25, input); + + throw nvae; + + } + } + break; + case COLON: + case COMMA: + case DIGIT: + case MINUS: + case PERIOD: + case PLUS: + case SLASH: + case SPACE: + case UCLETTER: { + alt12 = 5; + } + break; + default: + NoViableAltException nvae = new NoViableAltException( + "", 12, 22, input); + + throw nvae; + + } + + } else { + NoViableAltException nvae = new NoViableAltException("", + 12, 7, input); + + throw nvae; + + } + } + break; + case 36: { + int LA12_8 = input.LA(2); + + if ((LA12_8 == LBRACKET)) { + switch (input.LA(3)) { + case RBRACKET: { + int LA12_24 = input.LA(4); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 2; + } else if ((true)) { + alt12 = 4; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 24, input); + + throw nvae; + + } + } + break; + case LCLETTER: { + int LA12_25 = input.LA(4); + + if ((LA12_25 == LCLETTER)) { + int LA12_31 = input.LA(5); + + if ((LA12_31 == RBRACKET)) { + int LA12_32 = input.LA(6); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 3; + } else if ((true)) { + alt12 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 32, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 31, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 25, input); + + throw nvae; + + } + } + break; + case COLON: + case COMMA: + case DIGIT: + case MINUS: + case PERIOD: + case PLUS: + case SLASH: + case SPACE: + case UCLETTER: { + alt12 = 5; + } + break; + default: + NoViableAltException nvae = new NoViableAltException( + "", 12, 22, input); + + throw nvae; + + } + + } else { + NoViableAltException nvae = new NoViableAltException("", + 12, 8, input); + + throw nvae; + + } + } + break; + case 26: { + int LA12_9 = input.LA(2); + + if ((LA12_9 == LBRACKET)) { + switch (input.LA(3)) { + case RBRACKET: { + int LA12_24 = input.LA(4); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 2; + } else if ((true)) { + alt12 = 4; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 24, input); + + throw nvae; + + } + } + break; + case LCLETTER: { + int LA12_25 = input.LA(4); + + if ((LA12_25 == LCLETTER)) { + int LA12_31 = input.LA(5); + + if ((LA12_31 == RBRACKET)) { + int LA12_32 = input.LA(6); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 3; + } else if ((true)) { + alt12 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 32, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 31, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 25, input); + + throw nvae; + + } + } + break; + case COLON: + case COMMA: + case DIGIT: + case MINUS: + case PERIOD: + case PLUS: + case SLASH: + case SPACE: + case UCLETTER: { + alt12 = 5; + } + break; + default: + NoViableAltException nvae = new NoViableAltException( + "", 12, 22, input); + + throw nvae; + + } + + } else { + NoViableAltException nvae = new NoViableAltException("", + 12, 9, input); + + throw nvae; + + } + } + break; + case 46: { + int LA12_10 = input.LA(2); + + if ((LA12_10 == LBRACKET)) { + switch (input.LA(3)) { + case RBRACKET: { + int LA12_24 = input.LA(4); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 2; + } else if ((true)) { + alt12 = 4; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 24, input); + + throw nvae; + + } + } + break; + case LCLETTER: { + int LA12_25 = input.LA(4); + + if ((LA12_25 == LCLETTER)) { + int LA12_31 = input.LA(5); + + if ((LA12_31 == RBRACKET)) { + int LA12_32 = input.LA(6); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 3; + } else if ((true)) { + alt12 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 32, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 31, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 25, input); + + throw nvae; + + } + } + break; + case COLON: + case COMMA: + case DIGIT: + case MINUS: + case PERIOD: + case PLUS: + case SLASH: + case SPACE: + case UCLETTER: { + alt12 = 5; + } + break; + default: + NoViableAltException nvae = new NoViableAltException( + "", 12, 22, input); + + throw nvae; + + } + + } else { + NoViableAltException nvae = new NoViableAltException("", + 12, 10, input); + + throw nvae; + + } + } + break; + case 38: { + int LA12_11 = input.LA(2); + + if ((LA12_11 == LBRACKET)) { + switch (input.LA(3)) { + case RBRACKET: { + int LA12_27 = input.LA(4); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 2; + } else if ((true)) { + alt12 = 4; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 27, input); + + throw nvae; + + } + } + break; + case LCLETTER: { + int LA12_25 = input.LA(4); + + if ((LA12_25 == LCLETTER)) { + int LA12_31 = input.LA(5); + + if ((LA12_31 == RBRACKET)) { + int LA12_32 = input.LA(6); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 3; + } else if ((true)) { + alt12 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 32, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 31, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 25, input); + + throw nvae; + + } + } + break; + case COLON: + case COMMA: + case DIGIT: + case MINUS: + case PERIOD: + case PLUS: + case SLASH: + case SPACE: + case UCLETTER: { + alt12 = 5; + } + break; + case 22: + case 24: + case 25: + case 26: + case 27: + case 28: + case 29: + case 30: + case 34: + case 35: + case 36: + case 38: + case 39: + case 40: + case 43: + case 44: + case 45: + case 46: { + alt12 = 6; + } + break; + default: + NoViableAltException nvae = new NoViableAltException( + "", 12, 23, input); + + throw nvae; + + } + + } else { + NoViableAltException nvae = new NoViableAltException("", + 12, 11, input); + + throw nvae; + + } + } + break; + case 39: { + int LA12_12 = input.LA(2); + + if ((LA12_12 == LBRACKET)) { + switch (input.LA(3)) { + case RBRACKET: { + int LA12_24 = input.LA(4); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 2; + } else if ((true)) { + alt12 = 4; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 24, input); + + throw nvae; + + } + } + break; + case LCLETTER: { + int LA12_25 = input.LA(4); + + if ((LA12_25 == LCLETTER)) { + int LA12_31 = input.LA(5); + + if ((LA12_31 == RBRACKET)) { + int LA12_32 = input.LA(6); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 3; + } else if ((true)) { + alt12 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 32, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 31, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 25, input); + + throw nvae; + + } + } + break; + case COLON: + case COMMA: + case DIGIT: + case MINUS: + case PERIOD: + case PLUS: + case SLASH: + case SPACE: + case UCLETTER: { + alt12 = 5; + } + break; + default: + NoViableAltException nvae = new NoViableAltException( + "", 12, 22, input); + + throw nvae; + + } + + } else { + NoViableAltException nvae = new NoViableAltException("", + 12, 12, input); + + throw nvae; + + } + } + break; + case 35: { + int LA12_13 = input.LA(2); + + if ((LA12_13 == LBRACKET)) { + switch (input.LA(3)) { + case RBRACKET: { + int LA12_24 = input.LA(4); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 2; + } else if ((true)) { + alt12 = 4; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 24, input); + + throw nvae; + + } + } + break; + case LCLETTER: { + int LA12_25 = input.LA(4); + + if ((LA12_25 == LCLETTER)) { + int LA12_31 = input.LA(5); + + if ((LA12_31 == RBRACKET)) { + int LA12_32 = input.LA(6); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 3; + } else if ((true)) { + alt12 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 32, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 31, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 25, input); + + throw nvae; + + } + } + break; + case COLON: + case COMMA: + case DIGIT: + case MINUS: + case PERIOD: + case PLUS: + case SLASH: + case SPACE: + case UCLETTER: { + alt12 = 5; + } + break; + default: + NoViableAltException nvae = new NoViableAltException( + "", 12, 22, input); + + throw nvae; + + } + + } else { + NoViableAltException nvae = new NoViableAltException("", + 12, 13, input); + + throw nvae; + + } + } + break; + case 22: { + int LA12_14 = input.LA(2); + + if ((LA12_14 == LBRACKET)) { + switch (input.LA(3)) { + case RBRACKET: { + int LA12_24 = input.LA(4); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 2; + } else if ((true)) { + alt12 = 4; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 24, input); + + throw nvae; + + } + } + break; + case LCLETTER: { + int LA12_25 = input.LA(4); + + if ((LA12_25 == LCLETTER)) { + int LA12_31 = input.LA(5); + + if ((LA12_31 == RBRACKET)) { + int LA12_32 = input.LA(6); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 3; + } else if ((true)) { + alt12 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 32, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 31, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 25, input); + + throw nvae; + + } + } + break; + case COLON: + case COMMA: + case DIGIT: + case MINUS: + case PERIOD: + case PLUS: + case SLASH: + case SPACE: + case UCLETTER: { + alt12 = 5; + } + break; + default: + NoViableAltException nvae = new NoViableAltException( + "", 12, 22, input); + + throw nvae; + + } + + } else { + NoViableAltException nvae = new NoViableAltException("", + 12, 14, input); + + throw nvae; + + } + } + break; + case 28: { + int LA12_15 = input.LA(2); + + if ((LA12_15 == LBRACKET)) { + switch (input.LA(3)) { + case RBRACKET: { + int LA12_24 = input.LA(4); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 2; + } else if ((true)) { + alt12 = 4; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 24, input); + + throw nvae; + + } + } + break; + case LCLETTER: { + int LA12_25 = input.LA(4); + + if ((LA12_25 == LCLETTER)) { + int LA12_31 = input.LA(5); + + if ((LA12_31 == RBRACKET)) { + int LA12_32 = input.LA(6); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 3; + } else if ((true)) { + alt12 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 32, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 31, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 25, input); + + throw nvae; + + } + } + break; + case COLON: + case COMMA: + case DIGIT: + case MINUS: + case PERIOD: + case PLUS: + case SLASH: + case SPACE: + case UCLETTER: { + alt12 = 5; + } + break; + default: + NoViableAltException nvae = new NoViableAltException( + "", 12, 22, input); + + throw nvae; + + } + + } else { + NoViableAltException nvae = new NoViableAltException("", + 12, 15, input); + + throw nvae; + + } + } + break; + case 43: { + int LA12_16 = input.LA(2); + + if ((LA12_16 == LBRACKET)) { + switch (input.LA(3)) { + case RBRACKET: { + int LA12_24 = input.LA(4); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 2; + } else if ((true)) { + alt12 = 4; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 24, input); + + throw nvae; + + } + } + break; + case LCLETTER: { + int LA12_25 = input.LA(4); + + if ((LA12_25 == LCLETTER)) { + int LA12_31 = input.LA(5); + + if ((LA12_31 == RBRACKET)) { + int LA12_32 = input.LA(6); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 3; + } else if ((true)) { + alt12 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 32, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 31, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 25, input); + + throw nvae; + + } + } + break; + case COLON: + case COMMA: + case DIGIT: + case MINUS: + case PERIOD: + case PLUS: + case SLASH: + case SPACE: + case UCLETTER: { + alt12 = 5; + } + break; + default: + NoViableAltException nvae = new NoViableAltException( + "", 12, 22, input); + + throw nvae; + + } + + } else { + NoViableAltException nvae = new NoViableAltException("", + 12, 16, input); + + throw nvae; + + } + } + break; + case 29: { + int LA12_17 = input.LA(2); + + if ((LA12_17 == LBRACKET)) { + switch (input.LA(3)) { + case RBRACKET: { + int LA12_24 = input.LA(4); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 2; + } else if ((true)) { + alt12 = 4; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 24, input); + + throw nvae; + + } + } + break; + case LCLETTER: { + int LA12_25 = input.LA(4); + + if ((LA12_25 == LCLETTER)) { + int LA12_31 = input.LA(5); + + if ((LA12_31 == RBRACKET)) { + int LA12_32 = input.LA(6); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 3; + } else if ((true)) { + alt12 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 32, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 31, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 25, input); + + throw nvae; + + } + } + break; + case COLON: + case COMMA: + case DIGIT: + case MINUS: + case PERIOD: + case PLUS: + case SLASH: + case SPACE: + case UCLETTER: { + alt12 = 5; + } + break; + default: + NoViableAltException nvae = new NoViableAltException( + "", 12, 22, input); + + throw nvae; + + } + + } else { + NoViableAltException nvae = new NoViableAltException("", + 12, 17, input); + + throw nvae; + + } + } + break; + case 24: { + int LA12_18 = input.LA(2); + + if ((LA12_18 == LBRACKET)) { + switch (input.LA(3)) { + case RBRACKET: { + int LA12_24 = input.LA(4); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 2; + } else if ((true)) { + alt12 = 4; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 24, input); + + throw nvae; + + } + } + break; + case LCLETTER: { + int LA12_25 = input.LA(4); + + if ((LA12_25 == LCLETTER)) { + int LA12_31 = input.LA(5); + + if ((LA12_31 == RBRACKET)) { + int LA12_32 = input.LA(6); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 3; + } else if ((true)) { + alt12 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 32, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 31, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 25, input); + + throw nvae; + + } + } + break; + case COLON: + case COMMA: + case DIGIT: + case MINUS: + case PERIOD: + case PLUS: + case SLASH: + case SPACE: + case UCLETTER: { + alt12 = 5; + } + break; + default: + NoViableAltException nvae = new NoViableAltException( + "", 12, 22, input); + + throw nvae; + + } + + } else { + NoViableAltException nvae = new NoViableAltException("", + 12, 18, input); + + throw nvae; + + } + } + break; + case 44: { + int LA12_19 = input.LA(2); + + if ((LA12_19 == LBRACKET)) { + switch (input.LA(3)) { + case RBRACKET: { + int LA12_24 = input.LA(4); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 2; + } else if ((true)) { + alt12 = 4; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 24, input); + + throw nvae; + + } + } + break; + case LCLETTER: { + int LA12_25 = input.LA(4); + + if ((LA12_25 == LCLETTER)) { + int LA12_31 = input.LA(5); + + if ((LA12_31 == RBRACKET)) { + int LA12_32 = input.LA(6); + + if (((((input.LT(1).getText().equals("W"))) || ((input + .LT(1).getText().equals("B")))))) { + alt12 = 3; + } else if ((true)) { + alt12 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 32, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 31, input); + + throw nvae; + + } + } 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 = 5; + } else { + NoViableAltException nvae = new NoViableAltException( + "", 12, 25, input); + + throw nvae; + + } + } + break; + case COLON: + case COMMA: + case DIGIT: + case MINUS: + case PERIOD: + case PLUS: + case SLASH: + case SPACE: + case UCLETTER: { + alt12 = 5; + } + break; + default: + NoViableAltException nvae = new NoViableAltException( + "", 12, 22, input); + + throw nvae; + + } + + } else { + NoViableAltException nvae = new NoViableAltException("", + 12, 19, input); + + throw nvae; + + } + } + break; + case 33: { + alt12 = 7; + } + break; + case 21: + case 23: { + alt12 = 8; + } + break; + default: + NoViableAltException nvae = new NoViableAltException("", 12, 0, + input); + + throw nvae; + + } + + switch (alt12) { + case 1: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:37:4: ( numIdent ) ( ( + // LBRACKET numValue RBRACKET ) )+ + { + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:37:4: ( numIdent ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:37:5: numIdent + { + pushFollow(FOLLOW_numIdent_in_property140); + numIdent5 = numIdent(); + + state._fsp--; + + sgfProperty.setIdentifier(numIdent5); + + } + + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:37:64: ( ( LBRACKET + // numValue RBRACKET ) )+ + int cnt5 = 0; + loop5: do { + int alt5 = 2; + int LA5_0 = input.LA(1); + + if ((LA5_0 == LBRACKET)) { + alt5 = 1; + } + + switch (alt5) { + case 1: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:37:65: ( + // LBRACKET numValue RBRACKET ) + { + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:37:65: ( + // LBRACKET numValue RBRACKET ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:37:66: + // LBRACKET numValue RBRACKET + { + match(input, LBRACKET, + FOLLOW_LBRACKET_in_property146); + + pushFollow(FOLLOW_numValue_in_property148); + numValue6 = numValue(); + + state._fsp--; + + match(input, RBRACKET, + FOLLOW_RBRACKET_in_property150); + + } + + sgfProperty + .addValue((numValue6 != null ? numValue6.sgfValue + : null)); + + } + break; + + default: + if (cnt5 >= 1) + break loop5; + EarlyExitException eee = new EarlyExitException(5, + input); + throw eee; + } + cnt5++; + } while (true); + + } + break; + case 2: + // 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 + { + pushFollow(FOLLOW_playerIdent_in_property164); + playerIdent7 = playerIdent(); + + state._fsp--; + + sgfProperty.setIdentifier(playerIdent7); + + } + + // 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 { + int alt7 = 2; + int LA7_0 = input.LA(1); + + if ((LA7_0 == LBRACKET)) { + alt7 = 1; + } + + switch (alt7) { + case 1: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:41:72: ( + // LBRACKET coordValue RBRACKET ) + { + // 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); + + pushFollow(FOLLOW_coordValue_in_property190); + coordValue9 = coordValue(); + + state._fsp--; + + match(input, RBRACKET, + FOLLOW_RBRACKET_in_property192); + + } + + sgfProperty.addValue(new SGFValue( + (coordValue9 != null ? coordValue9.sgfCoord + : null))); + + } + break; + + default: + if (cnt7 >= 1) + break loop7; + EarlyExitException eee = new EarlyExitException(7, + input); + throw eee; + } + cnt7++; + } while (true); + + } + break; + case 4: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:44:4: ( strIdent ) ( ( + // LBRACKET RBRACKET ) ) + { + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:44:4: ( strIdent ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:44:5: strIdent + { + pushFollow(FOLLOW_strIdent_in_property206); + strIdent10 = strIdent(); + + state._fsp--; + + sgfProperty.setIdentifier(strIdent10); + + } + + // 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:44:65: ( + // LBRACKET RBRACKET ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:44:66: LBRACKET + // RBRACKET + { + match(input, LBRACKET, FOLLOW_LBRACKET_in_property212); + + match(input, RBRACKET, FOLLOW_RBRACKET_in_property214); + + } + + sgfProperty.addValue(SGFValue.EMPTY); + + } + + } + break; + case 5: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:45:4: ( strIdent ) ( ( + // LBRACKET strValue RBRACKET ) )+ + { + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:45:4: ( strIdent ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:45:5: strIdent + { + pushFollow(FOLLOW_strIdent_in_property223); + strIdent11 = strIdent(); + + state._fsp--; + + sgfProperty.setIdentifier(strIdent11); + + } + + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:45:64: ( ( LBRACKET + // strValue RBRACKET ) )+ + int cnt8 = 0; + loop8: do { + int alt8 = 2; + int LA8_0 = input.LA(1); + + if ((LA8_0 == LBRACKET)) { + alt8 = 1; + } + + switch (alt8) { + case 1: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:45:65: ( + // 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_property229); + + pushFollow(FOLLOW_strValue_in_property231); + strValue12 = strValue(); + + state._fsp--; + + match(input, RBRACKET, + FOLLOW_RBRACKET_in_property233); + + } + + sgfProperty.addValue(new SGFValue( + (strValue12 != null ? input.toString( + strValue12.start, strValue12.stop) + : null))); + + } + break; + + default: + if (cnt8 >= 1) + break loop8; + EarlyExitException eee = new EarlyExitException(8, + input); + throw eee; + } + cnt8++; + } while (true); + + } + break; + case 6: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:47:4: ( result ) ( ( + // LBRACKET resValue RBRACKET ) )+ + { + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:47:4: ( result ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:47:5: result + { + pushFollow(FOLLOW_result_in_property245); + result(); + + state._fsp--; + + sgfProperty.setIdentifier(SGFIdentifier.RESULT); + + } + + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:47:64: ( ( LBRACKET + // resValue RBRACKET ) )+ + int cnt9 = 0; + loop9: do { + int alt9 = 2; + int LA9_0 = input.LA(1); + + if ((LA9_0 == LBRACKET)) { + alt9 = 1; + } + + switch (alt9) { + case 1: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:47:65: ( + // 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_property251); + + pushFollow(FOLLOW_resValue_in_property253); + resValue13 = resValue(); + + state._fsp--; + + match(input, RBRACKET, + FOLLOW_RBRACKET_in_property255); + + } + + sgfProperty.addValue(new SGFValue( + new SGFResult((resValue13 != null ? input + .toString(resValue13.start, + resValue13.stop) : null)))); + + } + break; + + default: + if (cnt9 >= 1) + break loop9; + EarlyExitException eee = new EarlyExitException(9, + input); + throw eee; + } + cnt9++; + } while (true); + + } + break; + case 7: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:48:4: ( komi ) ( ( + // LBRACKET realValue RBRACKET ) )+ + { + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:48:4: ( komi ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:48:5: komi + { + pushFollow(FOLLOW_komi_in_property265); + komi(); + + state._fsp--; + + sgfProperty.setIdentifier(SGFIdentifier.KOMI); + + } + + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:48:60: ( ( LBRACKET + // realValue RBRACKET ) )+ + int cnt10 = 0; + loop10: do { + int alt10 = 2; + int LA10_0 = input.LA(1); + + if ((LA10_0 == LBRACKET)) { + alt10 = 1; + } + + switch (alt10) { + case 1: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:48:61: ( + // 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_property271); + + pushFollow(FOLLOW_realValue_in_property273); + realValue14 = realValue(); + + state._fsp--; + + match(input, RBRACKET, + FOLLOW_RBRACKET_in_property275); + + } + + sgfProperty.addValue(new SGFValue(Double + .parseDouble((realValue14 != null ? input + .toString(realValue14.start, + realValue14.stop) : null)))); + + } + break; + + default: + if (cnt10 >= 1) + break loop10; + EarlyExitException eee = new EarlyExitException(10, + input); + throw eee; + } + cnt10++; + } while (true); + + } + break; + case 8: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:49:4: ( coordIdent ) ( + // ( LBRACKET coordValue RBRACKET ) )+ + { + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:49:4: ( coordIdent + // ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:49:5: coordIdent + { + pushFollow(FOLLOW_coordIdent_in_property285); + coordIdent15 = coordIdent(); + + state._fsp--; + + sgfProperty.setIdentifier(coordIdent15); + + } + + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:49:67: ( ( LBRACKET + // coordValue RBRACKET ) )+ + int cnt11 = 0; + loop11: do { + int alt11 = 2; + int LA11_0 = input.LA(1); + + if ((LA11_0 == LBRACKET)) { + alt11 = 1; + } + + switch (alt11) { + case 1: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:49:68: ( + // 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_property290); + + pushFollow(FOLLOW_coordValue_in_property292); + coordValue16 = coordValue(); + + state._fsp--; + + match(input, RBRACKET, + FOLLOW_RBRACKET_in_property294); + + } + + sgfProperty.addValue(new SGFValue( + new SGFCoord((coordValue16 != null ? input + .toString(coordValue16.start, + coordValue16.stop) : null)))); + + } + break; + + default: + if (cnt11 >= 1) + break loop11; + EarlyExitException eee = new EarlyExitException(11, + input); + throw eee; + } + cnt11++; + } while (true); + + } + break; + + } + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return sgfProperty; + } + + // $ANTLR end "property" + + // $ANTLR start "playerIdent" + // 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 strIdent17 = null; + + SGFIdentifier strIdent18 = null; + + try { + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:54:2: ({...}? strIdent + // |{...}? strIdent ) + int alt13 = 2; + switch (input.LA(1)) { + case 27: { + int LA13_1 = input.LA(2); + + if ((((input.LT(1).getText().equals("W"))))) { + alt13 = 1; + } else if ((((input.LT(1).getText().equals("B"))))) { + alt13 = 2; + } else { + NoViableAltException nvae = new NoViableAltException("", + 13, 1, input); + + throw nvae; + + } + } + break; + case 40: { + int LA13_2 = input.LA(2); + + if ((((input.LT(1).getText().equals("W"))))) { + alt13 = 1; + } else if ((((input.LT(1).getText().equals("B"))))) { + alt13 = 2; + } else { + NoViableAltException nvae = new NoViableAltException("", + 13, 2, input); + + throw nvae; + + } + } + break; + case 25: { + int LA13_3 = input.LA(2); + + if ((((input.LT(1).getText().equals("W"))))) { + alt13 = 1; + } else if ((((input.LT(1).getText().equals("B"))))) { + alt13 = 2; + } else { + NoViableAltException nvae = new NoViableAltException("", + 13, 3, input); + + throw nvae; + + } + } + break; + case 45: { + int LA13_4 = input.LA(2); + + if ((((input.LT(1).getText().equals("W"))))) { + alt13 = 1; + } else if ((((input.LT(1).getText().equals("B"))))) { + alt13 = 2; + } else { + NoViableAltException nvae = new NoViableAltException("", + 13, 4, input); + + throw nvae; + + } + } + break; + case 30: { + int LA13_5 = input.LA(2); + + if ((((input.LT(1).getText().equals("W"))))) { + alt13 = 1; + } else if ((((input.LT(1).getText().equals("B"))))) { + alt13 = 2; + } else { + NoViableAltException nvae = new NoViableAltException("", + 13, 5, input); + + throw nvae; + + } + } + break; + case 34: { + int LA13_6 = input.LA(2); + + if ((((input.LT(1).getText().equals("W"))))) { + alt13 = 1; + } else if ((((input.LT(1).getText().equals("B"))))) { + alt13 = 2; + } else { + NoViableAltException nvae = new NoViableAltException("", + 13, 6, input); + + throw nvae; + + } + } + break; + case 36: { + int LA13_7 = input.LA(2); + + if ((((input.LT(1).getText().equals("W"))))) { + alt13 = 1; + } else if ((((input.LT(1).getText().equals("B"))))) { + alt13 = 2; + } else { + NoViableAltException nvae = new NoViableAltException("", + 13, 7, input); + + throw nvae; + + } + } + break; + case 26: { + int LA13_8 = input.LA(2); + + if ((((input.LT(1).getText().equals("W"))))) { + alt13 = 1; + } else if ((((input.LT(1).getText().equals("B"))))) { + alt13 = 2; + } else { + NoViableAltException nvae = new NoViableAltException("", + 13, 8, input); + + throw nvae; + + } + } + break; + case 46: { + int LA13_9 = input.LA(2); + + if ((((input.LT(1).getText().equals("W"))))) { + alt13 = 1; + } else if ((((input.LT(1).getText().equals("B"))))) { + alt13 = 2; + } else { + NoViableAltException nvae = new NoViableAltException("", + 13, 9, input); + + throw nvae; + + } + } + break; + case 38: { + int LA13_10 = input.LA(2); + + if ((((input.LT(1).getText().equals("W"))))) { + alt13 = 1; + } else if ((((input.LT(1).getText().equals("B"))))) { + alt13 = 2; + } else { + NoViableAltException nvae = new NoViableAltException("", + 13, 10, input); + + throw nvae; + + } + } + break; + case 39: { + int LA13_11 = input.LA(2); + + if ((((input.LT(1).getText().equals("W"))))) { + alt13 = 1; + } else if ((((input.LT(1).getText().equals("B"))))) { + alt13 = 2; + } else { + NoViableAltException nvae = new NoViableAltException("", + 13, 11, input); + + throw nvae; + + } + } + break; + case 35: { + int LA13_12 = input.LA(2); + + if ((((input.LT(1).getText().equals("W"))))) { + alt13 = 1; + } else if ((((input.LT(1).getText().equals("B"))))) { + alt13 = 2; + } else { + NoViableAltException nvae = new NoViableAltException("", + 13, 12, input); + + throw nvae; + + } + } + break; + case 22: { + int LA13_13 = input.LA(2); + + if ((((input.LT(1).getText().equals("W"))))) { + alt13 = 1; + } else if ((((input.LT(1).getText().equals("B"))))) { + alt13 = 2; + } else { + NoViableAltException nvae = new NoViableAltException("", + 13, 13, input); + + throw nvae; + + } + } + break; + case 28: { + int LA13_14 = input.LA(2); + + if ((((input.LT(1).getText().equals("W"))))) { + alt13 = 1; + } else if ((((input.LT(1).getText().equals("B"))))) { + alt13 = 2; + } else { + NoViableAltException nvae = new NoViableAltException("", + 13, 14, input); + + throw nvae; + + } + } + break; + case 43: { + int LA13_15 = input.LA(2); + + if ((((input.LT(1).getText().equals("W"))))) { + alt13 = 1; + } else if ((((input.LT(1).getText().equals("B"))))) { + alt13 = 2; + } else { + NoViableAltException nvae = new NoViableAltException("", + 13, 15, input); + + throw nvae; + + } + } + break; + case 29: { + int LA13_16 = input.LA(2); + + if ((((input.LT(1).getText().equals("W"))))) { + alt13 = 1; + } else if ((((input.LT(1).getText().equals("B"))))) { + alt13 = 2; + } else { + NoViableAltException nvae = new NoViableAltException("", + 13, 16, input); + + throw nvae; + + } + } + break; + case 24: { + int LA13_17 = input.LA(2); + + if ((((input.LT(1).getText().equals("W"))))) { + alt13 = 1; + } else if ((((input.LT(1).getText().equals("B"))))) { + alt13 = 2; + } else { + NoViableAltException nvae = new NoViableAltException("", + 13, 17, input); + + throw nvae; + + } + } + break; + case 44: { + int LA13_18 = input.LA(2); + + if ((((input.LT(1).getText().equals("W"))))) { + alt13 = 1; + } else if ((((input.LT(1).getText().equals("B"))))) { + alt13 = 2; + } else { + NoViableAltException nvae = new NoViableAltException("", + 13, 18, input); + + throw nvae; + + } + } + break; + default: + NoViableAltException nvae = new NoViableAltException("", 13, 0, + input); + + throw nvae; + + } + + switch (alt13) { + case 1: + // 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_playerIdent317); + strIdent17 = strIdent(); + + state._fsp--; + + sgfPlayer = strIdent17; + + } + break; + case 2: + // 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_playerIdent326); + strIdent18 = strIdent(); + + state._fsp--; + + sgfPlayer = strIdent18; + + } + break; + + } + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return sgfPlayer; + } + + // $ANTLR end "playerIdent" + + // $ANTLR start "strIdent" + // 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: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: { + alt14 = 1; + } + break; + case 40: { + alt14 = 2; + } + break; + case 25: { + alt14 = 3; + } + break; + case 45: { + alt14 = 4; + } + break; + case 30: { + alt14 = 5; + } + break; + case 34: { + alt14 = 6; + } + break; + case 36: { + alt14 = 7; + } + break; + case 26: { + alt14 = 8; + } + break; + case 46: { + alt14 = 9; + } + break; + case 38: { + alt14 = 10; + } + break; + case 39: { + alt14 = 11; + } + break; + case 35: { + alt14 = 12; + } + break; + case 22: { + alt14 = 13; + } + break; + case 28: { + alt14 = 14; + } + break; + case 43: { + alt14 = 15; + } + break; + case 29: { + alt14 = 16; + } + break; + case 24: { + alt14 = 17; + } + break; + case 44: { + alt14 = 18; + } + break; + default: + NoViableAltException nvae = new NoViableAltException("", 14, 0, + input); + + throw nvae; + + } + + switch (alt14) { + case 1: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:59:4: charEnc + { + pushFollow(FOLLOW_charEnc_in_strIdent343); + charEnc(); + + state._fsp--; + + sgfIdent = SGFIdentifier.CHARSET; + + } + break; + case 2: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:60:10: source + { + pushFollow(FOLLOW_source_in_strIdent355); + source(); + + state._fsp--; + + } + break; + case 3: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:61:10: blackCountry + { + pushFollow(FOLLOW_blackCountry_in_strIdent366); + blackCountry(); + + state._fsp--; + + } + break; + case 4: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:62:10: whiteCountry + { + pushFollow(FOLLOW_whiteCountry_in_strIdent377); + whiteCountry(); + + state._fsp--; + + } + break; + case 5: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:63:4: event + { + pushFollow(FOLLOW_event_in_strIdent382); + event(); + + state._fsp--; + + } + break; + case 6: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:64:4: playerBlack + { + pushFollow(FOLLOW_playerBlack_in_strIdent387); + playerBlack(); + + state._fsp--; + + } + break; + case 7: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:65:4: playerWhite + { + pushFollow(FOLLOW_playerWhite_in_strIdent392); + playerWhite(); + + state._fsp--; + + } + break; + case 8: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:66:4: blackRank + { + pushFollow(FOLLOW_blackRank_in_strIdent397); + blackRank(); + + state._fsp--; + + } + break; + case 9: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:67:4: whiteRank + { + pushFollow(FOLLOW_whiteRank_in_strIdent402); + whiteRank(); + + state._fsp--; + + } + break; + case 10: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:68:4: result + { + pushFollow(FOLLOW_result_in_strIdent407); + result(); + + state._fsp--; + + } + break; + case 11: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:69:4: rules + { + pushFollow(FOLLOW_rules_in_strIdent412); + rules(); + + state._fsp--; + + } + break; + case 12: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:70:4: place + { + pushFollow(FOLLOW_place_in_strIdent417); + place(); + + state._fsp--; + + } + break; + case 13: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:71:12: application + { + pushFollow(FOLLOW_application_in_strIdent430); + application(); + + state._fsp--; + + } + break; + case 14: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:72:11: copyright + { + pushFollow(FOLLOW_copyright_in_strIdent442); + copyright(); + + state._fsp--; + + } + break; + case 15: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:73:11: username + { + pushFollow(FOLLOW_username_in_strIdent454); + username(); + + state._fsp--; + + } + break; + case 16: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:74:11: date + { + pushFollow(FOLLOW_date_in_strIdent466); + date(); + + state._fsp--; + + } + break; + case 17: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:75:11: 'B' + { + match(input, 24, FOLLOW_24_in_strIdent478); + + sgfIdent = SGFIdentifier.MOVE_BLACK; + + } + break; + case 18: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:76:11: 'W' + { + match(input, 44, FOLLOW_44_in_strIdent491); + + sgfIdent = SGFIdentifier.MOVE_WHITE; + + } + break; + + } + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return sgfIdent; + } + + // $ANTLR end "strIdent" + + // $ANTLR start "coordIdent" + // 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 addBlack19 = null; + + SGFIdentifier addWhite20 = null; + + try { + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:82:2: ( addBlack | + // addWhite ) + int alt15 = 2; + int LA15_0 = input.LA(1); + + if ((LA15_0 == 21)) { + alt15 = 1; + } else if ((LA15_0 == 23)) { + alt15 = 2; + } else { + NoViableAltException nvae = new NoViableAltException("", 15, 0, + input); + + throw nvae; + + } + switch (alt15) { + case 1: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:82:4: addBlack + { + pushFollow(FOLLOW_addBlack_in_coordIdent537); + addBlack19 = addBlack(); + + state._fsp--; + + sgfIdent = addBlack19; + + } + break; + case 2: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:83:5: addWhite + { + pushFollow(FOLLOW_addWhite_in_coordIdent545); + addWhite20 = addWhite(); + + state._fsp--; + + sgfIdent = addWhite20; + + } + break; + + } + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return sgfIdent; + } + + // $ANTLR end "coordIdent" + + // $ANTLR start "numIdent" + // 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:87:2: ( fileFormat | + // game | size | time ) + int alt16 = 4; + switch (input.LA(1)) { + case 31: { + alt16 = 1; + } + break; + case 32: { + alt16 = 2; + } + break; + case 41: { + alt16 = 3; + } + break; + case 42: { + alt16 = 4; + } + break; + default: + NoViableAltException nvae = new NoViableAltException("", 16, 0, + input); + + throw nvae; + + } + + switch (alt16) { + case 1: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:87:4: fileFormat + { + pushFollow(FOLLOW_fileFormat_in_numIdent562); + fileFormat(); + + state._fsp--; + + sgfIdent = SGFIdentifier.FILE_FORMAT; + + } + break; + case 2: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:88:4: game + { + pushFollow(FOLLOW_game_in_numIdent568); + game(); + + state._fsp--; + + sgfIdent = SGFIdentifier.GAME; + + } + break; + case 3: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:89:4: size + { + pushFollow(FOLLOW_size_in_numIdent574); + size(); + + state._fsp--; + + sgfIdent = SGFIdentifier.SIZE; + + } + break; + case 4: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:90:4: time + { + pushFollow(FOLLOW_time_in_numIdent580); + time(); + + state._fsp--; + + sgfIdent = SGFIdentifier.TIME; + + } + break; + + } + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return sgfIdent; + } + + // $ANTLR end "numIdent" + + public static class numValue_return extends ParserRuleReturnScope { + public SGFValue sgfValue; + }; + + // $ANTLR start "numValue" + // 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:93:2: ( ( ( DIGIT )+ ) + // ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:93:4: ( ( 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:93:5: ( DIGIT + // )+ + int cnt17 = 0; + loop17: do { + int alt17 = 2; + int LA17_0 = input.LA(1); + + if ((LA17_0 == DIGIT)) { + alt17 = 1; + } + + switch (alt17) { + case 1: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:93:5: DIGIT + { + match(input, DIGIT, FOLLOW_DIGIT_in_numValue595); + + } + break; + + default: + if (cnt17 >= 1) + break loop17; + EarlyExitException eee = new EarlyExitException(17, + input); + throw eee; + } + cnt17++; + } while (true); + + } + + retval.sgfValue = new SGFValue(Integer.parseInt(input + .toString(retval.start, input.LT(-1)))); + + } + + retval.stop = input.LT(-1); + + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return retval; + } + + // $ANTLR end "numValue" + + // $ANTLR start "realIdent" + // 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:96:2: ( komi ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:96:4: komi + { + pushFollow(FOLLOW_komi_in_realIdent608); + komi(); + + state._fsp--; + + } + + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "realIdent" + + public static class resValue_return extends ParserRuleReturnScope { + }; + + // $ANTLR start "resValue" + // 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:99:2: ( playerIdent + // PLUS ( 'R' | realValue ) ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:99:4: playerIdent PLUS + // ( 'R' | realValue ) + { + pushFollow(FOLLOW_playerIdent_in_resValue618); + playerIdent(); + + state._fsp--; + + match(input, PLUS, FOLLOW_PLUS_in_resValue620); + + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:99:21: ( 'R' | + // realValue ) + int alt18 = 2; + int LA18_0 = input.LA(1); + + if ((LA18_0 == 37)) { + alt18 = 1; + } else if ((LA18_0 == DIGIT)) { + alt18 = 2; + } else { + NoViableAltException nvae = new NoViableAltException("", + 18, 0, input); + + throw nvae; + + } + switch (alt18) { + case 1: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:99:22: 'R' + { + match(input, 37, FOLLOW_37_in_resValue623); + + } + break; + case 2: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:99:28: realValue + { + pushFollow(FOLLOW_realValue_in_resValue627); + realValue(); + + state._fsp--; + + } + break; + + } + + } + + retval.stop = input.LT(-1); + + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return retval; + } + + // $ANTLR end "resValue" + + public static class realValue_return extends ParserRuleReturnScope { + }; + + // $ANTLR start "realValue" + // 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:102:2: ( ( DIGIT )+ + // PERIOD ( DIGIT )+ ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:102:4: ( DIGIT )+ + // PERIOD ( DIGIT )+ + { + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:102:4: ( DIGIT )+ + int cnt19 = 0; + loop19: do { + int alt19 = 2; + int LA19_0 = input.LA(1); + + if ((LA19_0 == DIGIT)) { + alt19 = 1; + } + + switch (alt19) { + case 1: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:102:4: DIGIT + { + match(input, DIGIT, FOLLOW_DIGIT_in_realValue638); + + } + break; + + default: + if (cnt19 >= 1) + break loop19; + EarlyExitException eee = new EarlyExitException(19, + input); + throw eee; + } + cnt19++; + } while (true); + + match(input, PERIOD, FOLLOW_PERIOD_in_realValue641); + + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:102:18: ( DIGIT )+ + int cnt20 = 0; + loop20: do { + int alt20 = 2; + int LA20_0 = input.LA(1); + + if ((LA20_0 == DIGIT)) { + alt20 = 1; + } + + switch (alt20) { + case 1: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:102:18: DIGIT + { + match(input, DIGIT, FOLLOW_DIGIT_in_realValue643); + + } + break; + + default: + if (cnt20 >= 1) + break loop20; + EarlyExitException eee = new EarlyExitException(20, + input); + throw eee; + } + cnt20++; + } while (true); + + } + + retval.stop = input.LT(-1); + + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return retval; + } + + // $ANTLR end "realValue" + + public static class coordValue_return extends ParserRuleReturnScope { + public SGFCoord sgfCoord; + }; + + // $ANTLR start "coordValue" + // 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:105:2: ( LCLETTER + // LCLETTER ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:105:4: LCLETTER + // LCLETTER + { + match(input, LCLETTER, FOLLOW_LCLETTER_in_coordValue658); + + match(input, LCLETTER, FOLLOW_LCLETTER_in_coordValue660); + + retval.sgfCoord = new SGFCoord(input.toString(retval.start, + input.LT(-1))); + + } + + retval.stop = input.LT(-1); + + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return retval; + } + + // $ANTLR end "coordValue" + + // $ANTLR start "fileFormat" + // 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:109:2: ( 'FF' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:109:4: 'FF' + { + match(input, 31, FOLLOW_31_in_fileFormat674); + + } + + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "fileFormat" + + // $ANTLR start "game" + // 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:110:7: ( 'GM' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:110:9: 'GM' + { + match(input, 32, FOLLOW_32_in_game682); + + } + + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "game" + + // $ANTLR start "size" + // 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:111:7: ( 'SZ' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:111:9: 'SZ' + { + match(input, 41, FOLLOW_41_in_size690); + + } + + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "size" + + // $ANTLR start "charEnc" + // 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:112:9: ( 'CA' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:112:11: 'CA' + { + match(input, 27, FOLLOW_27_in_charEnc697); + + } + + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "charEnc" + + // $ANTLR start "source" + // 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:113:8: ( 'SO' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:113:10: 'SO' + { + match(input, 40, FOLLOW_40_in_source704); + + } + + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "source" + + // $ANTLR start "blackCountry" + // 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:115:2: ( 'BC' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:115:4: 'BC' + { + match(input, 25, FOLLOW_25_in_blackCountry713); + + } + + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "blackCountry" + + // $ANTLR start "whiteCountry" + // 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:117:2: ( 'WC' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:117:4: 'WC' + { + match(input, 45, FOLLOW_45_in_whiteCountry722); + + } + + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "whiteCountry" + + // $ANTLR start "event" + // 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:118:7: ( 'EV' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:118:9: 'EV' + { + match(input, 30, FOLLOW_30_in_event729); + + } + + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "event" + + // $ANTLR start "playerBlack" + // 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:120:2: ( 'PB' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:120:4: 'PB' + { + match(input, 34, FOLLOW_34_in_playerBlack737); + + } + + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "playerBlack" + + // $ANTLR start "playerWhite" + // 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:122:2: ( 'PW' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:122:4: 'PW' + { + match(input, 36, FOLLOW_36_in_playerWhite745); + + } + + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "playerWhite" + + // $ANTLR start "blackRank" + // 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:124:2: ( 'BR' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:124:4: 'BR' + { + match(input, 26, FOLLOW_26_in_blackRank753); + + } + + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "blackRank" + + // $ANTLR start "whiteRank" + // 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:126:2: ( 'WR' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:126:5: 'WR' + { + match(input, 46, FOLLOW_46_in_whiteRank763); + + } + + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "whiteRank" + + // $ANTLR start "komi" + // 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:127:7: ( 'KM' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:127:9: 'KM' + { + match(input, 33, FOLLOW_33_in_komi771); + + } + + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "komi" + + // $ANTLR start "result" + // 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:128:9: ( 'RE' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:128:11: 'RE' + { + match(input, 38, FOLLOW_38_in_result779); + + } + + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "result" + + // $ANTLR start "rules" + // 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:129:7: ( 'RU' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:129:9: 'RU' + { + match(input, 39, FOLLOW_39_in_rules786); + + } + + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "rules" + + // $ANTLR start "place" + // 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:130:8: ( 'PC' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:130:11: 'PC' + { + match(input, 35, FOLLOW_35_in_place795); + + } + + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "place" + + // $ANTLR start "application" + // 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:132:2: ( 'AP' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:132:4: 'AP' + { + match(input, 22, FOLLOW_22_in_application803); + + } + + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "application" + + // $ANTLR start "time" + // 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:133:6: ( 'TM' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:133:8: 'TM' + { + match(input, 42, FOLLOW_42_in_time810); + + } + + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "time" + + // $ANTLR start "date" + // 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:134:7: ( 'DT' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:134:9: 'DT' + { + match(input, 29, FOLLOW_29_in_date818); + + } + + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "date" + + // $ANTLR start "addBlack" + // 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:137:2: ( 'AB' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:137:4: 'AB' + { + match(input, 21, FOLLOW_21_in_addBlack831); + + sgfIdent = SGFIdentifier.ADD_BLACK; + + } + + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return sgfIdent; + } + + // $ANTLR end "addBlack" + + // $ANTLR start "addWhite" + // 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:141:2: ( 'AW' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:141:4: 'AW' + { + match(input, 23, FOLLOW_23_in_addWhite848); + + sgfIdent = SGFIdentifier.ADD_WHITE; + + } + + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return sgfIdent; + } + + // $ANTLR end "addWhite" + + // $ANTLR start "copyright" + // 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:145:2: ( 'CP' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:145:4: 'CP' + { + match(input, 28, FOLLOW_28_in_copyright860); + + } + + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "copyright" + + // $ANTLR start "username" + // 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:146:9: ( 'US' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:146:11: 'US' + { + match(input, 43, FOLLOW_43_in_username866); + + } + + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "username" + + public static class strValue_return extends ParserRuleReturnScope { + }; + + // $ANTLR start "strValue" + // 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: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:148:12: ( UCLETTER + // | LCLETTER | MINUS | DIGIT | SPACE | PERIOD | COMMA | PLUS | + // SLASH | COLON )+ + int cnt21 = 0; + loop21: do { + int alt21 = 2; + int LA21_0 = input.LA(1); + + if (((LA21_0 >= COLON && LA21_0 <= COMMA) + || LA21_0 == DIGIT || LA21_0 == LCLETTER + || LA21_0 == MINUS + || (LA21_0 >= PERIOD && LA21_0 <= PLUS) || (LA21_0 >= SLASH && LA21_0 <= UCLETTER))) { + alt21 = 1; + } + + switch (alt21) { + case 1: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g: + { + if ((input.LA(1) >= COLON && input.LA(1) <= COMMA) + || input.LA(1) == DIGIT + || input.LA(1) == LCLETTER + || input.LA(1) == MINUS + || (input.LA(1) >= PERIOD && input.LA(1) <= PLUS) + || (input.LA(1) >= SLASH && input.LA(1) <= UCLETTER)) { + input.consume(); + state.errorRecovery = false; + } else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + throw mse; + } + + } + break; + + default: + if (cnt21 >= 1) + break loop21; + EarlyExitException eee = new EarlyExitException(21, + input); + throw eee; + } + cnt21++; + } while (true); + + } + + retval.stop = input.LT(-1); + + } catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + + finally { + // do for sure before leaving + } + return retval; + } + + // $ANTLR end "strValue" + + // Delegated rules + + public static final BitSet FOLLOW_gameTree_in_collection36 = new BitSet( + new long[] { 0x0000000000000402L }); + public static final BitSet FOLLOW_LPAREN_in_gameTree61 = new BitSet( + new long[] { 0x0000000000020000L }); + public static final BitSet FOLLOW_sequence_in_gameTree63 = new BitSet( + new long[] { 0x0000000000010400L }); + public static final BitSet FOLLOW_gameTree_in_gameTree67 = new BitSet( + new long[] { 0x0000000000010400L }); + public static final BitSet FOLLOW_RPAREN_in_gameTree72 = new BitSet( + new long[] { 0x0000000000000002L }); + public static final BitSet FOLLOW_node_in_sequence94 = new BitSet( + new long[] { 0x0000000000020002L }); + public static final BitSet FOLLOW_SEMICOLON_in_node115 = new BitSet( + new long[] { 0x00007FDFFFE00002L }); + public static final BitSet FOLLOW_property_in_node118 = new BitSet( + new long[] { 0x00007FDFFFE00002L }); + public static final BitSet FOLLOW_numIdent_in_property140 = new BitSet( + new long[] { 0x0000000000000100L }); + public static final BitSet FOLLOW_LBRACKET_in_property146 = new BitSet( + new long[] { 0x0000000000000080L }); + 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_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_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/SGFValue.java b/src/net/woodyfolsom/msproj/sgf/SGFValue.java index 974b73e..426de8b 100644 --- a/src/net/woodyfolsom/msproj/sgf/SGFValue.java +++ b/src/net/woodyfolsom/msproj/sgf/SGFValue.java @@ -2,27 +2,27 @@ package net.woodyfolsom.msproj.sgf; public class SGFValue { public static final SGFValue EMPTY = new SGFValue(""); - + private String text; private T value; - + public SGFValue(T value) { this.text = value.toString(); this.value = value; } - + public boolean isEmpty() { return text.length() == 0; } - + public String getText() { return text; } - + public T getValue() { return value; } - + @Override public String toString() { return value.toString(); diff --git a/src/net/woodyfolsom/msproj/sgf/StrValue.java b/src/net/woodyfolsom/msproj/sgf/StrValue.java index 22d4dbb..63d93b5 100644 --- a/src/net/woodyfolsom/msproj/sgf/StrValue.java +++ b/src/net/woodyfolsom/msproj/sgf/StrValue.java @@ -2,7 +2,7 @@ package net.woodyfolsom.msproj.sgf; public class StrValue { public final String value; - + public StrValue(String value) { this.value = value; } diff --git a/src/net/woodyfolsom/msproj/tree/AlphaBetaProperties.java b/src/net/woodyfolsom/msproj/tree/AlphaBetaProperties.java index d5612a0..c980bd4 100644 --- a/src/net/woodyfolsom/msproj/tree/AlphaBetaProperties.java +++ b/src/net/woodyfolsom/msproj/tree/AlphaBetaProperties.java @@ -1,22 +1,22 @@ package net.woodyfolsom.msproj.tree; public class AlphaBetaProperties extends MinimaxProperties { - + double alpha = Double.NEGATIVE_INFINITY; double beta = Double.POSITIVE_INFINITY; - + public double getAlpha() { return alpha; } - + public void setAlpha(double d) { this.alpha = d; } - + public double getBeta() { return beta; } - + public void setBeta(double beta) { this.beta = beta; } diff --git a/src/net/woodyfolsom/msproj/tree/GameTreeNode.java b/src/net/woodyfolsom/msproj/tree/GameTreeNode.java index 9c434ea..eb998ba 100644 --- a/src/net/woodyfolsom/msproj/tree/GameTreeNode.java +++ b/src/net/woodyfolsom/msproj/tree/GameTreeNode.java @@ -6,7 +6,6 @@ import java.util.Set; import net.woodyfolsom.msproj.Action; import net.woodyfolsom.msproj.GameState; -import net.woodyfolsom.msproj.Player; public class GameTreeNode { private GameState gameState; @@ -39,7 +38,7 @@ public class GameTreeNode { public GameState getGameState() { return gameState; } - + public GameTreeNode getParent() { return parent; } @@ -47,7 +46,7 @@ public class GameTreeNode { public T getProperties() { return properties; } - + public boolean isRoot() { return parent == null; } diff --git a/src/net/woodyfolsom/msproj/tree/MonteCarloProperties.java b/src/net/woodyfolsom/msproj/tree/MonteCarloProperties.java index 30d2361..5a3c7b2 100644 --- a/src/net/woodyfolsom/msproj/tree/MonteCarloProperties.java +++ b/src/net/woodyfolsom/msproj/tree/MonteCarloProperties.java @@ -3,19 +3,19 @@ package net.woodyfolsom.msproj.tree; public class MonteCarloProperties extends GameTreeNodeProperties { int visits = 0; int wins = 0; - + public int getVisits() { return visits; } - + public void setVisits(int visits) { this.visits = visits; } - + public int getWins() { return wins; } - + public void setWins(int wins) { this.wins = wins; } diff --git a/test/net/woodyfolsom/msproj/policy/AlphaBetaTest.java b/test/net/woodyfolsom/msproj/policy/AlphaBetaTest.java index 381e5d4..adcc405 100644 --- a/test/net/woodyfolsom/msproj/policy/AlphaBetaTest.java +++ b/test/net/woodyfolsom/msproj/policy/AlphaBetaTest.java @@ -14,8 +14,11 @@ public class AlphaBetaTest { Policy treeSearch = new AlphaBeta(); GameConfig gameConfig = new GameConfig(6); GameState gameState = new GameState(gameConfig); + gameState.playStone(Player.BLACK, Action.getInstance("PASS")); gameState.playStone(Player.WHITE, Action.getInstance("A2")); + gameState.playStone(Player.BLACK, Action.getInstance("PASS")); gameState.playStone(Player.WHITE, Action.getInstance("B1")); + gameState.playStone(Player.BLACK, Action.getInstance("PASS")); gameState.playStone(Player.WHITE, Action.getInstance("C2")); gameState.playStone(Player.BLACK, Action.getInstance("B2")); @@ -38,7 +41,9 @@ public class AlphaBetaTest { GameConfig gameConfig = new GameConfig(6); GameState gameState = new GameState(gameConfig); gameState.playStone(Player.BLACK, Action.getInstance("A2")); + gameState.playStone(Player.WHITE, Action.getInstance("PASS")); gameState.playStone(Player.BLACK, Action.getInstance("B1")); + gameState.playStone(Player.WHITE, Action.getInstance("PASS")); gameState.playStone(Player.BLACK, Action.getInstance("C2")); gameState.playStone(Player.WHITE, Action.getInstance("B2")); diff --git a/test/net/woodyfolsom/msproj/policy/MonteCarloUCTTest.java b/test/net/woodyfolsom/msproj/policy/MonteCarloUCTTest.java index 570a6a9..2831e9c 100644 --- a/test/net/woodyfolsom/msproj/policy/MonteCarloUCTTest.java +++ b/test/net/woodyfolsom/msproj/policy/MonteCarloUCTTest.java @@ -17,8 +17,11 @@ public class MonteCarloUCTTest { Policy treeSearch = new MonteCarloUCT(new RandomMovePolicy(),10000L); GameConfig gameConfig = new GameConfig(6); GameState gameState = new GameState(gameConfig); + gameState.playStone(Player.BLACK, Action.getInstance("PASS")); gameState.playStone(Player.WHITE, Action.getInstance("A2")); + gameState.playStone(Player.BLACK, Action.getInstance("PASS")); gameState.playStone(Player.WHITE, Action.getInstance("B1")); + gameState.playStone(Player.BLACK, Action.getInstance("PASS")); gameState.playStone(Player.WHITE, Action.getInstance("C2")); gameState.playStone(Player.BLACK, Action.getInstance("B2")); diff --git a/test/net/woodyfolsom/msproj/sgf/CollectionTest.java b/test/net/woodyfolsom/msproj/sgf/CollectionTest.java index 0e8d287..41d2916 100644 --- a/test/net/woodyfolsom/msproj/sgf/CollectionTest.java +++ b/test/net/woodyfolsom/msproj/sgf/CollectionTest.java @@ -3,9 +3,6 @@ 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; diff --git a/test/net/woodyfolsom/msproj/sgf/SGFParserTest.java b/test/net/woodyfolsom/msproj/sgf/SGFParserTest.java index c96cd1d..1c89a7e 100644 --- a/test/net/woodyfolsom/msproj/sgf/SGFParserTest.java +++ b/test/net/woodyfolsom/msproj/sgf/SGFParserTest.java @@ -2,7 +2,6 @@ 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; @@ -15,20 +14,21 @@ 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(""); - + 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(""); + } }