diff --git a/src/net/woodyfolsom/msproj/GameState.java b/src/net/woodyfolsom/msproj/GameState.java index e6322d0..7b28c08 100644 --- a/src/net/woodyfolsom/msproj/GameState.java +++ b/src/net/woodyfolsom/msproj/GameState.java @@ -7,17 +7,20 @@ public class GameState { private int blackPrisoners = 0; private int whitePrisoners = 0; private GameBoard gameBoard; + private Player playerToMove; public GameState(int size) { if (size < 1 || size > 19) { throw new IllegalArgumentException("Invalid board size: " + size); } gameBoard = new GameBoard(size); + playerToMove = Player.BLACK; } public GameState(GameState that) { this.blackPrisoners = that.blackPrisoners; this.whitePrisoners = that.whitePrisoners; + this.playerToMove = that.playerToMove; gameBoard = new GameBoard(that.gameBoard); } @@ -25,6 +28,7 @@ public class GameState { blackPrisoners = 0; whitePrisoners = 0; gameBoard.clear(); + playerToMove = Player.BLACK; } public int getBlackPrisoners() { @@ -49,6 +53,10 @@ public class GameState { return gameBoard; } + public Player getPlayerToMove() { + return playerToMove; + } + public int getWhitePrisoners() { return whitePrisoners; } @@ -72,12 +80,16 @@ public class GameState { * @return */ public boolean playStone(Player player, Action action) { + if (player != playerToMove) { + 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); return true; } @@ -189,6 +201,7 @@ public class GameState { return false; } else { //assertCorrectHash(); + playerToMove = GoGame.getNextPlayer(player); return true; } } diff --git a/src/net/woodyfolsom/msproj/GoGame.java b/src/net/woodyfolsom/msproj/GoGame.java index aec015e..c876c63 100644 --- a/src/net/woodyfolsom/msproj/GoGame.java +++ b/src/net/woodyfolsom/msproj/GoGame.java @@ -139,8 +139,8 @@ public class GoGame implements Runnable { localOutput.println("=\n"); break; case genmove: - LOGGER.info("Generating move for:\n" + gameState); - + System.out.println("Generating move for:\n" + gameState); + System.out.println("It is currently " + gameState.getPlayerToMove() + "'s turn."); String playerName = cmd.getStringField(1); Player player; @@ -224,6 +224,8 @@ public class GoGame implements Runnable { executeCommand(cmd); + System.out.println("It is now " + gameState.getPlayerToMove() + "'s turn.\n"); + if (cmd.getType() == Command.TYPE.genmove) { System.out.println("New game state:\n" + gameState); } diff --git a/src/net/woodyfolsom/msproj/policy/MonteCarlo.java b/src/net/woodyfolsom/msproj/policy/MonteCarlo.java index 0ebc391..4ddf5b6 100644 --- a/src/net/woodyfolsom/msproj/policy/MonteCarlo.java +++ b/src/net/woodyfolsom/msproj/policy/MonteCarlo.java @@ -39,6 +39,9 @@ public abstract class MonteCarlo implements Policy { Player player) { long startTime = System.currentTimeMillis(); + if (gameState.getPlayerToMove() != player) { + 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. @@ -51,10 +54,10 @@ public abstract class MonteCarlo implements Policy { List> selectedNodes = descend(rootNode); List> newLeaves = new ArrayList>(); - Player nextPlayer = GoGame.getNextPlayer(player); - for (GameTreeNode selectedNode: selectedNodes) { - for (GameTreeNode newLeaf : grow(gameConfig, selectedNode, nextPlayer)) { + Player playerToMove = selectedNode.getGameState().getPlayerToMove(); + + for (GameTreeNode newLeaf : grow(gameConfig, selectedNode, playerToMove)) { newLeaves.add(newLeaf); } } diff --git a/src/net/woodyfolsom/msproj/policy/MonteCarloUCT.java b/src/net/woodyfolsom/msproj/policy/MonteCarloUCT.java index 3490a28..4b18413 100644 --- a/src/net/woodyfolsom/msproj/policy/MonteCarloUCT.java +++ b/src/net/woodyfolsom/msproj/policy/MonteCarloUCT.java @@ -27,7 +27,7 @@ public class MonteCarloUCT extends MonteCarlo { GameTreeNode bestNode = node; //What if the optimum leaf node is actually a terminal node? - //Grom Kocsis and Szepesvari, the value of an actual terminal node is 0, so it will never be grown. + //From Kocsis and Szepesvari, the value of an actual terminal node is 0, so it will never be grown. double nodeVisits = node.getProperties().getVisits(); @@ -74,13 +74,13 @@ public class MonteCarloUCT extends MonteCarlo { @Override public List> grow(GameConfig gameConfig, GameTreeNode node, Player player) { - GameState nextGameState = new GameState(node.getGameState()); Policy randomMovePolicy = new RandomMovePolicy(); Set exploredActions = node.getActions(); 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); } + GameState nextGameState = new GameState(node.getGameState()); nextGameState.playStone(player, action); List> newChildren = new ArrayList>(); GameTreeNode newChild = new GameTreeNode(nextGameState,new MonteCarloProperties()); @@ -92,23 +92,23 @@ public class MonteCarloUCT extends MonteCarlo { } @Override + /** * Rollout currently depends on the hardcoded ROLLOUT_DEPTH_LIMIT superclass parameter, - * since without (super)ko detection, there is no way to guarantee a rollout will terminate. - * Even with ko detection, a rollout might take an unrealistically long time due to unlikely playouts. + * Even with super-ko detection, a rollout might take an unrealistically long time due to unlikely playouts. */ public int rollout(GameConfig gameConfig, StateEvaluator stateEvaluator, GameTreeNode node, Player player) { Policy randomMovePolicy = new RandomMovePolicy(); Action action; int rolloutDepth = 0; - GameState finalGameState = new GameState(node.getGameState()); - Player currentPlayer = player; + GameState rolloutGameState = new GameState(node.getGameState()); + Player currentPlayer = rolloutGameState.getPlayerToMove(); do { rolloutDepth++; - action = randomMovePolicy.getAction(gameConfig, finalGameState, currentPlayer); + action = randomMovePolicy.getAction(gameConfig, rolloutGameState, currentPlayer); if (action != Action.NONE) { - if (!finalGameState.playStone(currentPlayer, action)) { + if (!rolloutGameState.playStone(currentPlayer, action)) { throw new RuntimeException("Failed to play move selected by RandomMovePolicy"); } currentPlayer = GoGame.getNextPlayer(currentPlayer); @@ -117,7 +117,7 @@ public class MonteCarloUCT extends MonteCarlo { numStateEvaluations++; - if (stateEvaluator.scoreGame(finalGameState).isWinner(player)) { + if (stateEvaluator.scoreGame(rolloutGameState).isWinner(player)) { return 1; } else { return 0; diff --git a/src/net/woodyfolsom/msproj/policy/RandomMovePolicy.java b/src/net/woodyfolsom/msproj/policy/RandomMovePolicy.java index 1049c06..6179a43 100644 --- a/src/net/woodyfolsom/msproj/policy/RandomMovePolicy.java +++ b/src/net/woodyfolsom/msproj/policy/RandomMovePolicy.java @@ -34,6 +34,10 @@ 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!"); + } + GameState gameStateCopy = new GameState(gameState); ActionGenerator actionGenerator = new ValidMoveGenerator(); diff --git a/src/net/woodyfolsom/msproj/sgf/SGF.tokens b/src/net/woodyfolsom/msproj/sgf/SGF.tokens index 9edf52d..6a59685 100644 --- a/src/net/woodyfolsom/msproj/sgf/SGF.tokens +++ b/src/net/woodyfolsom/msproj/sgf/SGF.tokens @@ -1,5 +1,3 @@ -T__19=19 -T__20=20 T__21=21 T__22=22 T__23=23 @@ -19,39 +17,53 @@ T__36=36 T__37=37 T__38=38 T__39=39 +T__40=40 +T__41=41 +T__42=42 +T__43=43 +T__44=44 +T__45=45 +T__46=46 COLON=4 COMMA=5 -DIGIT=6 -LBRACKET=7 -LCLETTER=8 -LPAREN=9 -MINUS=10 -PERIOD=11 -PLUS=12 -RBRACKET=13 -RPAREN=14 -SEMICOLON=15 -SLASH=16 -SPACE=17 -UCLETTER=18 -'AB'=19 -'AP'=20 -'BC'=21 -'BR'=22 -'CA'=23 -'CP'=24 -'EV'=25 -'FF'=26 -'GM'=27 -'KM'=28 -'PB'=29 -'PC'=30 -'PW'=31 -'RE'=32 -'RU'=33 -'SO'=34 -'SZ'=35 -'TM'=36 -'US'=37 -'WC'=38 -'WR'=39 +CR=6 +DIGIT=7 +LBRACKET=8 +LCLETTER=9 +LPAREN=10 +MINUS=11 +NEWLINE=12 +PERIOD=13 +PLUS=14 +RBRACKET=15 +RPAREN=16 +SEMICOLON=17 +SLASH=18 +SPACE=19 +UCLETTER=20 +'AB'=21 +'AP'=22 +'AW'=23 +'B'=24 +'BC'=25 +'BR'=26 +'CA'=27 +'CP'=28 +'DT'=29 +'EV'=30 +'FF'=31 +'GM'=32 +'KM'=33 +'PB'=34 +'PC'=35 +'PW'=36 +'R'=37 +'RE'=38 +'RU'=39 +'SO'=40 +'SZ'=41 +'TM'=42 +'US'=43 +'W'=44 +'WC'=45 +'WR'=46 diff --git a/src/net/woodyfolsom/msproj/sgf/SGFCoord.java b/src/net/woodyfolsom/msproj/sgf/SGFCoord.java new file mode 100644 index 0000000..3537c30 --- /dev/null +++ b/src/net/woodyfolsom/msproj/sgf/SGFCoord.java @@ -0,0 +1,27 @@ +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); + } + 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; + } +} diff --git a/src/net/woodyfolsom/msproj/sgf/SGFGameTree.java b/src/net/woodyfolsom/msproj/sgf/SGFGameTree.java new file mode 100644 index 0000000..49826e1 --- /dev/null +++ b/src/net/woodyfolsom/msproj/sgf/SGFGameTree.java @@ -0,0 +1,35 @@ +package net.woodyfolsom.msproj.sgf; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +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) { + this.nodeSequence.add(node); + } + } + + public void addSubTree(SGFGameTree subTree) { + subTrees.add(subTree); + } + + public int getSubTreeCount() { + return subTrees.size(); + } +} diff --git a/src/net/woodyfolsom/msproj/sgf/SGFIdentifier.java b/src/net/woodyfolsom/msproj/sgf/SGFIdentifier.java new file mode 100644 index 0000000..42ef67d --- /dev/null +++ b/src/net/woodyfolsom/msproj/sgf/SGFIdentifier.java @@ -0,0 +1,26 @@ +package net.woodyfolsom.msproj.sgf; + +public class SGFIdentifier { + public static final SGFIdentifier ADD_BLACK = new SGFIdentifier("AB"); + public static final SGFIdentifier ADD_WHITE = new SGFIdentifier("AW"); + public static final SGFIdentifier CHARSET = new SGFIdentifier("CA"); + public static final SGFIdentifier FILE_FORMAT = new SGFIdentifier("FF"); + public static final SGFIdentifier GAME = new SGFIdentifier("GM"); + public static final SGFIdentifier KOMI = new SGFIdentifier("KM"); + public static final SGFIdentifier MOVE_BLACK = new SGFIdentifier("B"); + public static final SGFIdentifier MOVE_WHITE = new SGFIdentifier("W"); + 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 4b01a13..efecca7 100644 --- a/src/net/woodyfolsom/msproj/sgf/SGFLexer.java +++ b/src/net/woodyfolsom/msproj/sgf/SGFLexer.java @@ -1,4 +1,4 @@ -// $ANTLR 3.4 C:\\Users\\Woody\\Documents\\antlr\\SGF.g 2012-09-22 17:28:19 +// $ANTLR 3.4 C:\\Users\\Woody\\Documents\\antlr\\SGF.g 2012-09-23 16:20:53 package net.woodyfolsom.msproj.sgf; import org.antlr.runtime.*; @@ -9,8 +9,6 @@ import java.util.ArrayList; @SuppressWarnings({"all", "warnings", "unchecked"}) public class SGFLexer extends Lexer { public static final int EOF=-1; - public static final int T__19=19; - public static final int T__20=20; public static final int T__21=21; public static final int T__22=22; public static final int T__23=23; @@ -30,21 +28,30 @@ public class SGFLexer extends Lexer { 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 DIGIT=6; - public static final int LBRACKET=7; - public static final int LCLETTER=8; - public static final int LPAREN=9; - public static final int MINUS=10; - public static final int PERIOD=11; - public static final int PLUS=12; - public static final int RBRACKET=13; - public static final int RPAREN=14; - public static final int SEMICOLON=15; - public static final int SLASH=16; - public static final int SPACE=17; - public static final int UCLETTER=18; + 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 @@ -61,61 +68,15 @@ public class SGFLexer extends Lexer { } public String getGrammarFileName() { return "C:\\Users\\Woody\\Documents\\antlr\\SGF.g"; } - // $ANTLR start "T__19" - public final void mT__19() throws RecognitionException { - try { - int _type = T__19; - 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__19" - - // $ANTLR start "T__20" - public final void mT__20() throws RecognitionException { - try { - int _type = T__20; - 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__20" - // $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:6:7: ( 'BC' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:6:9: 'BC' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:4:7: ( 'AB' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:4:9: 'AB' { - match("BC"); + match("AB"); @@ -135,10 +96,10 @@ public class SGFLexer extends Lexer { try { int _type = T__22; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:7:7: ( 'BR' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:7:9: 'BR' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:5:7: ( 'AP' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:5:9: 'AP' { - match("BR"); + match("AP"); @@ -158,10 +119,10 @@ public class SGFLexer extends Lexer { try { int _type = T__23; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:8:7: ( 'CA' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:8:9: 'CA' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:6:7: ( 'AW' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:6:9: 'AW' { - match("CA"); + match("AW"); @@ -181,12 +142,10 @@ public class SGFLexer extends Lexer { try { int _type = T__24; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:9:7: ( 'CP' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:9:9: 'CP' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:7:7: ( 'B' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:7:9: 'B' { - match("CP"); - - + match('B'); } @@ -204,10 +163,10 @@ public class SGFLexer extends Lexer { try { int _type = T__25; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:10:7: ( 'EV' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:10:9: 'EV' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:8:7: ( 'BC' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:8:9: 'BC' { - match("EV"); + match("BC"); @@ -227,10 +186,10 @@ public class SGFLexer extends Lexer { try { int _type = T__26; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:11:7: ( 'FF' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:11:9: 'FF' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:9:7: ( 'BR' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:9:9: 'BR' { - match("FF"); + match("BR"); @@ -250,10 +209,10 @@ public class SGFLexer extends Lexer { try { int _type = T__27; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:12:7: ( 'GM' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:12:9: 'GM' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:10:7: ( 'CA' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:10:9: 'CA' { - match("GM"); + match("CA"); @@ -273,10 +232,10 @@ public class SGFLexer extends Lexer { try { int _type = T__28; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:13:7: ( 'KM' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:13:9: 'KM' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:11:7: ( 'CP' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:11:9: 'CP' { - match("KM"); + match("CP"); @@ -296,10 +255,10 @@ public class SGFLexer extends Lexer { try { int _type = T__29; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:14:7: ( 'PB' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:14:9: 'PB' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:12:7: ( 'DT' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:12:9: 'DT' { - match("PB"); + match("DT"); @@ -319,10 +278,10 @@ public class SGFLexer extends Lexer { try { int _type = T__30; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:15:7: ( 'PC' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:15:9: 'PC' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:13:7: ( 'EV' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:13:9: 'EV' { - match("PC"); + match("EV"); @@ -342,10 +301,10 @@ public class SGFLexer extends Lexer { try { int _type = T__31; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:16:7: ( 'PW' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:16:9: 'PW' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:14:7: ( 'FF' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:14:9: 'FF' { - match("PW"); + match("FF"); @@ -365,10 +324,10 @@ public class SGFLexer extends Lexer { try { int _type = T__32; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:17:7: ( 'RE' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:17:9: 'RE' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:15:7: ( 'GM' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:15:9: 'GM' { - match("RE"); + match("GM"); @@ -388,10 +347,10 @@ public class SGFLexer extends Lexer { try { int _type = T__33; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:18:7: ( 'RU' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:18:9: 'RU' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:16:7: ( 'KM' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:16:9: 'KM' { - match("RU"); + match("KM"); @@ -411,10 +370,10 @@ public class SGFLexer extends Lexer { try { int _type = T__34; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:19:7: ( 'SO' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:19:9: 'SO' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:17:7: ( 'PB' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:17:9: 'PB' { - match("SO"); + match("PB"); @@ -434,10 +393,10 @@ public class SGFLexer extends Lexer { try { int _type = T__35; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:20:7: ( 'SZ' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:20:9: 'SZ' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:18:7: ( 'PC' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:18:9: 'PC' { - match("SZ"); + match("PC"); @@ -457,10 +416,10 @@ public class SGFLexer extends Lexer { try { int _type = T__36; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:21:7: ( 'TM' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:21:9: 'TM' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:19:7: ( 'PW' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:19:9: 'PW' { - match("TM"); + match("PW"); @@ -480,12 +439,10 @@ public class SGFLexer extends Lexer { try { int _type = T__37; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:22:7: ( 'US' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:22:9: 'US' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:20:7: ( 'R' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:20:9: 'R' { - match("US"); - - + match('R'); } @@ -503,10 +460,10 @@ public class SGFLexer extends Lexer { try { int _type = T__38; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:23:7: ( 'WC' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:23:9: 'WC' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:21:7: ( 'RE' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:21:9: 'RE' { - match("WC"); + match("RE"); @@ -526,10 +483,10 @@ public class SGFLexer extends Lexer { try { int _type = T__39; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:24:7: ( 'WR' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:24:9: 'WR' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:22:7: ( 'RU' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:22:9: 'RU' { - match("WR"); + match("RU"); @@ -544,13 +501,172 @@ public class SGFLexer extends Lexer { } // $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:122:9: ( '(' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:122:11: '(' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:147:9: ( '(' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:147:11: '(' { match('('); @@ -570,8 +686,8 @@ public class SGFLexer extends Lexer { try { int _type = SEMICOLON; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:124:11: ( ';' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:124:14: ';' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:149:11: ( ';' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:149:14: ';' { match(';'); @@ -591,7 +707,7 @@ public class SGFLexer extends Lexer { try { int _type = UCLETTER; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:126:10: ( 'A' .. 'Z' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:151:10: ( 'A' .. 'Z' ) // C:\\Users\\Woody\\Documents\\antlr\\SGF.g: { if ( (input.LA(1) >= 'A' && input.LA(1) <= 'Z') ) { @@ -620,7 +736,7 @@ public class SGFLexer extends Lexer { try { int _type = LCLETTER; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:128:10: ( 'a' .. 'z' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:153:10: ( 'a' .. 'z' ) // C:\\Users\\Woody\\Documents\\antlr\\SGF.g: { if ( (input.LA(1) >= 'a' && input.LA(1) <= 'z') ) { @@ -649,7 +765,7 @@ public class SGFLexer extends Lexer { try { int _type = DIGIT; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:130:8: ( '0' .. '9' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:155:8: ( '0' .. '9' ) // C:\\Users\\Woody\\Documents\\antlr\\SGF.g: { if ( (input.LA(1) >= '0' && input.LA(1) <= '9') ) { @@ -678,8 +794,8 @@ public class SGFLexer extends Lexer { try { int _type = LBRACKET; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:133:2: ( '[' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:133:4: '[' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:158:2: ( '[' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:158:4: '[' { match('['); @@ -699,8 +815,8 @@ public class SGFLexer extends Lexer { try { int _type = RBRACKET; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:136:2: ( ']' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:136:4: ']' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:161:2: ( ']' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:161:4: ']' { match(']'); @@ -720,8 +836,8 @@ public class SGFLexer extends Lexer { try { int _type = RPAREN; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:138:9: ( ')' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:138:11: ')' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:163:9: ( ')' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:163:11: ')' { match(')'); @@ -741,8 +857,8 @@ public class SGFLexer extends Lexer { try { int _type = COLON; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:140:8: ( ':' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:140:10: ':' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:165:8: ( ':' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:165:10: ':' { match(':'); @@ -762,8 +878,8 @@ public class SGFLexer extends Lexer { try { int _type = MINUS; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:142:8: ( '-' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:142:10: '-' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:167:8: ( '-' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:167:10: '-' { match('-'); @@ -783,8 +899,8 @@ public class SGFLexer extends Lexer { try { int _type = SPACE; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:144:8: ( ' ' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:144:10: ' ' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:169:8: ( ' ' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:169:10: ' ' { match(' '); @@ -804,8 +920,8 @@ public class SGFLexer extends Lexer { try { int _type = PERIOD; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:146:9: ( '.' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:146:11: '.' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:171:9: ( '.' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:171:11: '.' { match('.'); @@ -825,8 +941,8 @@ public class SGFLexer extends Lexer { try { int _type = COMMA; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:148:8: ( ',' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:148:10: ',' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:173:8: ( ',' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:173:10: ',' { match(','); @@ -846,8 +962,8 @@ public class SGFLexer extends Lexer { try { int _type = PLUS; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:150:7: ( '+' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:150:9: '+' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:175:7: ( '+' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:175:9: '+' { match('+'); @@ -867,8 +983,8 @@ public class SGFLexer extends Lexer { try { int _type = SLASH; int _channel = DEFAULT_TOKEN_CHANNEL; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:152:8: ( '/' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:152:10: '/' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:177:8: ( '/' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:177:10: '/' { match('/'); @@ -883,9 +999,55 @@ public class SGFLexer extends Lexer { } // $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:179:5: ( '\\r' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:179: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:181:9: ( '\\n' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:181: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__19 | T__20 | 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 | LPAREN | SEMICOLON | UCLETTER | LCLETTER | DIGIT | LBRACKET | RBRACKET | RPAREN | COLON | MINUS | SPACE | PERIOD | COMMA | PLUS | SLASH ) - int alt1=36; + // 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': { @@ -900,8 +1062,13 @@ public class SGFLexer extends Lexer { alt1=2; } break; + case 'W': + { + alt1=3; + } + break; default: - alt1=24; + alt1=29; } } @@ -911,16 +1078,16 @@ public class SGFLexer extends Lexer { switch ( input.LA(2) ) { case 'C': { - alt1=3; + alt1=5; } break; case 'R': { - alt1=4; + alt1=6; } break; default: - alt1=24; + alt1=4; } } @@ -930,65 +1097,77 @@ public class SGFLexer extends Lexer { switch ( input.LA(2) ) { case 'A': { - alt1=5; + alt1=7; } break; case 'P': { - alt1=6; + alt1=8; } break; default: - alt1=24; + alt1=29; } } break; - case 'E': + case 'D': { int LA1_4 = input.LA(2); - if ( (LA1_4=='V') ) { - alt1=7; + if ( (LA1_4=='T') ) { + alt1=9; } else { - alt1=24; + 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_5 = input.LA(2); + int LA1_6 = input.LA(2); - if ( (LA1_5=='F') ) { - alt1=8; + if ( (LA1_6=='F') ) { + alt1=11; } else { - alt1=24; + alt1=29; } } break; case 'G': { - int LA1_6 = input.LA(2); + int LA1_7 = input.LA(2); - if ( (LA1_6=='M') ) { - alt1=9; + if ( (LA1_7=='M') ) { + alt1=12; } else { - alt1=24; + alt1=29; } } break; case 'K': { - int LA1_7 = input.LA(2); + int LA1_8 = input.LA(2); - if ( (LA1_7=='M') ) { - alt1=10; + if ( (LA1_8=='M') ) { + alt1=13; } else { - alt1=24; + alt1=29; } } break; @@ -997,21 +1176,21 @@ public class SGFLexer extends Lexer { switch ( input.LA(2) ) { case 'B': { - alt1=11; + alt1=14; } break; case 'C': { - alt1=12; + alt1=15; } break; case 'W': { - alt1=13; + alt1=16; } break; default: - alt1=24; + alt1=29; } } @@ -1021,16 +1200,16 @@ public class SGFLexer extends Lexer { switch ( input.LA(2) ) { case 'E': { - alt1=14; + alt1=18; } break; case 'U': { - alt1=15; + alt1=19; } break; default: - alt1=24; + alt1=17; } } @@ -1040,41 +1219,41 @@ public class SGFLexer extends Lexer { switch ( input.LA(2) ) { case 'O': { - alt1=16; + alt1=20; } break; case 'Z': { - alt1=17; + alt1=21; } break; default: - alt1=24; + alt1=29; } } break; case 'T': { - int LA1_11 = input.LA(2); + int LA1_12 = input.LA(2); - if ( (LA1_11=='M') ) { - alt1=18; + if ( (LA1_12=='M') ) { + alt1=22; } else { - alt1=24; + alt1=29; } } break; case 'U': { - int LA1_12 = input.LA(2); + int LA1_13 = input.LA(2); - if ( (LA1_12=='S') ) { - alt1=19; + if ( (LA1_13=='S') ) { + alt1=23; } else { - alt1=24; + alt1=29; } } break; @@ -1083,12 +1262,12 @@ public class SGFLexer extends Lexer { switch ( input.LA(2) ) { case 'C': { - alt1=20; + alt1=25; } break; case 'R': { - alt1=21; + alt1=26; } break; default: @@ -1099,15 +1278,14 @@ public class SGFLexer extends Lexer { break; case '(': { - alt1=22; + alt1=27; } break; case ';': { - alt1=23; + alt1=28; } break; - case 'D': case 'H': case 'I': case 'J': @@ -1121,7 +1299,7 @@ public class SGFLexer extends Lexer { case 'Y': case 'Z': { - alt1=24; + alt1=29; } break; case 'a': @@ -1151,7 +1329,7 @@ public class SGFLexer extends Lexer { case 'y': case 'z': { - alt1=25; + alt1=30; } break; case '0': @@ -1165,57 +1343,67 @@ public class SGFLexer extends Lexer { case '8': case '9': { - alt1=26; + alt1=31; } break; case '[': { - alt1=27; + alt1=32; } break; case ']': { - alt1=28; + alt1=33; } break; case ')': { - alt1=29; + alt1=34; } break; case ':': { - alt1=30; + alt1=35; } break; case '-': { - alt1=31; + alt1=36; } break; case ' ': { - alt1=32; + alt1=37; } break; case '.': { - alt1=33; + alt1=38; } break; case ',': { - alt1=34; + alt1=39; } break; case '+': { - alt1=35; + alt1=40; } break; case '/': { - alt1=36; + alt1=41; + } + break; + case '\r': + { + alt1=42; + } + break; + case '\n': + { + alt1=43; } break; default: @@ -1228,291 +1416,347 @@ public class SGFLexer extends Lexer { switch (alt1) { case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:10: T__19 - { - mT__19(); - - - } - break; - case 2 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:16: T__20 - { - mT__20(); - - - } - break; - case 3 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:22: T__21 + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:10: T__21 { mT__21(); } break; - case 4 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:28: T__22 + case 2 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:16: T__22 { mT__22(); } break; - case 5 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:34: T__23 + case 3 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:22: T__23 { mT__23(); } break; - case 6 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:40: T__24 + case 4 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:28: T__24 { mT__24(); } break; - case 7 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:46: T__25 + case 5 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:34: T__25 { mT__25(); } break; - case 8 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:52: T__26 + case 6 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:40: T__26 { mT__26(); } break; - case 9 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:58: T__27 + case 7 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:46: T__27 { mT__27(); } break; - case 10 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:64: T__28 + case 8 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:52: T__28 { mT__28(); } break; - case 11 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:70: T__29 + case 9 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:58: T__29 { mT__29(); } break; - case 12 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:76: T__30 + case 10 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:64: T__30 { mT__30(); } break; - case 13 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:82: T__31 + case 11 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:70: T__31 { mT__31(); } break; - case 14 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:88: T__32 + case 12 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:76: T__32 { mT__32(); } break; - case 15 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:94: T__33 + case 13 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:82: T__33 { mT__33(); } break; - case 16 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:100: T__34 + case 14 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:88: T__34 { mT__34(); } break; - case 17 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:106: T__35 + case 15 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:94: T__35 { mT__35(); } break; - case 18 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:112: T__36 + case 16 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:100: T__36 { mT__36(); } break; - case 19 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:118: T__37 + case 17 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:106: T__37 { mT__37(); } break; - case 20 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:124: T__38 + case 18 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:112: T__38 { mT__38(); } break; - case 21 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:130: T__39 + 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: LPAREN + // 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 23 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:143: SEMICOLON + case 28 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:173: SEMICOLON { mSEMICOLON(); } break; - case 24 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:153: UCLETTER + case 29 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:183: UCLETTER { mUCLETTER(); } break; - case 25 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:162: LCLETTER + case 30 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:192: LCLETTER { mLCLETTER(); } break; - case 26 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:171: DIGIT + case 31 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:201: DIGIT { mDIGIT(); } break; - case 27 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:177: LBRACKET + case 32 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:207: LBRACKET { mLBRACKET(); } break; - case 28 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:186: RBRACKET + case 33 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:216: RBRACKET { mRBRACKET(); } break; - case 29 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:195: RPAREN + case 34 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:225: RPAREN { mRPAREN(); } break; - case 30 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:202: COLON + case 35 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:232: COLON { mCOLON(); } break; - case 31 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:208: MINUS + case 36 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:238: MINUS { mMINUS(); } break; - case 32 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:214: SPACE + case 37 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:244: SPACE { mSPACE(); } break; - case 33 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:220: PERIOD + case 38 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:250: PERIOD { mPERIOD(); } break; - case 34 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:227: COMMA + case 39 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:257: COMMA { mCOMMA(); } break; - case 35 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:233: PLUS + case 40 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:263: PLUS { mPLUS(); } break; - case 36 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:1:238: SLASH + 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; diff --git a/src/net/woodyfolsom/msproj/sgf/SGFNode.java b/src/net/woodyfolsom/msproj/sgf/SGFNode.java new file mode 100644 index 0000000..76db7e6 --- /dev/null +++ b/src/net/woodyfolsom/msproj/sgf/SGFNode.java @@ -0,0 +1,16 @@ +package net.woodyfolsom.msproj.sgf; + +import java.util.ArrayList; +import java.util.List; + +public class SGFNode { + private List properties = new ArrayList(); + + public void addProperty(SGFProperty property) { + properties.add(property); + } + + public int getPropertyCount() { + return properties.size(); + } +} diff --git a/src/net/woodyfolsom/msproj/sgf/SGFNodeCollection.java b/src/net/woodyfolsom/msproj/sgf/SGFNodeCollection.java new file mode 100644 index 0000000..e36041c --- /dev/null +++ b/src/net/woodyfolsom/msproj/sgf/SGFNodeCollection.java @@ -0,0 +1,25 @@ +package net.woodyfolsom.msproj.sgf; + +import java.util.ArrayList; +import java.util.List; + +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(); + } + + @Override + public String toString() { + return "foo"; + } +} diff --git a/src/net/woodyfolsom/msproj/sgf/SGFParser.java b/src/net/woodyfolsom/msproj/sgf/SGFParser.java index ac637ac..68820f2 100644 --- a/src/net/woodyfolsom/msproj/sgf/SGFParser.java +++ b/src/net/woodyfolsom/msproj/sgf/SGFParser.java @@ -1,4 +1,4 @@ -// $ANTLR 3.4 C:\\Users\\Woody\\Documents\\antlr\\SGF.g 2012-09-22 17:28:19 +// $ANTLR 3.4 C:\\Users\\Woody\\Documents\\antlr\\SGF.g 2012-09-23 16:20:53 package net.woodyfolsom.msproj.sgf; import org.antlr.runtime.*; @@ -9,12 +9,10 @@ import java.util.ArrayList; @SuppressWarnings({"all", "warnings", "unchecked"}) public class SGFParser extends Parser { public static final String[] tokenNames = new String[] { - "", "", "", "", "COLON", "COMMA", "DIGIT", "LBRACKET", "LCLETTER", "LPAREN", "MINUS", "PERIOD", "PLUS", "RBRACKET", "RPAREN", "SEMICOLON", "SLASH", "SPACE", "UCLETTER", "'AB'", "'AP'", "'BC'", "'BR'", "'CA'", "'CP'", "'EV'", "'FF'", "'GM'", "'KM'", "'PB'", "'PC'", "'PW'", "'RE'", "'RU'", "'SO'", "'SZ'", "'TM'", "'US'", "'WC'", "'WR'" + "", "", "", "", "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__19=19; - public static final int T__20=20; public static final int T__21=21; public static final int T__22=22; public static final int T__23=23; @@ -34,21 +32,30 @@ public class SGFParser extends Parser { 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 DIGIT=6; - public static final int LBRACKET=7; - public static final int LCLETTER=8; - public static final int LPAREN=9; - public static final int MINUS=10; - public static final int PERIOD=11; - public static final int PLUS=12; - public static final int RBRACKET=13; - public static final int RPAREN=14; - public static final int SEMICOLON=15; - public static final int SLASH=16; - public static final int SPACE=17; - public static final int UCLETTER=18; + 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() { @@ -71,16 +78,16 @@ public class SGFParser extends Parser { // $ANTLR start "collection" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:7:1: collection returns [NodeCollection nodeCollection] : ( gameTree )+ ; - public final NodeCollection collection() throws RecognitionException { - NodeCollection nodeCollection = null; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:7:1: collection returns [SGFNodeCollection sgfNodeCollection] : ( gameTree )+ ; + public final SGFNodeCollection collection() throws RecognitionException { + SGFNodeCollection sgfNodeCollection = null; - GameTree gameTree1 =null; + SGFGameTree gameTree1 =null; - nodeCollection = new NodeCollection(); + sgfNodeCollection = new SGFNodeCollection(); try { // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:11:2: ( ( gameTree )+ ) @@ -108,7 +115,7 @@ public class SGFParser extends Parser { state._fsp--; - nodeCollection.add(gameTree1); + sgfNodeCollection.add(gameTree1); } break; @@ -134,23 +141,23 @@ public class SGFParser extends Parser { finally { // do for sure before leaving } - return nodeCollection; + return sgfNodeCollection; } // $ANTLR end "collection" // $ANTLR start "gameTree" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:14:1: gameTree returns [GameTree gameTree] : LPAREN sequence ( gameTree )* RPAREN ; - public final GameTree gameTree() throws RecognitionException { - GameTree gameTree = null; + // 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; + List sequence2 =null; - gameTree = new GameTree(); + sgfGameTree = new SGFGameTree(); try { // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:18:2: ( LPAREN sequence ( gameTree )* RPAREN ) @@ -164,9 +171,9 @@ public class SGFParser extends Parser { state._fsp--; - gameTree.setNodeSequence(sequence2); + sgfGameTree.setNodeSequence(sequence2); - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:18:73: ( gameTree )* + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:18:76: ( gameTree )* loop2: do { int alt2=2; @@ -179,7 +186,7 @@ public class SGFParser extends Parser { switch (alt2) { case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:18:74: gameTree + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:18:77: gameTree { pushFollow(FOLLOW_gameTree_in_gameTree67); gameTree(); @@ -187,7 +194,7 @@ public class SGFParser extends Parser { state._fsp--; - gameTree.addSubTree(gameTree); + sgfGameTree.addSubTree(sgfGameTree); } break; @@ -211,23 +218,23 @@ public class SGFParser extends Parser { finally { // do for sure before leaving } - return gameTree; + 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; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:21:1: sequence returns [List nodeSequence] : ( node )+ ; + public final List sequence() throws RecognitionException { + List nodeSequence = null; - Node node3 =null; + SGFNode node3 =null; - nodeSequence = new ArrayList(); + nodeSequence = new ArrayList(); try { // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:25:2: ( ( node )+ ) @@ -288,16 +295,16 @@ public class SGFParser extends Parser { // $ANTLR start "node" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:27:1: node returns [Node node] : SEMICOLON ( property )* ; - public final Node node() throws RecognitionException { - Node node = null; + // 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; - node = new Node(); + sgfNode = new SGFNode(); try { // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:31:2: ( SEMICOLON ( property )* ) @@ -311,7 +318,7 @@ public class SGFParser extends Parser { int alt4=2; int LA4_0 = input.LA(1); - if ( ((LA4_0 >= UCLETTER && LA4_0 <= 39)) ) { + if ( ((LA4_0 >= 21 && LA4_0 <= 36)||(LA4_0 >= 38 && LA4_0 <= 46)) ) { alt4=1; } @@ -326,7 +333,7 @@ public class SGFParser extends Parser { state._fsp--; - node.addProperty(property4); + sgfNode.addProperty(property4); } break; @@ -348,41 +355,1968 @@ public class SGFParser extends Parser { finally { // do for sure before leaving } - return node; + 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 ( coordValue )? RBRACKET )+ | strIdent LBRACKET RBRACKET | strIdent ( LBRACKET strValue RBRACKET )+ | result ( LBRACKET resValue RBRACKET )+ | komi ( LBRACKET realValue RBRACKET )+ | coordIdent ( LBRACKET coordValue RBRACKET )+ ); + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:33:1: property returns [SGFProperty sgfProperty] : ( ( numIdent ) ( ( LBRACKET numValue RBRACKET ) )+ | ( playerIdent ) ( LBRACKET ( 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; - SGFParser.playerIdent_return playerIdent5 =null; + SGFIdentifier numIdent5 =null; - SGFParser.coordValue_return coordValue6 =null; + SGFParser.numValue_return numValue6 =null; + + SGFIdentifier playerIdent7 =null; + + SGFIdentifier strIdent8 =null; + + SGFIdentifier strIdent9 =null; + + SGFParser.strValue_return strValue10 =null; + + SGFParser.resValue_return resValue11 =null; + + SGFParser.realValue_return realValue12 =null; + + SGFIdentifier coordIdent13 =null; + + SGFParser.coordValue_return coordValue14 =null; sgfProperty = new SGFProperty(); try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:37:2: ( numIdent ( LBRACKET numValue RBRACKET )+ | ( playerIdent ) ( LBRACKET ( coordValue )? RBRACKET )+ | strIdent LBRACKET RBRACKET | strIdent ( LBRACKET strValue RBRACKET )+ | result ( LBRACKET resValue RBRACKET )+ | komi ( LBRACKET realValue RBRACKET )+ | coordIdent ( LBRACKET coordValue RBRACKET )+ ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:37:2: ( ( numIdent ) ( ( LBRACKET numValue RBRACKET ) )+ | ( playerIdent ) ( LBRACKET ( coordValue )? RBRACKET )+ | ( strIdent ) ( ( LBRACKET RBRACKET ) ) | ( strIdent ) ( ( LBRACKET strValue RBRACKET ) )+ | ( result ) ( ( LBRACKET resValue RBRACKET ) )+ | ( komi ) ( ( LBRACKET realValue RBRACKET ) )+ | ( coordIdent ) ( ( LBRACKET coordValue RBRACKET ) )+ ) int alt12=7; - alt12 = dfa12.predict(input); + 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=3; + } + 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=2; + } + else if ( (true) ) { + alt12=4; + } + 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=4; + } + 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=4; + } + 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=4; + } + 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=3; + } + 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=2; + } + else if ( (true) ) { + alt12=4; + } + 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=4; + } + 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=4; + } + 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=4; + } + 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=3; + } + 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=2; + } + else if ( (true) ) { + alt12=4; + } + 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=4; + } + 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=4; + } + 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=4; + } + 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=3; + } + 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=2; + } + else if ( (true) ) { + alt12=4; + } + 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=4; + } + 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=4; + } + 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=4; + } + 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=3; + } + 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=2; + } + else if ( (true) ) { + alt12=4; + } + 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=4; + } + 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=4; + } + 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=4; + } + 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=3; + } + 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=2; + } + else if ( (true) ) { + alt12=4; + } + 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=4; + } + 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=4; + } + 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=4; + } + 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=3; + } + 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=2; + } + else if ( (true) ) { + alt12=4; + } + 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=4; + } + 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=4; + } + 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=4; + } + 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=3; + } + 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=2; + } + else if ( (true) ) { + alt12=4; + } + 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=4; + } + 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=4; + } + 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=4; + } + 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=3; + } + 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=2; + } + else if ( (true) ) { + alt12=4; + } + 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=4; + } + 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=4; + } + 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=4; + } + 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=3; + } + 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=2; + } + else if ( (true) ) { + alt12=4; + } + 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=4; + } + 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=4; + } + 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=4; + } + 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=5; + } + 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=3; + } + 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=2; + } + else if ( (true) ) { + alt12=4; + } + 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=4; + } + 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=4; + } + 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=4; + } + 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=3; + } + 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=2; + } + else if ( (true) ) { + alt12=4; + } + 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=4; + } + 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=4; + } + 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=4; + } + 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=3; + } + 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=2; + } + else if ( (true) ) { + alt12=4; + } + 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=4; + } + 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=4; + } + 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=4; + } + 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=3; + } + 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=2; + } + else if ( (true) ) { + alt12=4; + } + 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=4; + } + 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=4; + } + 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=4; + } + 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=3; + } + 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=2; + } + else if ( (true) ) { + alt12=4; + } + 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=4; + } + 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=4; + } + 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=4; + } + 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=3; + } + 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=2; + } + else if ( (true) ) { + alt12=4; + } + 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=4; + } + 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=4; + } + 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=4; + } + 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=3; + } + 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=2; + } + else if ( (true) ) { + alt12=4; + } + 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=4; + } + 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=4; + } + 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=4; + } + 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=3; + } + 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=2; + } + else if ( (true) ) { + alt12=4; + } + 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=4; + } + 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=4; + } + 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=4; + } + 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=6; + } + break; + case 21: + case 23: + { + alt12=7; + } + 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 ) ( ( LBRACKET numValue RBRACKET ) )+ { - pushFollow(FOLLOW_numIdent_in_property139); - numIdent(); + // 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--; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:37:13: ( LBRACKET numValue RBRACKET )+ + sgfProperty.setIdentifier(numIdent5); + + } + + + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:37:64: ( ( LBRACKET numValue RBRACKET ) )+ int cnt5=0; loop5: do { @@ -396,17 +2330,25 @@ public class SGFParser extends Parser { switch (alt5) { case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:37:14: LBRACKET numValue RBRACKET + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:37:65: ( LBRACKET numValue RBRACKET ) { - match(input,LBRACKET,FOLLOW_LBRACKET_in_property142); + // 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_property144); - numValue(); + pushFollow(FOLLOW_numValue_in_property148); + numValue6=numValue(); state._fsp--; - match(input,RBRACKET,FOLLOW_RBRACKET_in_property146); + match(input,RBRACKET,FOLLOW_RBRACKET_in_property150); + + } + + + sgfProperty.addValue((numValue6!=null?numValue6.sgfValue:null)); } break; @@ -424,23 +2366,23 @@ public class SGFParser extends Parser { } break; case 2 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:38:4: ( playerIdent ) ( LBRACKET ( coordValue )? RBRACKET )+ + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:40:4: ( playerIdent ) ( LBRACKET ( coordValue )? RBRACKET )+ { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:38:4: ( playerIdent ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:38:5: playerIdent + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:40:4: ( playerIdent ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:40:5: playerIdent { - pushFollow(FOLLOW_playerIdent_in_property154); - playerIdent5=playerIdent(); + pushFollow(FOLLOW_playerIdent_in_property164); + playerIdent7=playerIdent(); state._fsp--; - sgfProperty.setIdent(new PlayerIdent((playerIdent5!=null?input.toString(playerIdent5.start,playerIdent5.stop):null))); + sgfProperty.setIdentifier(playerIdent7); } - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:38:78: ( LBRACKET ( coordValue )? RBRACKET )+ + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:40:71: ( LBRACKET ( coordValue )? RBRACKET )+ int cnt7=0; loop7: do { @@ -454,11 +2396,11 @@ public class SGFParser extends Parser { switch (alt7) { case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:38:79: LBRACKET ( coordValue )? RBRACKET + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:40:72: LBRACKET ( coordValue )? RBRACKET { - match(input,LBRACKET,FOLLOW_LBRACKET_in_property159); + match(input,LBRACKET,FOLLOW_LBRACKET_in_property169); - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:38:88: ( coordValue )? + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:40:81: ( coordValue )? int alt6=2; int LA6_0 = input.LA(1); @@ -467,10 +2409,10 @@ public class SGFParser extends Parser { } switch (alt6) { case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:38:88: coordValue + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:40:81: coordValue { - pushFollow(FOLLOW_coordValue_in_property161); - coordValue6=coordValue(); + pushFollow(FOLLOW_coordValue_in_property171); + coordValue(); state._fsp--; @@ -481,9 +2423,7 @@ public class SGFParser extends Parser { } - match(input,RBRACKET,FOLLOW_RBRACKET_in_property164); - - sgfProperty.setValue(new CoordValue((coordValue6!=null?input.toString(coordValue6.start,coordValue6.stop):null))); + match(input,RBRACKET,FOLLOW_RBRACKET_in_property174); } break; @@ -501,30 +2441,60 @@ public class SGFParser extends Parser { } break; case 3 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:40:4: strIdent LBRACKET RBRACKET + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:43:4: ( strIdent ) ( ( LBRACKET RBRACKET ) ) { - pushFollow(FOLLOW_strIdent_in_property176); - strIdent(); + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:43:4: ( strIdent ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:43:5: strIdent + { + pushFollow(FOLLOW_strIdent_in_property186); + strIdent8=strIdent(); state._fsp--; - match(input,LBRACKET,FOLLOW_LBRACKET_in_property178); + sgfProperty.setIdentifier(strIdent8); + + } + + + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:43:64: ( ( LBRACKET RBRACKET ) ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:43:65: ( LBRACKET RBRACKET ) + { + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:43:65: ( LBRACKET RBRACKET ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:43:66: LBRACKET RBRACKET + { + match(input,LBRACKET,FOLLOW_LBRACKET_in_property192); + + match(input,RBRACKET,FOLLOW_RBRACKET_in_property194); + + } + + + sgfProperty.addValue(SGFValue.EMPTY); + + } - match(input,RBRACKET,FOLLOW_RBRACKET_in_property180); } break; case 4 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:41:4: strIdent ( LBRACKET strValue RBRACKET )+ + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:44:4: ( strIdent ) ( ( LBRACKET strValue RBRACKET ) )+ { - pushFollow(FOLLOW_strIdent_in_property185); - strIdent(); + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:44:4: ( strIdent ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:44:5: strIdent + { + pushFollow(FOLLOW_strIdent_in_property203); + strIdent9=strIdent(); state._fsp--; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:41:13: ( LBRACKET strValue RBRACKET )+ + sgfProperty.setIdentifier(strIdent9); + + } + + + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:44:64: ( ( LBRACKET strValue RBRACKET ) )+ int cnt8=0; loop8: do { @@ -538,17 +2508,25 @@ public class SGFParser extends Parser { switch (alt8) { case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:41:14: LBRACKET strValue RBRACKET + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:44:65: ( LBRACKET strValue RBRACKET ) { - match(input,LBRACKET,FOLLOW_LBRACKET_in_property188); + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:44:65: ( LBRACKET strValue RBRACKET ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:44:66: LBRACKET strValue RBRACKET + { + match(input,LBRACKET,FOLLOW_LBRACKET_in_property209); - pushFollow(FOLLOW_strValue_in_property190); - strValue(); + pushFollow(FOLLOW_strValue_in_property211); + strValue10=strValue(); state._fsp--; - match(input,RBRACKET,FOLLOW_RBRACKET_in_property192); + match(input,RBRACKET,FOLLOW_RBRACKET_in_property213); + + } + + + sgfProperty.addValue(new SGFValue((strValue10!=null?input.toString(strValue10.start,strValue10.stop):null))); } break; @@ -566,15 +2544,23 @@ public class SGFParser extends Parser { } break; case 5 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:42:4: result ( LBRACKET resValue RBRACKET )+ + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:46:4: ( result ) ( ( LBRACKET resValue RBRACKET ) )+ { - pushFollow(FOLLOW_result_in_property200); + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:46:4: ( result ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:46:5: result + { + pushFollow(FOLLOW_result_in_property225); result(); state._fsp--; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:42:11: ( LBRACKET resValue RBRACKET )+ + sgfProperty.setIdentifier(SGFIdentifier.RESULT); + + } + + + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:46:64: ( ( LBRACKET resValue RBRACKET ) )+ int cnt9=0; loop9: do { @@ -588,17 +2574,25 @@ public class SGFParser extends Parser { switch (alt9) { case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:42:12: LBRACKET resValue RBRACKET + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:46:65: ( LBRACKET resValue RBRACKET ) { - match(input,LBRACKET,FOLLOW_LBRACKET_in_property203); + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:46:65: ( LBRACKET resValue RBRACKET ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:46:66: LBRACKET resValue RBRACKET + { + match(input,LBRACKET,FOLLOW_LBRACKET_in_property231); - pushFollow(FOLLOW_resValue_in_property205); - resValue(); + pushFollow(FOLLOW_resValue_in_property233); + resValue11=resValue(); state._fsp--; - match(input,RBRACKET,FOLLOW_RBRACKET_in_property207); + match(input,RBRACKET,FOLLOW_RBRACKET_in_property235); + + } + + + sgfProperty.addValue(new SGFValue(new SGFResult((resValue11!=null?input.toString(resValue11.start,resValue11.stop):null)))); } break; @@ -616,15 +2610,23 @@ public class SGFParser extends Parser { } break; case 6 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:43:4: komi ( LBRACKET realValue RBRACKET )+ + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:47:4: ( komi ) ( ( LBRACKET realValue RBRACKET ) )+ { - pushFollow(FOLLOW_komi_in_property214); + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:47:4: ( komi ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:47:5: komi + { + pushFollow(FOLLOW_komi_in_property245); komi(); state._fsp--; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:43:9: ( LBRACKET realValue RBRACKET )+ + sgfProperty.setIdentifier(SGFIdentifier.KOMI); + + } + + + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:47:60: ( ( LBRACKET realValue RBRACKET ) )+ int cnt10=0; loop10: do { @@ -638,17 +2640,25 @@ public class SGFParser extends Parser { switch (alt10) { case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:43:10: LBRACKET realValue RBRACKET + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:47:61: ( LBRACKET realValue RBRACKET ) { - match(input,LBRACKET,FOLLOW_LBRACKET_in_property217); + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:47:61: ( LBRACKET realValue RBRACKET ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:47:62: LBRACKET realValue RBRACKET + { + match(input,LBRACKET,FOLLOW_LBRACKET_in_property251); - pushFollow(FOLLOW_realValue_in_property219); - realValue(); + pushFollow(FOLLOW_realValue_in_property253); + realValue12=realValue(); state._fsp--; - match(input,RBRACKET,FOLLOW_RBRACKET_in_property221); + match(input,RBRACKET,FOLLOW_RBRACKET_in_property255); + + } + + + sgfProperty.addValue(new SGFValue(Double.parseDouble((realValue12!=null?input.toString(realValue12.start,realValue12.stop):null)))); } break; @@ -666,15 +2676,23 @@ public class SGFParser extends Parser { } break; case 7 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:44:4: coordIdent ( LBRACKET coordValue RBRACKET )+ + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:48:4: ( coordIdent ) ( ( LBRACKET coordValue RBRACKET ) )+ { - pushFollow(FOLLOW_coordIdent_in_property228); - coordIdent(); + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:48:4: ( coordIdent ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:48:5: coordIdent + { + pushFollow(FOLLOW_coordIdent_in_property265); + coordIdent13=coordIdent(); state._fsp--; - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:44:14: ( LBRACKET coordValue RBRACKET )+ + sgfProperty.setIdentifier(coordIdent13); + + } + + + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:48:67: ( ( LBRACKET coordValue RBRACKET ) )+ int cnt11=0; loop11: do { @@ -688,17 +2706,25 @@ public class SGFParser extends Parser { switch (alt11) { case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:44:15: LBRACKET coordValue RBRACKET + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:48:68: ( LBRACKET coordValue RBRACKET ) { - match(input,LBRACKET,FOLLOW_LBRACKET_in_property230); + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:48:68: ( LBRACKET coordValue RBRACKET ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:48:69: LBRACKET coordValue RBRACKET + { + match(input,LBRACKET,FOLLOW_LBRACKET_in_property270); - pushFollow(FOLLOW_coordValue_in_property232); - coordValue(); + pushFollow(FOLLOW_coordValue_in_property272); + coordValue14=coordValue(); state._fsp--; - match(input,RBRACKET,FOLLOW_RBRACKET_in_property234); + match(input,RBRACKET,FOLLOW_RBRACKET_in_property274); + + } + + + sgfProperty.addValue(new SGFValue(new SGFCoord((coordValue14!=null?input.toString(coordValue14.start,coordValue14.stop):null)))); } break; @@ -731,30 +2757,980 @@ public class SGFParser extends Parser { // $ANTLR end "property" - public static class playerIdent_return extends ParserRuleReturnScope { + + // $ANTLR start "playerIdent" + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:52:1: playerIdent returns [SGFIdentifier sgfPlayer] : ({...}? strIdent |{...}? strIdent ); + public final SGFIdentifier playerIdent() throws RecognitionException { + SGFIdentifier sgfPlayer = null; + + + SGFIdentifier strIdent15 =null; + + SGFIdentifier strIdent16 =null; + + + try { + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:53: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:53:4: {...}? strIdent + { + if ( !(((input.LT(1).getText().equals("W")))) ) { + throw new FailedPredicateException(input, "playerIdent", "(input.LT(1).getText().equals(\"W\"))"); + } + + pushFollow(FOLLOW_strIdent_in_playerIdent297); + strIdent15=strIdent(); + + state._fsp--; + + + sgfPlayer = strIdent15; + + } + break; + case 2 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:54:4: {...}? strIdent + { + if ( !(((input.LT(1).getText().equals("B")))) ) { + throw new FailedPredicateException(input, "playerIdent", "(input.LT(1).getText().equals(\"B\"))"); + } + + pushFollow(FOLLOW_strIdent_in_playerIdent306); + strIdent16=strIdent(); + + state._fsp--; + + + sgfPlayer = strIdent16; + + } + 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:57:1: strIdent returns [SGFIdentifier sgfIdent] : ( charEnc | source | blackCountry | whiteCountry | event | playerBlack | playerWhite | blackRank | whiteRank | result | rules | place | application | copyright | username | date | 'B' | 'W' ); + public final SGFIdentifier strIdent() throws RecognitionException { + SGFIdentifier sgfIdent = null; + + + try { + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:58:2: ( charEnc | source | blackCountry | whiteCountry | event | playerBlack | playerWhite | blackRank | whiteRank | result | rules | place | application | copyright | username | date | 'B' | 'W' ) + 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:58:4: charEnc + { + pushFollow(FOLLOW_charEnc_in_strIdent323); + charEnc(); + + state._fsp--; + + + sgfIdent = SGFIdentifier.CHARSET; + + } + break; + case 2 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:59:10: source + { + pushFollow(FOLLOW_source_in_strIdent335); + source(); + + state._fsp--; + + + } + break; + case 3 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:60:10: blackCountry + { + pushFollow(FOLLOW_blackCountry_in_strIdent346); + blackCountry(); + + state._fsp--; + + + } + break; + case 4 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:61:10: whiteCountry + { + pushFollow(FOLLOW_whiteCountry_in_strIdent357); + whiteCountry(); + + state._fsp--; + + + } + break; + case 5 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:62:4: event + { + pushFollow(FOLLOW_event_in_strIdent362); + event(); + + state._fsp--; + + + } + break; + case 6 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:63:4: playerBlack + { + pushFollow(FOLLOW_playerBlack_in_strIdent367); + playerBlack(); + + state._fsp--; + + + } + break; + case 7 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:64:4: playerWhite + { + pushFollow(FOLLOW_playerWhite_in_strIdent372); + playerWhite(); + + state._fsp--; + + + } + break; + case 8 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:65:4: blackRank + { + pushFollow(FOLLOW_blackRank_in_strIdent377); + blackRank(); + + state._fsp--; + + + } + break; + case 9 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:66:4: whiteRank + { + pushFollow(FOLLOW_whiteRank_in_strIdent382); + whiteRank(); + + state._fsp--; + + + } + break; + case 10 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:67:4: result + { + pushFollow(FOLLOW_result_in_strIdent387); + result(); + + state._fsp--; + + + } + break; + case 11 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:68:4: rules + { + pushFollow(FOLLOW_rules_in_strIdent392); + rules(); + + state._fsp--; + + + } + break; + case 12 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:69:4: place + { + pushFollow(FOLLOW_place_in_strIdent397); + place(); + + state._fsp--; + + + } + break; + case 13 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:70:12: application + { + pushFollow(FOLLOW_application_in_strIdent410); + application(); + + state._fsp--; + + + } + break; + case 14 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:71:11: copyright + { + pushFollow(FOLLOW_copyright_in_strIdent422); + copyright(); + + state._fsp--; + + + } + break; + case 15 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:72:11: username + { + pushFollow(FOLLOW_username_in_strIdent434); + username(); + + state._fsp--; + + + } + break; + case 16 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:73:11: date + { + pushFollow(FOLLOW_date_in_strIdent446); + date(); + + state._fsp--; + + + } + break; + case 17 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:74:11: 'B' + { + match(input,24,FOLLOW_24_in_strIdent458); + + sgfIdent = SGFIdentifier.MOVE_BLACK; + + } + break; + case 18 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:75:11: 'W' + { + match(input,44,FOLLOW_44_in_strIdent471); + + 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:80:1: coordIdent returns [SGFIdentifier sgfIdent] : ( addBlack | addWhite ); + public final SGFIdentifier coordIdent() throws RecognitionException { + SGFIdentifier sgfIdent = null; + + + SGFIdentifier addBlack17 =null; + + SGFIdentifier addWhite18 =null; + + + try { + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:81: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:81:4: addBlack + { + pushFollow(FOLLOW_addBlack_in_coordIdent517); + addBlack17=addBlack(); + + state._fsp--; + + + sgfIdent = addBlack17; + + } + break; + case 2 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:82:5: addWhite + { + pushFollow(FOLLOW_addWhite_in_coordIdent525); + addWhite18=addWhite(); + + state._fsp--; + + + sgfIdent = addWhite18; + + } + 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:85:1: numIdent returns [SGFIdentifier sgfIdent] : ( fileFormat | game | size | time ); + public final SGFIdentifier numIdent() throws RecognitionException { + SGFIdentifier sgfIdent = null; + + + try { + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:86:2: ( fileFormat | game | size | time ) + 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:86:4: fileFormat + { + pushFollow(FOLLOW_fileFormat_in_numIdent542); + fileFormat(); + + state._fsp--; + + + sgfIdent = SGFIdentifier.FILE_FORMAT; + + } + break; + case 2 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:87:4: game + { + pushFollow(FOLLOW_game_in_numIdent548); + game(); + + state._fsp--; + + + sgfIdent = SGFIdentifier.GAME; + + } + break; + case 3 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:88:4: size + { + pushFollow(FOLLOW_size_in_numIdent554); + size(); + + state._fsp--; + + + sgfIdent = SGFIdentifier.SIZE; + + } + break; + case 4 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:89:4: time + { + pushFollow(FOLLOW_time_in_numIdent560); + 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 "playerIdent" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:46:1: playerIdent :{...}? strIdent ; - public final SGFParser.playerIdent_return playerIdent() throws RecognitionException { - SGFParser.playerIdent_return retval = new SGFParser.playerIdent_return(); + // $ANTLR start "numValue" + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:91: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:46:14: ({...}? strIdent ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:46:16: {...}? strIdent + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:92:2: ( ( ( DIGIT )+ ) ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:92:4: ( ( DIGIT )+ ) { - if ( !(((input.LT(1).getText().equals("W") || input.LT(1).getText().equals("B")))) ) { - throw new FailedPredicateException(input, "playerIdent", "(input.LT(1).getText().equals(\"W\") || input.LT(1).getText().equals(\"B\"))"); + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:92:4: ( ( DIGIT )+ ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:92:5: ( DIGIT )+ + { + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:92: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:92:5: DIGIT + { + match(input,DIGIT,FOLLOW_DIGIT_in_numValue575); + + } + break; + + default : + if ( cnt17 >= 1 ) break loop17; + EarlyExitException eee = + new EarlyExitException(17, input); + throw eee; + } + cnt17++; + } while (true); + + } - pushFollow(FOLLOW_strIdent_in_playerIdent247); - strIdent(); - - state._fsp--; + retval.sgfValue = new SGFValue(Integer.parseInt(input.toString(retval.start,input.LT(-1)))); } @@ -772,514 +3748,18 @@ public class SGFParser extends Parser { } return retval; } - // $ANTLR end "playerIdent" - - - - // $ANTLR start "strIdent" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:48:1: strIdent : ( charEnc | source | blackCountry | whiteCountry | event | playerBlack | playerWhite | blackRank | whiteRank | result | rules | place | application | copyright | username | ( UCLETTER )+ ); - public final void strIdent() throws RecognitionException { - try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:49:2: ( charEnc | source | blackCountry | whiteCountry | event | playerBlack | playerWhite | blackRank | whiteRank | result | rules | place | application | copyright | username | ( UCLETTER )+ ) - int alt14=16; - switch ( input.LA(1) ) { - case 23: - { - alt14=1; - } - break; - case 34: - { - alt14=2; - } - break; - case 21: - { - alt14=3; - } - break; - case 38: - { - alt14=4; - } - break; - case 25: - { - alt14=5; - } - break; - case 29: - { - alt14=6; - } - break; - case 31: - { - alt14=7; - } - break; - case 22: - { - alt14=8; - } - break; - case 39: - { - alt14=9; - } - break; - case 32: - { - alt14=10; - } - break; - case 33: - { - alt14=11; - } - break; - case 30: - { - alt14=12; - } - break; - case 20: - { - alt14=13; - } - break; - case 24: - { - alt14=14; - } - break; - case 37: - { - alt14=15; - } - break; - case UCLETTER: - { - alt14=16; - } - break; - default: - NoViableAltException nvae = - new NoViableAltException("", 14, 0, input); - - throw nvae; - - } - - switch (alt14) { - case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:49:4: charEnc - { - pushFollow(FOLLOW_charEnc_in_strIdent257); - charEnc(); - - state._fsp--; - - - } - break; - case 2 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:50:10: source - { - pushFollow(FOLLOW_source_in_strIdent268); - source(); - - state._fsp--; - - - } - break; - case 3 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:51:10: blackCountry - { - pushFollow(FOLLOW_blackCountry_in_strIdent279); - blackCountry(); - - state._fsp--; - - - } - break; - case 4 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:52:10: whiteCountry - { - pushFollow(FOLLOW_whiteCountry_in_strIdent290); - whiteCountry(); - - state._fsp--; - - - } - break; - case 5 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:53:4: event - { - pushFollow(FOLLOW_event_in_strIdent295); - event(); - - state._fsp--; - - - } - break; - case 6 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:54:4: playerBlack - { - pushFollow(FOLLOW_playerBlack_in_strIdent300); - playerBlack(); - - state._fsp--; - - - } - break; - case 7 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:55:4: playerWhite - { - pushFollow(FOLLOW_playerWhite_in_strIdent305); - playerWhite(); - - state._fsp--; - - - } - break; - case 8 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:56:4: blackRank - { - pushFollow(FOLLOW_blackRank_in_strIdent310); - blackRank(); - - state._fsp--; - - - } - break; - case 9 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:57:4: whiteRank - { - pushFollow(FOLLOW_whiteRank_in_strIdent315); - whiteRank(); - - state._fsp--; - - - } - break; - case 10 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:58:4: result - { - pushFollow(FOLLOW_result_in_strIdent320); - result(); - - state._fsp--; - - - } - break; - case 11 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:59:4: rules - { - pushFollow(FOLLOW_rules_in_strIdent325); - rules(); - - state._fsp--; - - - } - break; - case 12 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:60:4: place - { - pushFollow(FOLLOW_place_in_strIdent330); - place(); - - state._fsp--; - - - } - break; - case 13 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:61:12: application - { - pushFollow(FOLLOW_application_in_strIdent343); - application(); - - state._fsp--; - - - } - break; - case 14 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:62:11: copyright - { - pushFollow(FOLLOW_copyright_in_strIdent355); - copyright(); - - state._fsp--; - - - } - break; - case 15 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:63:11: username - { - pushFollow(FOLLOW_username_in_strIdent367); - username(); - - state._fsp--; - - - } - break; - case 16 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:64:11: ( UCLETTER )+ - { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:64:11: ( UCLETTER )+ - int cnt13=0; - loop13: - do { - int alt13=2; - int LA13_0 = input.LA(1); - - if ( (LA13_0==UCLETTER) ) { - alt13=1; - } - - - switch (alt13) { - case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:64:11: UCLETTER - { - match(input,UCLETTER,FOLLOW_UCLETTER_in_strIdent379); - - } - break; - - default : - if ( cnt13 >= 1 ) break loop13; - EarlyExitException eee = - new EarlyExitException(13, input); - throw eee; - } - cnt13++; - } while (true); - - - } - break; - - } - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return ; - } - // $ANTLR end "strIdent" - - - - // $ANTLR start "coordIdent" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:66:1: coordIdent : addBlack ; - public final void coordIdent() throws RecognitionException { - try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:67:2: ( addBlack ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:67:4: addBlack - { - pushFollow(FOLLOW_addBlack_in_coordIdent389); - addBlack(); - - state._fsp--; - - - } - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return ; - } - // $ANTLR end "coordIdent" - - - - // $ANTLR start "numIdent" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:69:1: numIdent : ( fileFormat | game | size | time ); - public final void numIdent() throws RecognitionException { - try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:70:2: ( fileFormat | game | size | time ) - int alt15=4; - switch ( input.LA(1) ) { - case 26: - { - alt15=1; - } - break; - case 27: - { - alt15=2; - } - break; - case 35: - { - alt15=3; - } - break; - case 36: - { - alt15=4; - } - break; - default: - NoViableAltException nvae = - new NoViableAltException("", 15, 0, input); - - throw nvae; - - } - - switch (alt15) { - case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:70:4: fileFormat - { - pushFollow(FOLLOW_fileFormat_in_numIdent400); - fileFormat(); - - state._fsp--; - - - } - break; - case 2 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:71:4: game - { - pushFollow(FOLLOW_game_in_numIdent405); - game(); - - state._fsp--; - - - } - break; - case 3 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:72:4: size - { - pushFollow(FOLLOW_size_in_numIdent410); - size(); - - state._fsp--; - - - } - break; - case 4 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:73:4: time - { - pushFollow(FOLLOW_time_in_numIdent415); - time(); - - state._fsp--; - - - } - break; - - } - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return ; - } - // $ANTLR end "numIdent" - - - - // $ANTLR start "numValue" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:75:1: numValue : ( DIGIT )+ ; - public final void numValue() throws RecognitionException { - try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:76:2: ( ( DIGIT )+ ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:76:4: ( DIGIT )+ - { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:76:4: ( DIGIT )+ - int cnt16=0; - loop16: - do { - int alt16=2; - int LA16_0 = input.LA(1); - - if ( (LA16_0==DIGIT) ) { - alt16=1; - } - - - switch (alt16) { - case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:76:4: DIGIT - { - match(input,DIGIT,FOLLOW_DIGIT_in_numValue424); - - } - break; - - default : - if ( cnt16 >= 1 ) break loop16; - EarlyExitException eee = - new EarlyExitException(16, input); - throw eee; - } - cnt16++; - } while (true); - - - } - - } - catch (RecognitionException re) { - reportError(re); - recover(input,re); - } - - finally { - // do for sure before leaving - } - return ; - } // $ANTLR end "numValue" // $ANTLR start "realIdent" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:78:1: realIdent : komi ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:94:1: realIdent : komi ; public final void realIdent() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:79:2: ( komi ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:79:4: komi + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:95:2: ( komi ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:95:4: komi { - pushFollow(FOLLOW_komi_in_realIdent435); + pushFollow(FOLLOW_komi_in_realIdent588); komi(); state._fsp--; @@ -1301,30 +3781,74 @@ public class SGFParser extends Parser { // $ANTLR end "realIdent" + public static class resValue_return extends ParserRuleReturnScope { + }; + // $ANTLR start "resValue" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:81:1: resValue : playerIdent PLUS realValue ; - public final void resValue() throws RecognitionException { + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:97: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:82:2: ( playerIdent PLUS realValue ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:82:4: playerIdent PLUS realValue + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:98:2: ( playerIdent PLUS ( 'R' | realValue ) ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:98:4: playerIdent PLUS ( 'R' | realValue ) { - pushFollow(FOLLOW_playerIdent_in_resValue445); + pushFollow(FOLLOW_playerIdent_in_resValue598); playerIdent(); state._fsp--; - match(input,PLUS,FOLLOW_PLUS_in_resValue447); + match(input,PLUS,FOLLOW_PLUS_in_resValue600); - pushFollow(FOLLOW_realValue_in_resValue449); - realValue(); + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:98:21: ( 'R' | realValue ) + int alt18=2; + int LA18_0 = input.LA(1); - state._fsp--; + 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:98:22: 'R' + { + match(input,37,FOLLOW_37_in_resValue603); + + } + break; + case 2 : + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:98:28: realValue + { + pushFollow(FOLLOW_realValue_in_resValue607); + realValue(); + + state._fsp--; + + + } + break; + + } } + retval.stop = input.LT(-1); + + } catch (RecognitionException re) { reportError(re); @@ -1334,85 +3858,95 @@ public class SGFParser extends Parser { finally { // do for sure before leaving } - return ; + return retval; } // $ANTLR end "resValue" + public static class realValue_return extends ParserRuleReturnScope { + }; + // $ANTLR start "realValue" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:84:1: realValue : ( DIGIT )+ PERIOD ( DIGIT )+ ; - public final void realValue() throws RecognitionException { - try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:85:2: ( ( DIGIT )+ PERIOD ( DIGIT )+ ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:85:4: ( DIGIT )+ PERIOD ( DIGIT )+ - { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:85:4: ( DIGIT )+ - int cnt17=0; - loop17: - do { - int alt17=2; - int LA17_0 = input.LA(1); + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:100: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); - if ( (LA17_0==DIGIT) ) { - alt17=1; + + try { + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:101:2: ( ( DIGIT )+ PERIOD ( DIGIT )+ ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:101:4: ( DIGIT )+ PERIOD ( DIGIT )+ + { + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:101:4: ( DIGIT )+ + int cnt19=0; + loop19: + do { + int alt19=2; + int LA19_0 = input.LA(1); + + if ( (LA19_0==DIGIT) ) { + alt19=1; } - switch (alt17) { + switch (alt19) { case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:85:4: DIGIT + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:101:4: DIGIT { - match(input,DIGIT,FOLLOW_DIGIT_in_realValue459); + match(input,DIGIT,FOLLOW_DIGIT_in_realValue618); } break; default : - if ( cnt17 >= 1 ) break loop17; + if ( cnt19 >= 1 ) break loop19; EarlyExitException eee = - new EarlyExitException(17, input); + new EarlyExitException(19, input); throw eee; } - cnt17++; + cnt19++; } while (true); - match(input,PERIOD,FOLLOW_PERIOD_in_realValue462); + match(input,PERIOD,FOLLOW_PERIOD_in_realValue621); - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:85:18: ( DIGIT )+ - int cnt18=0; - loop18: + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:101:18: ( DIGIT )+ + int cnt20=0; + loop20: do { - int alt18=2; - int LA18_0 = input.LA(1); + int alt20=2; + int LA20_0 = input.LA(1); - if ( (LA18_0==DIGIT) ) { - alt18=1; + if ( (LA20_0==DIGIT) ) { + alt20=1; } - switch (alt18) { + switch (alt20) { case 1 : - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:85:18: DIGIT + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:101:18: DIGIT { - match(input,DIGIT,FOLLOW_DIGIT_in_realValue464); + match(input,DIGIT,FOLLOW_DIGIT_in_realValue623); } break; default : - if ( cnt18 >= 1 ) break loop18; + if ( cnt20 >= 1 ) break loop20; EarlyExitException eee = - new EarlyExitException(18, input); + new EarlyExitException(20, input); throw eee; } - cnt18++; + cnt20++; } while (true); } + retval.stop = input.LT(-1); + + } catch (RecognitionException re) { reportError(re); @@ -1422,7 +3956,7 @@ public class SGFParser extends Parser { finally { // do for sure before leaving } - return ; + return retval; } // $ANTLR end "realValue" @@ -1432,19 +3966,19 @@ public class SGFParser extends Parser { // $ANTLR start "coordValue" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:87:1: coordValue : LCLETTER LCLETTER ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:103:1: coordValue : 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:87:13: ( LCLETTER LCLETTER ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:87:15: LCLETTER LCLETTER + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:103:13: ( LCLETTER LCLETTER ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:103:15: LCLETTER LCLETTER { - match(input,LCLETTER,FOLLOW_LCLETTER_in_coordValue474); + match(input,LCLETTER,FOLLOW_LCLETTER_in_coordValue633); - match(input,LCLETTER,FOLLOW_LCLETTER_in_coordValue476); + match(input,LCLETTER,FOLLOW_LCLETTER_in_coordValue635); } @@ -1467,13 +4001,13 @@ public class SGFParser extends Parser { // $ANTLR start "fileFormat" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:89:1: fileFormat : 'FF' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:105:1: fileFormat : 'FF' ; public final void fileFormat() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:90:2: ( 'FF' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:90:4: 'FF' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:106:2: ( 'FF' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:106:4: 'FF' { - match(input,26,FOLLOW_26_in_fileFormat486); + match(input,31,FOLLOW_31_in_fileFormat645); } @@ -1493,13 +4027,13 @@ public class SGFParser extends Parser { // $ANTLR start "game" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:91:1: game : 'GM' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:107:1: game : 'GM' ; public final void game() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:91:7: ( 'GM' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:91:9: 'GM' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:107:7: ( 'GM' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:107:9: 'GM' { - match(input,27,FOLLOW_27_in_game494); + match(input,32,FOLLOW_32_in_game653); } @@ -1519,13 +4053,13 @@ public class SGFParser extends Parser { // $ANTLR start "size" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:92:1: size : 'SZ' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:108:1: size : 'SZ' ; public final void size() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:92:7: ( 'SZ' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:92:9: 'SZ' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:108:7: ( 'SZ' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:108:9: 'SZ' { - match(input,35,FOLLOW_35_in_size502); + match(input,41,FOLLOW_41_in_size661); } @@ -1545,13 +4079,13 @@ public class SGFParser extends Parser { // $ANTLR start "charEnc" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:93:1: charEnc : 'CA' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:109:1: charEnc : 'CA' ; public final void charEnc() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:93:9: ( 'CA' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:93:11: 'CA' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:109:9: ( 'CA' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:109:11: 'CA' { - match(input,23,FOLLOW_23_in_charEnc509); + match(input,27,FOLLOW_27_in_charEnc668); } @@ -1571,13 +4105,13 @@ public class SGFParser extends Parser { // $ANTLR start "source" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:94:1: source : 'SO' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:110:1: source : 'SO' ; public final void source() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:94:8: ( 'SO' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:94:10: 'SO' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:110:8: ( 'SO' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:110:10: 'SO' { - match(input,34,FOLLOW_34_in_source516); + match(input,40,FOLLOW_40_in_source675); } @@ -1597,13 +4131,13 @@ public class SGFParser extends Parser { // $ANTLR start "blackCountry" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:95:1: blackCountry : 'BC' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:111:1: blackCountry : 'BC' ; public final void blackCountry() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:96:2: ( 'BC' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:96:4: 'BC' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:112:2: ( 'BC' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:112:4: 'BC' { - match(input,21,FOLLOW_21_in_blackCountry525); + match(input,25,FOLLOW_25_in_blackCountry684); } @@ -1623,13 +4157,13 @@ public class SGFParser extends Parser { // $ANTLR start "whiteCountry" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:97:1: whiteCountry : 'WC' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:113:1: whiteCountry : 'WC' ; public final void whiteCountry() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:98:2: ( 'WC' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:98:4: 'WC' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:114:2: ( 'WC' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:114:4: 'WC' { - match(input,38,FOLLOW_38_in_whiteCountry534); + match(input,45,FOLLOW_45_in_whiteCountry693); } @@ -1649,13 +4183,13 @@ public class SGFParser extends Parser { // $ANTLR start "event" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:99:1: event : 'EV' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:115:1: event : 'EV' ; public final void event() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:99:7: ( 'EV' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:99:9: 'EV' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:115:7: ( 'EV' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:115:9: 'EV' { - match(input,25,FOLLOW_25_in_event541); + match(input,30,FOLLOW_30_in_event700); } @@ -1675,13 +4209,13 @@ public class SGFParser extends Parser { // $ANTLR start "playerBlack" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:100:1: playerBlack : 'PB' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:116:1: playerBlack : 'PB' ; public final void playerBlack() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:101:2: ( 'PB' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:101:4: 'PB' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:117:2: ( 'PB' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:117:4: 'PB' { - match(input,29,FOLLOW_29_in_playerBlack549); + match(input,34,FOLLOW_34_in_playerBlack708); } @@ -1701,13 +4235,13 @@ public class SGFParser extends Parser { // $ANTLR start "playerWhite" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:102:1: playerWhite : 'PW' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:118:1: playerWhite : 'PW' ; public final void playerWhite() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:103:2: ( 'PW' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:103:4: 'PW' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:119:2: ( 'PW' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:119:4: 'PW' { - match(input,31,FOLLOW_31_in_playerWhite557); + match(input,36,FOLLOW_36_in_playerWhite716); } @@ -1727,13 +4261,13 @@ public class SGFParser extends Parser { // $ANTLR start "blackRank" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:104:1: blackRank : 'BR' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:120:1: blackRank : 'BR' ; public final void blackRank() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:105:2: ( 'BR' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:105:4: 'BR' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:121:2: ( 'BR' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:121:4: 'BR' { - match(input,22,FOLLOW_22_in_blackRank565); + match(input,26,FOLLOW_26_in_blackRank724); } @@ -1753,13 +4287,13 @@ public class SGFParser extends Parser { // $ANTLR start "whiteRank" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:106:1: whiteRank : 'WR' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:122:1: whiteRank : 'WR' ; public final void whiteRank() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:107:2: ( 'WR' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:107:5: 'WR' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:123:2: ( 'WR' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:123:5: 'WR' { - match(input,39,FOLLOW_39_in_whiteRank575); + match(input,46,FOLLOW_46_in_whiteRank734); } @@ -1779,13 +4313,13 @@ public class SGFParser extends Parser { // $ANTLR start "komi" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:108:1: komi : 'KM' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:124:1: komi : 'KM' ; public final void komi() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:108:7: ( 'KM' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:108:9: 'KM' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:124:7: ( 'KM' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:124:9: 'KM' { - match(input,28,FOLLOW_28_in_komi583); + match(input,33,FOLLOW_33_in_komi742); } @@ -1805,13 +4339,13 @@ public class SGFParser extends Parser { // $ANTLR start "result" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:109:1: result : 'RE' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:125:1: result : 'RE' ; public final void result() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:109:9: ( 'RE' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:109:11: 'RE' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:125:9: ( 'RE' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:125:11: 'RE' { - match(input,32,FOLLOW_32_in_result591); + match(input,38,FOLLOW_38_in_result750); } @@ -1831,13 +4365,13 @@ public class SGFParser extends Parser { // $ANTLR start "rules" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:110:1: rules : 'RU' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:126:1: rules : 'RU' ; public final void rules() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:110:7: ( 'RU' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:110:9: 'RU' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:126:7: ( 'RU' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:126:9: 'RU' { - match(input,33,FOLLOW_33_in_rules598); + match(input,39,FOLLOW_39_in_rules757); } @@ -1857,13 +4391,13 @@ public class SGFParser extends Parser { // $ANTLR start "place" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:111:1: place : 'PC' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:127:1: place : 'PC' ; public final void place() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:111:8: ( 'PC' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:111:11: 'PC' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:127:8: ( 'PC' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:127:11: 'PC' { - match(input,30,FOLLOW_30_in_place607); + match(input,35,FOLLOW_35_in_place766); } @@ -1883,13 +4417,13 @@ public class SGFParser extends Parser { // $ANTLR start "application" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:112:1: application : 'AP' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:128:1: application : 'AP' ; public final void application() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:113:2: ( 'AP' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:113:4: 'AP' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:129:2: ( 'AP' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:129:4: 'AP' { - match(input,20,FOLLOW_20_in_application615); + match(input,22,FOLLOW_22_in_application774); } @@ -1909,13 +4443,13 @@ public class SGFParser extends Parser { // $ANTLR start "time" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:114:1: time : 'TM' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:130:1: time : 'TM' ; public final void time() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:114:6: ( 'TM' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:114:8: 'TM' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:130:6: ( 'TM' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:130:8: 'TM' { - match(input,36,FOLLOW_36_in_time622); + match(input,42,FOLLOW_42_in_time781); } @@ -1934,14 +4468,14 @@ public class SGFParser extends Parser { - // $ANTLR start "addBlack" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:115:1: addBlack : 'AB' ; - public final void addBlack() throws RecognitionException { + // $ANTLR start "date" + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:131:1: date : 'DT' ; + public final void date() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:115:9: ( 'AB' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:115:11: 'AB' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:131:7: ( 'DT' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:131:9: 'DT' { - match(input,19,FOLLOW_19_in_addBlack628); + match(input,29,FOLLOW_29_in_date789); } @@ -1956,18 +4490,80 @@ public class SGFParser extends Parser { } return ; } + // $ANTLR end "date" + + + + // $ANTLR start "addBlack" + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:133:1: addBlack returns [SGFIdentifier sgfIdent] : 'AB' ; + public final SGFIdentifier addBlack() throws RecognitionException { + SGFIdentifier sgfIdent = null; + + + try { + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:134:2: ( 'AB' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:134:4: 'AB' + { + match(input,21,FOLLOW_21_in_addBlack802); + + 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:137:1: addWhite returns [SGFIdentifier sgfIdent] : 'AW' ; + public final SGFIdentifier addWhite() throws RecognitionException { + SGFIdentifier sgfIdent = null; + + + try { + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:138:2: ( 'AW' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:138:4: 'AW' + { + match(input,23,FOLLOW_23_in_addWhite819); + + 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:116:1: copyright : 'CP' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:141:1: copyright : 'CP' ; public final void copyright() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:117:2: ( 'CP' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:117:4: 'CP' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:142:2: ( 'CP' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:142:4: 'CP' { - match(input,24,FOLLOW_24_in_copyright636); + match(input,28,FOLLOW_28_in_copyright831); } @@ -1987,13 +4583,13 @@ public class SGFParser extends Parser { // $ANTLR start "username" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:118:1: username : 'US' ; + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:143:1: username : 'US' ; public final void username() throws RecognitionException { try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:118:9: ( 'US' ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:118:11: 'US' + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:143:9: ( 'US' ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:143:11: 'US' { - match(input,37,FOLLOW_37_in_username642); + match(input,43,FOLLOW_43_in_username837); } @@ -2011,31 +4607,38 @@ public class SGFParser extends Parser { // $ANTLR end "username" + public static class strValue_return extends ParserRuleReturnScope { + }; + // $ANTLR start "strValue" - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:120:1: strValue : ( UCLETTER | LCLETTER | MINUS | DIGIT | SPACE | PERIOD | COMMA | PLUS | SLASH | COLON )+ ; - public final void strValue() throws RecognitionException { - try { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:120:10: ( ( UCLETTER | LCLETTER | MINUS | DIGIT | SPACE | PERIOD | COMMA | PLUS | SLASH | COLON )+ ) - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:120:12: ( UCLETTER | LCLETTER | MINUS | DIGIT | SPACE | PERIOD | COMMA | PLUS | SLASH | COLON )+ - { - // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:120:12: ( UCLETTER | LCLETTER | MINUS | DIGIT | SPACE | PERIOD | COMMA | PLUS | SLASH | COLON )+ - int cnt19=0; - loop19: - do { - int alt19=2; - int LA19_0 = input.LA(1); + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:145: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); - if ( ((LA19_0 >= COLON && LA19_0 <= DIGIT)||LA19_0==LCLETTER||(LA19_0 >= MINUS && LA19_0 <= PLUS)||(LA19_0 >= SLASH && LA19_0 <= UCLETTER)) ) { - alt19=1; + + try { + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:145:10: ( ( UCLETTER | LCLETTER | MINUS | DIGIT | SPACE | PERIOD | COMMA | PLUS | SLASH | COLON )+ ) + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:145:12: ( UCLETTER | LCLETTER | MINUS | DIGIT | SPACE | PERIOD | COMMA | PLUS | SLASH | COLON )+ + { + // C:\\Users\\Woody\\Documents\\antlr\\SGF.g:145: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 (alt19) { + switch (alt21) { case 1 : // C:\\Users\\Woody\\Documents\\antlr\\SGF.g: { - if ( (input.LA(1) >= COLON && input.LA(1) <= DIGIT)||input.LA(1)==LCLETTER||(input.LA(1) >= MINUS && input.LA(1) <= PLUS)||(input.LA(1) >= SLASH && input.LA(1) <= UCLETTER) ) { + 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; } @@ -2049,17 +4652,20 @@ public class SGFParser extends Parser { break; default : - if ( cnt19 >= 1 ) break loop19; + if ( cnt21 >= 1 ) break loop21; EarlyExitException eee = - new EarlyExitException(19, input); + new EarlyExitException(21, input); throw eee; } - cnt19++; + cnt21++; } while (true); } + retval.stop = input.LT(-1); + + } catch (RecognitionException re) { reportError(re); @@ -2069,257 +4675,109 @@ public class SGFParser extends Parser { finally { // do for sure before leaving } - return ; + return retval; } // $ANTLR end "strValue" // Delegated rules - protected DFA12 dfa12 = new DFA12(this); - static final String DFA12_eotS = - "\45\uffff"; - static final String DFA12_eofS = - "\45\uffff"; - static final String DFA12_minS = - "\1\22\1\uffff\20\7\2\uffff\2\4\1\0\1\4\1\uffff\1\0\1\4\3\uffff\2"+ - "\4\1\0\3\4\1\uffff"; - static final String DFA12_maxS = - "\1\47\1\uffff\17\7\1\22\2\uffff\1\22\1\47\1\0\1\22\1\uffff\1\0\1"+ - "\22\3\uffff\2\22\1\0\3\22\1\uffff"; - static final String DFA12_acceptS = - "\1\uffff\1\1\20\uffff\1\6\1\7\4\uffff\1\4\2\uffff\1\5\1\2\1\3\6"+ - "\uffff\1\4"; - static final String DFA12_specialS = - "\26\uffff\1\2\2\uffff\1\1\6\uffff\1\0\4\uffff}>"; - static final String[] DFA12_transitionS = { - "\1\21\1\23\1\16\1\4\1\11\1\2\1\17\1\6\2\1\1\22\1\7\1\15\1\10"+ - "\1\13\1\14\1\3\2\1\1\20\1\5\1\12", - "", - "\1\24", - "\1\24", - "\1\24", - "\1\24", - "\1\24", - "\1\24", - "\1\24", - "\1\24", - "\1\24", - "\1\25", - "\1\24", - "\1\24", - "\1\24", - "\1\24", - "\1\24", - "\1\24\12\uffff\1\21", - "", - "", - "\3\30\1\uffff\1\27\1\uffff\3\30\1\26\2\uffff\3\30", - "\3\30\1\uffff\1\27\1\uffff\3\30\1\31\2\uffff\2\30\1\32\1\uffff"+ - "\6\33\3\uffff\6\33\2\uffff\3\33", - "\1\uffff", - "\3\30\1\uffff\1\36\1\uffff\4\30\2\uffff\3\30", - "", - "\1\uffff", - "\3\30\1\uffff\1\30\1\uffff\2\30\1\37\1\30\2\uffff\2\30\1\32", - "", - "", - "", - "\3\30\1\uffff\1\30\1\uffff\3\30\1\40\2\uffff\3\30", - "\2\30\1\41\1\uffff\1\30\1\uffff\4\30\2\uffff\3\30", - "\1\uffff", - "\2\30\1\41\1\uffff\1\30\1\uffff\1\30\1\42\2\30\2\uffff\3\30", - "\2\30\1\43\1\uffff\1\30\1\uffff\4\30\2\uffff\3\30", - "\2\30\1\43\1\uffff\1\30\1\uffff\3\30\1\44\2\uffff\3\30", - "" - }; - - static final short[] DFA12_eot = DFA.unpackEncodedString(DFA12_eotS); - static final short[] DFA12_eof = DFA.unpackEncodedString(DFA12_eofS); - static final char[] DFA12_min = DFA.unpackEncodedStringToUnsignedChars(DFA12_minS); - static final char[] DFA12_max = DFA.unpackEncodedStringToUnsignedChars(DFA12_maxS); - static final short[] DFA12_accept = DFA.unpackEncodedString(DFA12_acceptS); - static final short[] DFA12_special = DFA.unpackEncodedString(DFA12_specialS); - static final short[][] DFA12_transition; - - static { - int numStates = DFA12_transitionS.length; - DFA12_transition = new short[numStates][]; - for (int i=0; i=0 ) return s; - break; - - case 1 : - int LA12_25 = input.LA(1); - - - int index12_25 = input.index(); - input.rewind(); - - s = -1; - if ( (((input.LT(1).getText().equals("W") || input.LT(1).getText().equals("B")))) ) {s = 28;} - - else if ( (true) ) {s = 29;} - - - input.seek(index12_25); - - if ( s>=0 ) return s; - break; - - case 2 : - int LA12_22 = input.LA(1); - - - int index12_22 = input.index(); - input.rewind(); - - s = -1; - if ( (((input.LT(1).getText().equals("W") || input.LT(1).getText().equals("B")))) ) {s = 28;} - - else if ( (true) ) {s = 29;} - - - input.seek(index12_22); - - if ( s>=0 ) return s; - break; - } - NoViableAltException nvae = - new NoViableAltException(getDescription(), 12, _s, input); - error(nvae); - throw nvae; - } - - } - public static final BitSet FOLLOW_gameTree_in_collection36 = new BitSet(new long[]{0x0000000000000202L}); - public static final BitSet FOLLOW_LPAREN_in_gameTree61 = new BitSet(new long[]{0x0000000000008000L}); - public static final BitSet FOLLOW_sequence_in_gameTree63 = new BitSet(new long[]{0x0000000000004200L}); - public static final BitSet FOLLOW_gameTree_in_gameTree67 = new BitSet(new long[]{0x0000000000004200L}); + 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[]{0x0000000000008002L}); - public static final BitSet FOLLOW_SEMICOLON_in_node115 = new BitSet(new long[]{0x000000FFFFFC0002L}); - public static final BitSet FOLLOW_property_in_node118 = new BitSet(new long[]{0x000000FFFFFC0002L}); - public static final BitSet FOLLOW_numIdent_in_property139 = new BitSet(new long[]{0x0000000000000080L}); - public static final BitSet FOLLOW_LBRACKET_in_property142 = new BitSet(new long[]{0x0000000000000040L}); - public static final BitSet FOLLOW_numValue_in_property144 = new BitSet(new long[]{0x0000000000002000L}); - public static final BitSet FOLLOW_RBRACKET_in_property146 = new BitSet(new long[]{0x0000000000000082L}); - public static final BitSet FOLLOW_playerIdent_in_property154 = new BitSet(new long[]{0x0000000000000080L}); - public static final BitSet FOLLOW_LBRACKET_in_property159 = new BitSet(new long[]{0x0000000000002100L}); - public static final BitSet FOLLOW_coordValue_in_property161 = new BitSet(new long[]{0x0000000000002000L}); - public static final BitSet FOLLOW_RBRACKET_in_property164 = new BitSet(new long[]{0x0000000000000082L}); - public static final BitSet FOLLOW_strIdent_in_property176 = new BitSet(new long[]{0x0000000000000080L}); - public static final BitSet FOLLOW_LBRACKET_in_property178 = new BitSet(new long[]{0x0000000000002000L}); - public static final BitSet FOLLOW_RBRACKET_in_property180 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_strIdent_in_property185 = new BitSet(new long[]{0x0000000000000080L}); - public static final BitSet FOLLOW_LBRACKET_in_property188 = new BitSet(new long[]{0x0000000000071D70L}); - public static final BitSet FOLLOW_strValue_in_property190 = new BitSet(new long[]{0x0000000000002000L}); - public static final BitSet FOLLOW_RBRACKET_in_property192 = new BitSet(new long[]{0x0000000000000082L}); - public static final BitSet FOLLOW_result_in_property200 = new BitSet(new long[]{0x0000000000000080L}); - public static final BitSet FOLLOW_LBRACKET_in_property203 = new BitSet(new long[]{0x000000E7E3F40000L}); - public static final BitSet FOLLOW_resValue_in_property205 = new BitSet(new long[]{0x0000000000002000L}); - public static final BitSet FOLLOW_RBRACKET_in_property207 = new BitSet(new long[]{0x0000000000000082L}); - public static final BitSet FOLLOW_komi_in_property214 = new BitSet(new long[]{0x0000000000000080L}); - public static final BitSet FOLLOW_LBRACKET_in_property217 = new BitSet(new long[]{0x0000000000000040L}); - public static final BitSet FOLLOW_realValue_in_property219 = new BitSet(new long[]{0x0000000000002000L}); - public static final BitSet FOLLOW_RBRACKET_in_property221 = new BitSet(new long[]{0x0000000000000082L}); - public static final BitSet FOLLOW_coordIdent_in_property228 = new BitSet(new long[]{0x0000000000000080L}); - public static final BitSet FOLLOW_LBRACKET_in_property230 = new BitSet(new long[]{0x0000000000000100L}); - public static final BitSet FOLLOW_coordValue_in_property232 = new BitSet(new long[]{0x0000000000002000L}); - public static final BitSet FOLLOW_RBRACKET_in_property234 = new BitSet(new long[]{0x0000000000000082L}); - public static final BitSet FOLLOW_strIdent_in_playerIdent247 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_charEnc_in_strIdent257 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_source_in_strIdent268 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_blackCountry_in_strIdent279 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_whiteCountry_in_strIdent290 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_event_in_strIdent295 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_playerBlack_in_strIdent300 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_playerWhite_in_strIdent305 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_blackRank_in_strIdent310 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_whiteRank_in_strIdent315 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_result_in_strIdent320 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_rules_in_strIdent325 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_place_in_strIdent330 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_application_in_strIdent343 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_copyright_in_strIdent355 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_username_in_strIdent367 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_UCLETTER_in_strIdent379 = new BitSet(new long[]{0x0000000000040002L}); - public static final BitSet FOLLOW_addBlack_in_coordIdent389 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_fileFormat_in_numIdent400 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_game_in_numIdent405 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_size_in_numIdent410 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_time_in_numIdent415 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_DIGIT_in_numValue424 = new BitSet(new long[]{0x0000000000000042L}); - public static final BitSet FOLLOW_komi_in_realIdent435 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_playerIdent_in_resValue445 = new BitSet(new long[]{0x0000000000001000L}); - public static final BitSet FOLLOW_PLUS_in_resValue447 = new BitSet(new long[]{0x0000000000000040L}); - public static final BitSet FOLLOW_realValue_in_resValue449 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_DIGIT_in_realValue459 = new BitSet(new long[]{0x0000000000000840L}); - public static final BitSet FOLLOW_PERIOD_in_realValue462 = new BitSet(new long[]{0x0000000000000040L}); - public static final BitSet FOLLOW_DIGIT_in_realValue464 = new BitSet(new long[]{0x0000000000000042L}); - public static final BitSet FOLLOW_LCLETTER_in_coordValue474 = new BitSet(new long[]{0x0000000000000100L}); - public static final BitSet FOLLOW_LCLETTER_in_coordValue476 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_26_in_fileFormat486 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_27_in_game494 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_35_in_size502 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_23_in_charEnc509 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_34_in_source516 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_21_in_blackCountry525 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_38_in_whiteCountry534 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_25_in_event541 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_29_in_playerBlack549 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_31_in_playerWhite557 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_22_in_blackRank565 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_39_in_whiteRank575 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_28_in_komi583 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_32_in_result591 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_33_in_rules598 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_30_in_place607 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_20_in_application615 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_36_in_time622 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_19_in_addBlack628 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_24_in_copyright636 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_37_in_username642 = 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_property169 = new BitSet(new long[]{0x0000000000008200L}); + public static final BitSet FOLLOW_coordValue_in_property171 = new BitSet(new long[]{0x0000000000008000L}); + public static final BitSet FOLLOW_RBRACKET_in_property174 = new BitSet(new long[]{0x0000000000000102L}); + public static final BitSet FOLLOW_strIdent_in_property186 = new BitSet(new long[]{0x0000000000000100L}); + public static final BitSet FOLLOW_LBRACKET_in_property192 = new BitSet(new long[]{0x0000000000008000L}); + public static final BitSet FOLLOW_RBRACKET_in_property194 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_strIdent_in_property203 = new BitSet(new long[]{0x0000000000000100L}); + public static final BitSet FOLLOW_LBRACKET_in_property209 = new BitSet(new long[]{0x00000000001C6AB0L}); + public static final BitSet FOLLOW_strValue_in_property211 = new BitSet(new long[]{0x0000000000008000L}); + public static final BitSet FOLLOW_RBRACKET_in_property213 = new BitSet(new long[]{0x0000000000000102L}); + public static final BitSet FOLLOW_result_in_property225 = new BitSet(new long[]{0x0000000000000100L}); + public static final BitSet FOLLOW_LBRACKET_in_property231 = new BitSet(new long[]{0x000079DC7F400000L}); + public static final BitSet FOLLOW_resValue_in_property233 = new BitSet(new long[]{0x0000000000008000L}); + public static final BitSet FOLLOW_RBRACKET_in_property235 = new BitSet(new long[]{0x0000000000000102L}); + public static final BitSet FOLLOW_komi_in_property245 = new BitSet(new long[]{0x0000000000000100L}); + public static final BitSet FOLLOW_LBRACKET_in_property251 = new BitSet(new long[]{0x0000000000000080L}); + public static final BitSet FOLLOW_realValue_in_property253 = new BitSet(new long[]{0x0000000000008000L}); + public static final BitSet FOLLOW_RBRACKET_in_property255 = new BitSet(new long[]{0x0000000000000102L}); + public static final BitSet FOLLOW_coordIdent_in_property265 = new BitSet(new long[]{0x0000000000000100L}); + public static final BitSet FOLLOW_LBRACKET_in_property270 = new BitSet(new long[]{0x0000000000000200L}); + public static final BitSet FOLLOW_coordValue_in_property272 = new BitSet(new long[]{0x0000000000008000L}); + public static final BitSet FOLLOW_RBRACKET_in_property274 = new BitSet(new long[]{0x0000000000000102L}); + public static final BitSet FOLLOW_strIdent_in_playerIdent297 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_strIdent_in_playerIdent306 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_charEnc_in_strIdent323 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_source_in_strIdent335 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_blackCountry_in_strIdent346 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_whiteCountry_in_strIdent357 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_event_in_strIdent362 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_playerBlack_in_strIdent367 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_playerWhite_in_strIdent372 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_blackRank_in_strIdent377 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_whiteRank_in_strIdent382 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_result_in_strIdent387 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_rules_in_strIdent392 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_place_in_strIdent397 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_application_in_strIdent410 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_copyright_in_strIdent422 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_username_in_strIdent434 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_date_in_strIdent446 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_24_in_strIdent458 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_44_in_strIdent471 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_addBlack_in_coordIdent517 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_addWhite_in_coordIdent525 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_fileFormat_in_numIdent542 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_game_in_numIdent548 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_size_in_numIdent554 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_time_in_numIdent560 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_DIGIT_in_numValue575 = new BitSet(new long[]{0x0000000000000082L}); + public static final BitSet FOLLOW_komi_in_realIdent588 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_playerIdent_in_resValue598 = new BitSet(new long[]{0x0000000000004000L}); + public static final BitSet FOLLOW_PLUS_in_resValue600 = new BitSet(new long[]{0x0000002000000080L}); + public static final BitSet FOLLOW_37_in_resValue603 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_realValue_in_resValue607 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_DIGIT_in_realValue618 = new BitSet(new long[]{0x0000000000002080L}); + public static final BitSet FOLLOW_PERIOD_in_realValue621 = new BitSet(new long[]{0x0000000000000080L}); + public static final BitSet FOLLOW_DIGIT_in_realValue623 = new BitSet(new long[]{0x0000000000000082L}); + public static final BitSet FOLLOW_LCLETTER_in_coordValue633 = new BitSet(new long[]{0x0000000000000200L}); + public static final BitSet FOLLOW_LCLETTER_in_coordValue635 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_31_in_fileFormat645 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_32_in_game653 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_41_in_size661 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_27_in_charEnc668 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_40_in_source675 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_25_in_blackCountry684 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_45_in_whiteCountry693 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_30_in_event700 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_34_in_playerBlack708 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_36_in_playerWhite716 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_26_in_blackRank724 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_46_in_whiteRank734 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_33_in_komi742 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_38_in_result750 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_39_in_rules757 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_35_in_place766 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_22_in_application774 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_42_in_time781 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_29_in_date789 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_21_in_addBlack802 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_23_in_addWhite819 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_28_in_copyright831 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_43_in_username837 = new BitSet(new long[]{0x0000000000000002L}); } \ No newline at end of file diff --git a/src/net/woodyfolsom/msproj/sgf/SGFPlayer.java b/src/net/woodyfolsom/msproj/sgf/SGFPlayer.java new file mode 100644 index 0000000..678c3dd --- /dev/null +++ b/src/net/woodyfolsom/msproj/sgf/SGFPlayer.java @@ -0,0 +1,37 @@ +package net.woodyfolsom.msproj.sgf; + +public class SGFPlayer { + public static final SGFPlayer BLACK = new SGFPlayer("Black"); + public static final SGFPlayer WHITE = new SGFPlayer("White"); + + private String color; + + public static SGFPlayer getInstance(String color) { + if ("B".equals(color)) { + return BLACK; + } else if ("W".equals(color)) { + return WHITE; + } else { + throw new IllegalArgumentException(color); + } + } + + private SGFPlayer(String color) { + this.color = color; + } + + public String getColor() { + return color; + } + + @Override + public String toString() { + if (this == BLACK) { + return "B"; + } else if (this == WHITE){ + return "W"; + } else { + throw new RuntimeException("Invalid player"); + } + } +} diff --git a/src/net/woodyfolsom/msproj/sgf/SGFProperty.java b/src/net/woodyfolsom/msproj/sgf/SGFProperty.java index 40024b8..3dca4ee 100644 --- a/src/net/woodyfolsom/msproj/sgf/SGFProperty.java +++ b/src/net/woodyfolsom/msproj/sgf/SGFProperty.java @@ -1,22 +1,26 @@ package net.woodyfolsom.msproj.sgf; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + public class SGFProperty { - private StrIdent ident; - private StrValue value; + private SGFIdentifier ident; + private List> values = new ArrayList>(); - public StrIdent getIdent() { + public void addValue(SGFValue value) { + this.values.add(value); + } + + public SGFIdentifier getIdentifier() { return ident; } - public StrValue getValue() { - return value; + public List> getValues() { + return Collections.unmodifiableList(values); } - public void setIdent(StrIdent ident) { + public void setIdentifier(SGFIdentifier ident) { this.ident = ident; - } - - public void setValue(StrValue value) { - this.value = value; - } + } } diff --git a/src/net/woodyfolsom/msproj/sgf/SGFResult.java b/src/net/woodyfolsom/msproj/sgf/SGFResult.java new file mode 100644 index 0000000..b118860 --- /dev/null +++ b/src/net/woodyfolsom/msproj/sgf/SGFResult.java @@ -0,0 +1,31 @@ +package net.woodyfolsom.msproj.sgf; + +public class SGFResult { + private boolean resignation = false; + private boolean tie; + private double score; + private SGFPlayer winner; + + public SGFResult(String value) { + String[] params = value.split("\\+"); + + winner = SGFPlayer.getInstance(params[0]); + + if ("R".equals(params[1])) { + resignation = true; + } else { + score = Double.parseDouble(params[1]); + } + } + + @Override + public String toString() { + if (resignation == false && tie == false) { + return winner.toString() + "+" + score; + } else if (resignation == true && tie == false) { + return winner.toString() + "+R"; + } else { + throw new UnsupportedOperationException("Not implemented"); + } + } +} diff --git a/src/net/woodyfolsom/msproj/sgf/SGFValue.java b/src/net/woodyfolsom/msproj/sgf/SGFValue.java new file mode 100644 index 0000000..fdbfbe7 --- /dev/null +++ b/src/net/woodyfolsom/msproj/sgf/SGFValue.java @@ -0,0 +1,21 @@ +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 String getText() { + return text; + } + + public T getValue() { + return value; + } +} diff --git a/src/net/woodyfolsom/msproj/tree/GameTreeNode.java b/src/net/woodyfolsom/msproj/tree/GameTreeNode.java index 8fc0c8a..9c434ea 100644 --- a/src/net/woodyfolsom/msproj/tree/GameTreeNode.java +++ b/src/net/woodyfolsom/msproj/tree/GameTreeNode.java @@ -6,6 +6,7 @@ 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; diff --git a/test/net/woodyfolsom/msproj/LegalMoveTest.java b/test/net/woodyfolsom/msproj/LegalMoveTest.java index 5ec2152..d0fe17b 100644 --- a/test/net/woodyfolsom/msproj/LegalMoveTest.java +++ b/test/net/woodyfolsom/msproj/LegalMoveTest.java @@ -1,5 +1,6 @@ package net.woodyfolsom.msproj; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import org.junit.Test; @@ -9,8 +10,14 @@ public class LegalMoveTest { public void testLegalMove1Liberty() { GameState gameState = new GameState(5); gameState.playStone(Player.BLACK, Action.getInstance("A2")); + assertEquals(Player.WHITE, gameState.getPlayerToMove()); + gameState.playStone(Player.WHITE, Action.PASS); + gameState.playStone(Player.BLACK, Action.getInstance("B3")); + gameState.playStone(Player.WHITE, Action.PASS); + gameState.playStone(Player.BLACK, Action.getInstance("B1")); + assertTrue(gameState.playStone(Player.WHITE, Action.getInstance("B2"))); System.out.println(gameState); } diff --git a/test/net/woodyfolsom/msproj/policy/MonteCarloUCTTest.java b/test/net/woodyfolsom/msproj/policy/MonteCarloUCTTest.java index e840193..128fa3c 100644 --- a/test/net/woodyfolsom/msproj/policy/MonteCarloUCTTest.java +++ b/test/net/woodyfolsom/msproj/policy/MonteCarloUCTTest.java @@ -1,6 +1,7 @@ package net.woodyfolsom.msproj.policy; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import net.woodyfolsom.msproj.Action; import net.woodyfolsom.msproj.GameConfig; @@ -54,4 +55,25 @@ public class MonteCarloUCTTest { System.out.println(gameState); } + + @Test + public void testIllegalMoveRejection() { + Policy treeSearch = new MonteCarloUCT(new RandomMovePolicy(),2000L); + GameState gameState = new GameState(4); + gameState.playStone(Player.WHITE, Action.getInstance("A2")); + gameState.playStone(Player.WHITE, Action.getInstance("B1")); + gameState.playStone(Player.WHITE, Action.getInstance("C2")); + gameState.playStone(Player.WHITE, Action.getInstance("B3")); + + Action move; + + for (int i = 0; i < 10; i++) { + move = treeSearch.getAction(new GameConfig(), gameState, Player.BLACK); + System.out.println("Generated move: " + move); + GameState stateCopy = new GameState(gameState); + stateCopy.playStone(Player.BLACK, move); + System.out.println(stateCopy); + assertFalse(Action.getInstance("B2").equals(move)); + } + } } \ No newline at end of file