(String[] args)
| 124 | } |
| 125 | |
| 126 | public static void main(String[] args) throws Exception { |
| 127 | if ( args.length<7 ) { |
| 128 | System.err.println("org.antlr.codebuff.Tool -g grammar-name -rule start-rule -corpus root-dir-of-samples \\\n" + |
| 129 | " [-files file-extension] [-indent num-spaces] \\" + |
| 130 | " [-comment line-comment-name] [-o output-file] file-to-format"); |
| 131 | return; |
| 132 | } |
| 133 | |
| 134 | String grammarName = null; |
| 135 | String startRule = null; |
| 136 | String corpusDir = null; |
| 137 | String indentS = "4"; |
| 138 | String commentS = null; |
| 139 | String testFileName = null; |
| 140 | String outputFileName = null; |
| 141 | String fileExtension = null; |
| 142 | int i = 0; |
| 143 | while ( i<args.length && args[i].startsWith("-") ) { |
| 144 | switch ( args[i] ) { |
| 145 | case "-g": |
| 146 | i++; |
| 147 | grammarName = args[i++]; |
| 148 | break; |
| 149 | case "-rule" : |
| 150 | i++; |
| 151 | startRule = args[i++]; |
| 152 | break; |
| 153 | case "-corpus" : |
| 154 | i++; |
| 155 | corpusDir = args[i++]; |
| 156 | break; |
| 157 | case "-files" : |
| 158 | i++; |
| 159 | fileExtension = args[i++]; |
| 160 | break; |
| 161 | case "-indent" : |
| 162 | i++; |
| 163 | indentS = args[i++]; |
| 164 | break; |
| 165 | case "-comment" : |
| 166 | i++; |
| 167 | commentS = args[i++]; |
| 168 | break; |
| 169 | case "-o" : |
| 170 | i++; |
| 171 | outputFileName = args[i++]; |
| 172 | break; |
| 173 | } |
| 174 | } |
| 175 | testFileName = args[i]; // must be last |
| 176 | |
| 177 | System.out.println("gramm: "+grammarName); |
| 178 | String parserClassName = grammarName+"Parser"; |
| 179 | String lexerClassName = grammarName+"Lexer"; |
| 180 | Class<? extends Parser> parserClass = null; |
| 181 | Class<? extends Lexer> lexerClass = null; |
| 182 | Lexer lexer = null; |
| 183 | try { |
nothing calls this directly
no test coverage detected