| 169 | |
| 170 | // See GameSpanw.ED_ParseEdict() to see how to use it now. |
| 171 | @Deprecated |
| 172 | public static String Parse(ParseHelp hlp) { |
| 173 | int c; |
| 174 | int len = 0; |
| 175 | |
| 176 | if (hlp.data == null) { |
| 177 | return ""; |
| 178 | } |
| 179 | |
| 180 | while (true) { |
| 181 | // skip whitespace |
| 182 | hlp.skipwhites(); |
| 183 | if (hlp.isEof()) { |
| 184 | hlp.data = null; |
| 185 | return ""; |
| 186 | } |
| 187 | |
| 188 | // skip // comments |
| 189 | if (hlp.getchar() == '/') { |
| 190 | if (hlp.nextchar() == '/') { |
| 191 | hlp.skiptoeol(); |
| 192 | // goto skip whitespace |
| 193 | continue; |
| 194 | } else { |
| 195 | hlp.prevchar(); |
| 196 | break; |
| 197 | } |
| 198 | } else |
| 199 | break; |
| 200 | } |
| 201 | |
| 202 | // handle quoted strings specially |
| 203 | if (hlp.getchar() == '\"') { |
| 204 | hlp.nextchar(); |
| 205 | while (true) { |
| 206 | c = hlp.getchar(); |
| 207 | hlp.nextchar(); |
| 208 | if (c == '\"' || c == 0) { |
| 209 | return new String(com_token, 0, len); |
| 210 | } |
| 211 | if (len < Defines.MAX_TOKEN_CHARS) { |
| 212 | com_token[len] = (char) c; |
| 213 | len++; |
| 214 | } |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | // parse a regular word |
| 219 | c = hlp.getchar(); |
| 220 | do { |
| 221 | if (len < Defines.MAX_TOKEN_CHARS) { |
| 222 | com_token[len] = (char) c; |
| 223 | len++; |
| 224 | } |
| 225 | c = hlp.nextchar(); |
| 226 | } while (c > 32); |
| 227 | |
| 228 | if (len == Defines.MAX_TOKEN_CHARS) { |